【发布时间】:2021-04-23 02:17:09
【问题描述】:
我的 discord.py 机器人中有一个事件,它应该只对包含“welc”或“welcome”的消息使用表情符号做出反应,但是,机器人会对聊天中发送的所有消息做出反应。这是事件的代码。
@commands.Cog.listener()
async def on_message(self, message):
welcome1 = 'welcome'
welc = 'welc'
if message.content == welcome1 or welc:
await message.add_reaction('<:z_heart1:786021804690636810>')
我尝试在 if 语句中使用 else 传递,但这似乎不起作用。
【问题讨论】:
标签: python discord discord.py