An easy way of getting a reply when some user tags your bot would be using a decorator in the bot instance:
from discord.ext import commands
client = commands.Bot(command_prefix=commands.when_mentioned_or("!"))
But if you only want people to be able to simply send a message tagging your bot and it returns the prefix, you can simply check with the function mentioned_in
to see if the bot is being mentioned in the message.
@client.event
async def on_message(message):
if client.user.mentioned_in(message):
await message.channel.send("The prefix is '!'")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…