I
I
Igor Gafarchik2020-05-24 22:58:05
Python
Igor Gafarchik, 2020-05-24 22:58:05

Discord.py bot Quit?

Good day!
I want to make a bot that will automatically leave the server in half an hour. I didn’t find anything like this in the documentation. I wrote the following code:

@bot.event
async def on_connect():
    print("10")
    await asyncio.sleep(1800)
    await bot.leave_guild()

But it is not working (.So how can I implement this function? Is it possible at all and if so, how?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Shavukhin, 2020-05-25
@Gafarchik

Use a timer
Let's use the if function and when the timer comes to an end, start the execution of the exit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question