diff options
| author | 2019-06-03 14:22:19 +0100 | |
|---|---|---|
| committer | 2019-06-03 14:22:19 +0100 | |
| commit | e6d2208cc41b7c5206a12325adfb887d29962a26 (patch) | |
| tree | dadf4934e972cb2951699ea60cb4e4784b7a1303 | |
| parent | Also track msgids from CTCP in ircv3_msgid.py (diff) | |
| signature | ||
Differentiate between send and received ctcp events
| -rw-r--r-- | modules/line_handler/message.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/line_handler/message.py b/modules/line_handler/message.py index fc5251b4..9157af66 100644 --- a/modules/line_handler/message.py +++ b/modules/line_handler/message.py @@ -18,6 +18,8 @@ def message(events, event): if from_self == None: return + direction = "send" if from_self else "received" + target_str = event["args"][0] message = None @@ -69,13 +71,14 @@ def message(events, event): if not ctcp_message.command == "ACTION" or not event["command" ] == "PRIVMSG": if event["command"] == "PRIVMSG": - direction = "request" + ctcp_action = "request" else: - direction = "response" - events.on("received.ctcp").on(direction).call( + ctcp_action = "response" + events.on(direction).on("ctcp").on(ctcp_action).call( message=ctcp_message.message, **kwargs) - events.on("received.ctcp").on(direction).on(ctcp_message.command - ).call(message=ctcp_message.message, **kwargs) + events.on(direction).on("ctcp").on(ctcp_action).on( + ctcp_message.command).call(message=ctcp_message.message, + **kwargs) return else: message = ctcp_message.message @@ -90,7 +93,6 @@ def message(events, event): if event["command"] == "PRIVMSG": event_type = "message" - direction = "send" if from_self else "received" context = "channel" if is_channel else "private" hook = events.on(direction).on(event_type).on(context) |
