diff --git a/src/cogs/owner.py b/src/cogs/owner.py index c4cffe4..a385fb8 100644 --- a/src/cogs/owner.py +++ b/src/cogs/owner.py @@ -36,10 +36,9 @@ class Bot: # loop = self.bot.loop.all_tasks() # for task in loop: # task.cancel() - await self.bot.logout() - u.close(self.bot.loop) print('\n< < < < < < < < < < < <\nD I S C O N N E C T E D\n< < < < < < < < < < < <\n') # u.notify('D I S C O N N E C T E D') + await self.bot.logout() @cmds.command(name=',restart', aliases=[',res', ',r'], hidden=True) @cmds.is_owner() @@ -58,7 +57,6 @@ class Bot: # for task in loop: # task.cancel() await self.bot.logout() - u.close(self.bot.loop) os.execl(sys.executable, 'python3', 'run.py') # Invite bot to bot owner's server diff --git a/src/utils/utils.py b/src/utils/utils.py index e9cf70f..17d48d3 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -116,22 +116,6 @@ async def fetch(url, *, params={}, json=False, response=False): # obj = replace # asyncio.sleep(interval) - -def close(loop): - if session: - session.close() - - loop.stop() - pending = asyncio.Task.all_tasks() - for task in pending: - task.cancel() - # with suppress(asyncio.CancelledError): - # loop.run_until_complete(task) - # loop.close() - - print('Finished cancelling tasks.') - - def generate_embed(ctx, *, title=d.Embed.Empty, kind='rich', description=d.Embed.Empty, url=d.Embed.Empty, timestamp=d.Embed.Empty, colour=color, footer={}, image=d.Embed.Empty, thumbnail=d.Embed.Empty, author={}, fields=[]): embed = d.Embed(title=title, type=kind, description=description, url=url, timestamp=timestamp, colour=colour if isinstance(ctx.channel, d.TextChannel) else color)