Discord Bot 命令在实现回复功能后停止工作

时间:2021-04-08 11:44:45

标签: python discord discord.py bots

我对编程很陌生,但设法让一个非常有趣的机器人为 Discord 服务器工作。它会监听诸如 help 和 8ball 之类的命令,但我也希望它能够响应某些消息。

当我尝试让机器人在检测到特定消息后发送消息时,它可以工作,但所有其他功能都停止工作。当我删除回复功能的代码时,一切都会恢复正常。我认为它与 if 语句有关,并且它可能需要诸如返回传递之类的东西,但我无法弄清楚。

@client.event
async def on_message(message):
    if 'bad' in message.content.lower():
        if 'bot' in message.content.lower():
            await message.channel.send('testmessage1')

    if 'good' in message.content.lower():
        if 'bot' in message.content.lower():
            await message.channel.send('testmessage2')    

提前致谢!

0 个答案:

没有答案