Skip to content

Commit

Permalink
Fix waiting for raw events again
Browse files Browse the repository at this point in the history
  • Loading branch information
nexy7574 committed Dec 24, 2024
1 parent ca18bb8 commit c0092c0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/niobot/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ def add_event_listener(self, event_type: typing.Union[str, nio.Event, Type[nio.E
@functools.wraps(func)
async def event_safety_wrapper(*args):
# This is necessary to stop callbacks crashing the process
self.log.debug("Raw event received: %r", args)
try:
return await func(*args)
except Exception as e:
Expand All @@ -724,6 +725,7 @@ async def event_safety_wrapper(*args):
func = event_safety_wrapper
self._raw_events.setdefault(event_type, [])
self._raw_events[event_type].append(func)
self.add_event_callback(func, event_type)
self.log.debug("Added raw event listener %r for %r", func, event_type)
return func
else:
Expand Down

0 comments on commit c0092c0

Please sign in to comment.