Answer the question
In order to leave comments, you need to log in
How to remove double output?
Tell me please.
I have a bot that reacts to a keyword (in a list) and outputs certain text.
The problem is that if there are 2 keywords in the text sent by the participant, then the bot will write 2 times.
How can this be fixed? How to make it so that if there are 2 keywords in the sentence, then the bot unsubscribed 1 time with 1 keyword.
Thank you.
reac_words = ['test', 'test1']
slovo = None
@client.event
async def on_message(message):
if message.author == client.user:
return
msg = message.content.lower()
for word in reac_words:
if word in msg:
slovo = word
await message.channel.send('{} - есть в списке.'.format(slovo))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question