【发布时间】:2021-08-03 04:13:30
【问题描述】:
当有人提到机器人时,我希望它回应说:“嘿!我被提及了。我的前缀是 >。你可以输入 >help 来查看我的命令。”我已经写出了代码,但是当提到它时,机器人根本没有响应。当我运行它或提及机器人时,我没有收到任何错误。我怎样才能让它工作?我的代码如下。提前致谢。
@bot.event
async def on_message(message):
if message.author.id == bot.user.id:
return
msg_content = message.content.lower()
mention = ['@830599839623675925', '@Ultimate Bot']
if any(word in msg_content for word in mention):
await message.channel.send("Hey! I've been mentioned. My prefix is `>`. You can type `>help` to see my commands.")
else:
await bot.process_commands(message)
【问题讨论】:
标签: python discord discord.py