Answer the question
In order to leave comments, you need to log in
How to make the discord bot send a message every 10 minutes?
I want to make my discord bot send a message every 10 minutes, but I can't do it. I use the discord.py library.
Here is what I have:
@bot.event
async def on_message(ctx):
message = get_message()
await bot.get_channel("Привет").send(message)
await asyncio.sleep(10)
await bot.get_channel("Привет").send(message)
Answer the question
In order to leave comments, you need to log in
discord.py has its own mechanism for performing regular tasks:
from discord.ext import tasks
@tasks.loop(seconds=600)
async def notify_task():
await bot.wait_until_ready()
... нужные действия
notify_task.start()
bot.run(config.BOT_TOKEN)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question