Answer the question
In order to leave comments, you need to log in
How to make cd?
I wanted to make a cooldown through asyncio.slepp, but something did not work out. Please advise how it can be implemented. Purpose: If 1 participant has registered 'Hello', then the bot sends him the text 'Hello to you too', after which n number of times must not respond to the hello list. (meaning fall asleep)
hello = ['Привет', 'Хай']
@client.event
async def on_message(message):
m = message.content.lower()
if message.author == client.user:
return
if m in hello:
await message.channel.send('И тебе привет!')
await asyncio.sleep(60)
Answer the question
In order to leave comments, you need to log in
For example, save the time of the event (message reception), when the next one occurs, calculate the time difference and perform / do not perform actions
hello = ['Hi', 'Hi']
@client.event
async def on_message(message):
m = message.content.lower()
if message.author == client.user:
return
If you do message.content.lower () then in the list indicate the message in small letters, otherwise the bot will not send anything.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question