O
O
Oh_noo21952021-10-22 16:57:15
Python
Oh_noo2195, 2021-10-22 16:57:15

How to make the bot not react to messages in which there is a part of the word to which it should react?

@bot.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@bot.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith("привет"):
        await message.channel.send('привет')

For example:
If I write the word "hello", then he answers, and if I write the word "hello", then he ignores the message.

I will be very grateful:>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WolfInChains, 2021-10-22
@Oh_noo2195

So chtol? Or if you need a few words, then
if message.content == "привет":

my_list = ["привет", "ку", "дарова"]

if message.content in my_list:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question