From d95f937f7a5816e9e01197db110792501505b6d8 Mon Sep 17 00:00:00 2001 From: Etzelia Date: Tue, 3 Mar 2020 22:24:28 -0600 Subject: [PATCH] Loop Signed-off-by: Etzelia --- bot/discord.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bot/discord.py b/bot/discord.py index 0a4ebd8..993cc37 100644 --- a/bot/discord.py +++ b/bot/discord.py @@ -108,13 +108,17 @@ class Discord(commands.Bot): def run_bot(self): global discord_loop - try: - discord_loop.run_until_complete(self.start(self.token)) - except KeyboardInterrupt: - logger.info("Bot received keyboard interrupt") - except Exception as e: - print(e) - logger.info('Bot encountered the following unhandled exception %s', e) + loop = True + while loop: + try: + discord_loop.run_until_complete(self.start(self.token)) + except KeyboardInterrupt: + logger.info("Bot received keyboard interrupt") + loop = False + except Exception as e: + print(e) + logger.info('Bot encountered the following unhandled exception %s', e) + loop = False def start():