-1

How do i get the bot to send a message if a word inside of the sentence triggers it? Similar to @client.event async def on_message(message) if message.content == "MESSAGE": await message.channel.send("MESSAGE")

I basically want it to recognize something like Quack comes from a duck **BOT**:

Triggers the word duck.

Jay
  • 7
  • 1

1 Answers1

0

If you want to search for a substring inside a string, you can use the membership operator in. For your code:

@client.event 
async def on_message(message): 
    if "duck" in message.content.lower():    # lower() is used so that every case of duck will trigger it.
        await message.channel.send("MESSAGE")