[base] Solve async errors
This commit is contained in:
parent
03f7050aaa
commit
0de331915e
9
main.py
9
main.py
@ -201,7 +201,14 @@ def event(func):
|
|||||||
return lambda: None
|
return lambda: None
|
||||||
else:
|
else:
|
||||||
return func(self, *args, **kwargs)
|
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
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
@ -337,7 +344,7 @@ class LBI(discord.Client):
|
|||||||
for module in self.modules.values():
|
for module in self.modules.values():
|
||||||
module["initialized_class"].dispatch(event, *args, **kwargs)
|
module["initialized_class"].dispatch(event, *args, **kwargs)
|
||||||
|
|
||||||
@event
|
@async_event
|
||||||
async def on_error(self, event_method, *args, **kwargs):
|
async def on_error(self, event_method, *args, **kwargs):
|
||||||
# This event is special because it is call directly
|
# This event is special because it is call directly
|
||||||
for module in self.modules.values():
|
for module in self.modules.values():
|
||||||
|
Loading…
Reference in New Issue
Block a user