1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 22:27:28 +00:00

Hopefully implemented correct version of on_ready catching

This commit is contained in:
Myned 2017-12-08 21:47:49 -05:00
parent d41c7d0f06
commit f7728b2d1e
2 changed files with 6 additions and 1 deletions

View file

@ -11,6 +11,7 @@ from discord.ext.commands import errors as errext
from utils import utils as u from utils import utils as u
owner_id = u.config['owner_id'] owner_id = u.config['owner_id']
ready = False
def is_owner(): def is_owner():

View file

@ -69,7 +69,7 @@ async def test(ctx):
@bot.event @bot.event
async def on_ready(): async def on_ready():
if not bot.is_ready(): if not checks.ready:
from cogs import booru, info, management, owner, tools 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)): for cog in (tools.Utils(bot), owner.Bot(bot), owner.Tools(bot), management.Administration(bot), info.Info(bot), booru.MsG(bot)):
@ -98,6 +98,8 @@ async def on_ready():
u.temp['startup'] = () u.temp['startup'] = ()
u.dump(u.temp, 'temp/temp.pkl') u.dump(u.temp, 'temp/temp.pkl')
checks.ready = True
@bot.event @bot.event
async def on_message(message): async def on_message(message):
@ -111,6 +113,8 @@ async def on_message(message):
@bot.event @bot.event
async def on_error(error, *args, **kwargs): async def on_error(error, *args, **kwargs):
print(bot.is_closed())
print(bot.is_ready())
print('\n! ! ! ! !\nE R R O R : {}\n! ! ! ! !\n'.format(error), file=sys.stderr) print('\n! ! ! ! !\nE R R O R : {}\n! ! ! ! !\n'.format(error), file=sys.stderr)
tb.print_exc() tb.print_exc()
await bot.get_user(u.config['owner_id']).send('**ERROR** \N{WARNING SIGN}\n```\n{}```'.format(error)) await bot.get_user(u.config['owner_id']).send('**ERROR** \N{WARNING SIGN}\n```\n{}```'.format(error))