From bab0900fde4a2e3f6d43349ebe6504014ccbd522 Mon Sep 17 00:00:00 2001 From: Myned Date: Sun, 1 Apr 2018 07:29:27 -0400 Subject: [PATCH] Add assignment of cogs to manageable variables --- src/run.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/run.py b/src/run.py index 553b4c5..28bbbde 100644 --- a/src/run.py +++ b/src/run.py @@ -74,8 +74,10 @@ async def on_ready(): from cogs import booru, info, management, owner, tools + cogs = {} for cog in (tools.Utils(bot), owner.Bot(bot), owner.Tools(bot), management.Administration(bot), info.Info(bot), booru.MsG(bot)): bot.add_cog(cog) + cogs[type(cog).__name__] = cog print(f'COG : {type(cog).__name__}') # bot.loop.create_task(u.clear(booru.temp_urls, 30*60)) @@ -104,14 +106,18 @@ async def on_ready(): else: print('\n- - - -\nI N F O : reconnected, reinitializing\n- - - -') - from cogs import booru, info, management, owner, tools - - for cog in (tools.Utils(bot), owner.Bot(bot), owner.Tools(bot), management.Administration(bot), info.Info(bot), booru.MsG(bot)): - bot.add_cog(cog) - print(f'COG : {type(cog).__name__}') + if u.tasks['auto_del']: + for channel in u.tasks['auto_del']: + temp = bot.get_channel(channel) + bot.loop.create_task(cogs['Administration'].queue_for_deletion(temp)) + print('RESTARTED : auto-deleting in #{}'.format(temp.name)) + cogs['Administration'].deleting = True + bot.loop.create_task(cogs['Administration'].delete()) - if u.config['playing'] is not '': - await bot.change_presence(game=d.Game(name=u.config['playing'])) + # if u.config['playing'] is not '': + # await bot.change_presence(game=d.Game(name=u.config['playing'])) + + print('\nS U C C E S S\n') @bot.event