def handler(packet, **kwargs): if not issubclass(type(packet), _Packet): raise TypeError( 'All handlers can only listen for either XMLPacket or XTPacket.') listener_class = _XTListener if isinstance(packet, XTPacket) else _XMLListener return _listener(listener_class, packet, **kwargs)
def group(name=None, **kwargs): return _listener(_CommandGroup, name, string_delimiter=['"', "'"], string_separator=' ', **kwargs)
def group(name=None, **kwargs): return _listener(_CommandGroup, name, string_delimiter=config.commands['StringDelimiters'], string_separator=' ', **kwargs)
dummy_event] for listener in dummy_event_listeners: await listener(*args, **kwargs) def handler(packet, **kwargs): if not issubclass(type(packet), _Packet): raise TypeError( 'All handlers can only listen for either XMLPacket or XTPacket.') listener_class = _XTListener if isinstance(packet, XTPacket) else _XMLListener return _listener(listener_class, packet, **kwargs) boot = _listener(_DummyListener, DummyEventPacket('boot')) connected = _listener(_DummyListener, DummyEventPacket('connected')) disconnected = _listener(_DummyListener, DummyEventPacket('disconnected')) def cooldown(per=1.0, rate=1, bucket_type=BucketType.Default, callback=None): def decorator(handler_function): handler_function.__cooldown = _CooldownMapping( callback, _Cooldown(per, rate, bucket_type)) return handler_function return decorator def check(predicate): def decorator(handler_function):