From a3d906e63eabd3b611d3c4df17afe45e3541f2df Mon Sep 17 00:00:00 2001 From: Myned Date: Sat, 14 Oct 2017 15:29:35 -0400 Subject: [PATCH] Checked for session creation before closing, formatting change --- src/main/cogs/owner.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/cogs/owner.py b/src/main/cogs/owner.py index d8f6470..2ced366 100644 --- a/src/main/cogs/owner.py +++ b/src/main/cogs/owner.py @@ -32,11 +32,12 @@ class Bot: # loop = self.bot.loop.all_tasks() # for task in loop: # task.cancel() - await u.session.close() + if u.session: + await u.session.close() await self.bot.logout() await self.bot.close() print('- - - - - - -') - print('CLOSED') + print('DISCONNECTED') @commands.command(name=',restart', aliases=[',res', ',r'], hidden=True) @commands.is_owner() @@ -49,7 +50,8 @@ class Bot: # loop = self.bot.loop.all_tasks() # for task in loop: # task.cancel() - await u.session.close() + if u.session: + await u.session.close() await self.bot.logout() await self.bot.close() os.execl(sys.executable, 'python3', 'run.py')