callable fix

This commit is contained in:
Maxim Khomutov 2023-07-05 21:52:55 +03:00
parent 4d8cd4e559
commit 04a5159707

View File

@ -19,9 +19,10 @@ class EventsSystem:
def register_event(self, event_name, event_func):
self.log.debug(f"register_event({event_name}, {event_func}):")
if callable(event_func):
if not callable(event_func):
self.log.error(f"Cannot add event '{event_name}'. "
f"Use `BEAMP.add_event({event_name}', function)` instead. Skipping it...")
return
if event_name not in self.__events:
self.__events.update({str(event_name): [event_func]})
else: