aboutsummaryrefslogtreecommitdiff
path: root/modules/line_handler
diff options
context:
space:
mode:
authorGravatar jesopo2019-06-03 14:22:19 +0100
committerGravatar jesopo2019-06-03 14:22:19 +0100
commite6d2208cc41b7c5206a12325adfb887d29962a26 (patch)
treedadf4934e972cb2951699ea60cb4e4784b7a1303 /modules/line_handler
parentAlso track msgids from CTCP in ircv3_msgid.py (diff)
signature
Differentiate between send and received ctcp events
Diffstat (limited to 'modules/line_handler')
-rw-r--r--modules/line_handler/message.py14
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)