mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 21:02:38 +00:00
Change cogs dict to be global for a new on_ready to access
This commit is contained in:
parent
661194ea5d
commit
0747b51db7
2 changed files with 6 additions and 6 deletions
11
src/run.py
11
src/run.py
|
@ -74,10 +74,9 @@ async def on_ready():
|
||||||
|
|
||||||
from cogs import booru, info, management, owner, tools
|
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)):
|
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)
|
bot.add_cog(cog)
|
||||||
cogs[type(cog).__name__] = cog
|
u.cogs[type(cog).__name__] = cog
|
||||||
print(f'COG : {type(cog).__name__}')
|
print(f'COG : {type(cog).__name__}')
|
||||||
|
|
||||||
# bot.loop.create_task(u.clear(booru.temp_urls, 30*60))
|
# bot.loop.create_task(u.clear(booru.temp_urls, 30*60))
|
||||||
|
@ -104,15 +103,15 @@ async def on_ready():
|
||||||
|
|
||||||
checks.ready = True
|
checks.ready = True
|
||||||
else:
|
else:
|
||||||
print('\n- - - -\nI N F O : reconnected, reinitializing\n- - - -')
|
print('\n- - - -\nI N F O : reconnected, reinitializing tasks\n- - - -')
|
||||||
|
|
||||||
if u.tasks['auto_del']:
|
if u.tasks['auto_del']:
|
||||||
for channel in u.tasks['auto_del']:
|
for channel in u.tasks['auto_del']:
|
||||||
temp = bot.get_channel(channel)
|
temp = bot.get_channel(channel)
|
||||||
bot.loop.create_task(cogs['Administration'].queue_for_deletion(temp))
|
bot.loop.create_task(u.cogs['Administration'].queue_for_deletion(temp))
|
||||||
print('RESTARTED : auto-deleting in #{}'.format(temp.name))
|
print('RESTARTED : auto-deleting in #{}'.format(temp.name))
|
||||||
cogs['Administration'].deleting = True
|
u.cogs['Administration'].deleting = True
|
||||||
bot.loop.create_task(cogs['Administration'].delete())
|
bot.loop.create_task(u.cogs['Administration'].delete())
|
||||||
|
|
||||||
# if u.config['playing'] is not '':
|
# if u.config['playing'] is not '':
|
||||||
# await bot.change_presence(game=d.Game(name=u.config['playing']))
|
# await bot.change_presence(game=d.Game(name=u.config['playing']))
|
||||||
|
|
|
@ -86,6 +86,7 @@ tasks = setdefault('cogs/tasks.pkl', default={'auto_del': [], 'auto_hrt': [], 'a
|
||||||
temp = setdefault('temp/temp.pkl', default={'startup': ()})
|
temp = setdefault('temp/temp.pkl', default={'startup': ()})
|
||||||
secrets = setdefault('secrets.json', default={'client_secrets': {'client_id': '', 'client_secret': ''}}, json=True)
|
secrets = setdefault('secrets.json', default={'client_secrets': {'client_id': '', 'client_secret': ''}}, json=True)
|
||||||
|
|
||||||
|
cogs = {}
|
||||||
RATE_LIMIT = 2.2
|
RATE_LIMIT = 2.2
|
||||||
color = d.Color(0x1A1A1A)
|
color = d.Color(0x1A1A1A)
|
||||||
session = aiohttp.ClientSession()
|
session = aiohttp.ClientSession()
|
||||||
|
|
Loading…
Reference in a new issue