Terminating await and restarting #8165
Unanswered
adrian141b
asked this question in
General
Replies: 2 comments 3 replies
-
So you are basically want a loop of which run 5 times! Better use from discord.ext import tasks
RUN_AFTER = 60 # seconds
COUNT = 5 # 5 loops
bot = commands.Bot(...)
@tasks.loop(seconds=RUN_AFTER, count=COUNT)
async def message_downloader():
...
message_downloader.start()
bot.run(...) |
Beta Was this translation helpful? Give feedback.
2 replies
-
Restarting the instance like this doesn't work with discord.py due to the sheer amount of resources at play. Discord also doesn't like wasted IDENTIFYs like this so it's not going to be wholly supported. Your best bet is to redesign your problem so you can use a task like posted elsewhere. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
hello, i would like to create a bot which Terminating await and restarting, it it possible? (i have loop error after the second bot.run("token"))
For expample:
@client.event
async def on_ready():
downloading messages...
print(messages saved)
x =5
while x > 0
bot.run("token")
x-=1
I know we have a discord command but i can't use timing session in my project.
Beta Was this translation helpful? Give feedback.
All reactions