(discord.py)检测消息中的某些关键字

(discord.py)检测消息中的某些关键字,discord.py,Discord.py,我曾计划制作一个语法机器人来取乐,我希望它能在消息中找到特定的关键字,而不仅仅是询问它是否只是那个关键字。我还没有找到任何接近我想要的东西。帮助?假设要检查发送的每条消息,可以使用普通Python在on_message事件中检查关键字的message.content。下面的示例代码,其中代码将检查消息中是否有FOO @bot.event async def on_message(message): if 'FOO' in message.content: print('K

我曾计划制作一个语法机器人来取乐,我希望它能在消息中找到特定的关键字,而不仅仅是询问它是否只是那个关键字。我还没有找到任何接近我想要的东西。帮助?

假设要检查发送的每条消息,可以使用普通Python在
on_message
事件中检查关键字的
message.content
。下面的示例代码,其中代码将检查消息中是否有FOO

@bot.event
async def on_message(message):
    if 'FOO' in message.content:
        print('Keyword found in message')
        # Do stuff here

假设您希望检查发送的每条消息,可以使用普通Python检查
on_message
事件中的
message.content
中的关键字。下面的示例代码,其中代码将检查消息中是否有FOO

@bot.event
async def on_message(message):
    if 'FOO' in message.content:
        print('Keyword found in message')
        # Do stuff here