📜  python discord 提及用户 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:34.695000             🧑  作者: Mango

代码示例5
import discord
import os

TOKEN = os.environ[""]
client = discord.Client()

#This command basicallty mentions the person who used the command.
if message.content.startswith("!mentionself"):
    ID = message.author.id
    await message.channel.send("<@"+str(id)+"> Mentioned you!")

#-OR-
#(This one is just more efficient.)

if message.content.startswith("!mentionself"):
    author = message.author
    await message.channel.send({author.mention}+" - Mentioned you!")

client.run(TOKEN)