Exemple #1
0
 def decorator(func):
     self.message_view.handlers.append(
         FromFuncHandler(
             func,
             *rules,
             *self.auto_rules,
             *self.get_custom_rules(custom_rules),
             blocking=blocking,
         ))
     return func
Exemple #2
0
 def decorator(func):
     self.message_view.handlers.append(
         FromFuncHandler(
             func,
             *map(convert_shorten_filter, rules),
             *self.auto_rules,
             *self.get_custom_rules(custom_rules),
             blocking=blocking,
         ))
     return func
Exemple #3
0
 def decorator(func):
     for e in event:
         self.raw_event_view.handlers[e] = HandlerBasement(
             dataclass,
             FromFuncHandler(
                 func,
                 *map(convert_shorten_filter, rules),
                 *self.auto_rules,
                 *self.get_custom_rules(custom_rules),
             ),
         )
     return func
Exemple #4
0
 def decorator(func):
     for e in event:
         if isinstance(e, int):
             e = UserEventType(e)
         handler_basement = UserHandlerBasement(
             dataclass,
             FromFuncHandler(
                 func,
                 *rules,
                 *self.auto_rules,
                 *self.get_custom_rules(custom_rules),
                 blocking=blocking,
             ),
         )
         event_handlers = self.raw_event_view.handlers.setdefault(e, [])
         event_handlers.append(handler_basement)
     return func