mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 03:38:53 -05:00
[V3] Fixes issue preventing token reset from setup (#1771)
* fixes issue preventing token reset. Also removes a faulty assumption about not needing cleanup tasks * Update __main__.py remove unneeded condition
This commit is contained in:
parent
741f3cbdcc
commit
a0a2976e0a
@ -139,18 +139,16 @@ def main():
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
if tmp_data["enable_sentry"]:
|
if tmp_data["enable_sentry"]:
|
||||||
red.enable_sentry()
|
red.enable_sentry()
|
||||||
cleanup_tasks = True
|
|
||||||
try:
|
try:
|
||||||
loop.run_until_complete(red.start(token, bot=not cli_flags.not_bot))
|
loop.run_until_complete(red.start(token, bot=not cli_flags.not_bot))
|
||||||
except discord.LoginFailure:
|
except discord.LoginFailure:
|
||||||
cleanup_tasks = False # No login happened, no need for this
|
|
||||||
log.critical(
|
log.critical(
|
||||||
"This token doesn't seem to be valid. If it belongs to "
|
"This token doesn't seem to be valid. If it belongs to "
|
||||||
"a user account, remember that the --not-bot flag "
|
"a user account, remember that the --not-bot flag "
|
||||||
"must be used. For self-bot functionalities instead, "
|
"must be used. For self-bot functionalities instead, "
|
||||||
"--self-bot"
|
"--self-bot"
|
||||||
)
|
)
|
||||||
db_token = red.db.token()
|
db_token = loop.run_until_complete(red.db.token())
|
||||||
if db_token and not cli_flags.no_prompt:
|
if db_token and not cli_flags.no_prompt:
|
||||||
print("\nDo you want to reset the token? (y/n)")
|
print("\nDo you want to reset the token? (y/n)")
|
||||||
if confirm("> "):
|
if confirm("> "):
|
||||||
@ -165,7 +163,6 @@ def main():
|
|||||||
sentry_log.critical("Fatal Exception", exc_info=e)
|
sentry_log.critical("Fatal Exception", exc_info=e)
|
||||||
loop.run_until_complete(red.logout())
|
loop.run_until_complete(red.logout())
|
||||||
finally:
|
finally:
|
||||||
if cleanup_tasks:
|
|
||||||
pending = asyncio.Task.all_tasks(loop=red.loop)
|
pending = asyncio.Task.all_tasks(loop=red.loop)
|
||||||
gathered = asyncio.gather(*pending, loop=red.loop, return_exceptions=True)
|
gathered = asyncio.gather(*pending, loop=red.loop, return_exceptions=True)
|
||||||
gathered.cancel()
|
gathered.cancel()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user