[base] Solve async errors

This commit is contained in:
Louis Chauvet 2019-08-16 19:30:24 +02:00
parent 03f7050aaa
commit 0de331915e
Signed by: fomys
GPG Key ID: 1ECA046A9615ABA0

View File

@ -201,7 +201,14 @@ def event(func):
return lambda: None
else:
return func(self, *args, **kwargs)
return wrapper
def async_event(func):
async def wrapper(self, *args, **kwargs):
if self.reloading:
return lambda: None
else:
return func(self, *args, **kwargs)
return wrapper
@ -337,7 +344,7 @@ class LBI(discord.Client):
for module in self.modules.values():
module["initialized_class"].dispatch(event, *args, **kwargs)
@event
@async_event
async def on_error(self, event_method, *args, **kwargs):
# This event is special because it is call directly
for module in self.modules.values():