mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
Irc.callHooks: allow handlers to specify which hook to call via a special 'parse_as' key
For special cases such as "/join 0", where the PART handler has to be called instead of JOIN.
This commit is contained in:
parent
6efb59b8b7
commit
badbcf0507
4
main.py
4
main.py
@ -143,6 +143,10 @@ class Irc():
|
||||
parsed_args['ts'] = int(time.time())
|
||||
hook_cmd = command
|
||||
hook_map = self.proto.hook_map
|
||||
# Handlers can return a 'parse_as' key to send their payload to a
|
||||
# different hook. An example of this is "/join 0" being interpreted
|
||||
# as leaving all channels (PART).
|
||||
command = parsed_args.get('parse_as') or command
|
||||
if command in hook_map:
|
||||
hook_cmd = hook_map[command]
|
||||
log.debug('Parsed args %r received from %s handler (calling hook %s)', parsed_args, command, hook_cmd)
|
||||
|
Loading…
Reference in New Issue
Block a user