I'm making a discord bot in python, using the discord API. In the script I have a shutdown coroutine where I do some cleanup, then I await client.close() and finally I call exit():
async def shutdown(do_exit = True):
talkbot_exit()
print("talkbot closed")
await client.close()
print("client closed")
if do_exit is True:
print("exiting...")
exit()
The problem is, when I call (awaiting) the shutdown coroutine it halts on client.close(): the first part finishes just fine and the debug message is printed, but the second message is not and the console never returns to regular command line, it justs halts there.
I tried calling client.close() in other places, even at the very beginning of the program and in the on_ready function, but I always get the same problem. Didn't find much online, does anyone know what's happening?
from Discord bot halting on client.close()
No comments:
Post a Comment