summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluk3yx <luk3yx@users.noreply.github.com>2022-05-07 19:48:07 +1200
committerluk3yx <luk3yx@users.noreply.github.com>2022-05-07 19:48:07 +1200
commit8de7b30333ae2a5bd419306a791e52b2d53b17fc (patch)
tree78709730e8ff830d27b3030246af08a2c2decfc9
parent5a30a983960db9c39caccadfafdf7822176ba7bf (diff)
downloadminiirc_idc-8de7b30333ae2a5bd419306a791e52b2d53b17fc.tar.gz
miniirc_idc-8de7b30333ae2a5bd419306a791e52b2d53b17fc.zip
Parse NOTICE and ACTION
-rw-r--r--miniirc_idc.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/miniirc_idc.py b/miniirc_idc.py
index 726d2e2..d8a3d46 100644
--- a/miniirc_idc.py
+++ b/miniirc_idc.py
@@ -109,14 +109,8 @@ class IDC(miniirc.IRC):
# Translate IDC keyword arguments into IRC positional ones
tags = {}
if idc_cmd == 'PRIVMSG':
- msg = idc_args['MESSAGE']
command = 'PRIVMSG'
- msg_type = idc_args.get('TYPE')
- if msg_type == 'NOTICE':
- command = 'NOTICE'
- elif msg_type == 'ACTION':
- msg = f'\x01ACTION {msg}\x01'
- args = [self.current_nick, msg]
+ args = [self.current_nick, idc_args['MESSAGE']]
elif idc_cmd == 'CHANMSG':
command = 'PRIVMSG'
args = ['#' + idc_args['TARGET'], idc_args['MESSAGE']]
@@ -147,10 +141,18 @@ class IDC(miniirc.IRC):
else:
hostmask = ('', '', '')
- # If echo-message wasn't requested then don't send self messages
- if (command == 'PRIVMSG' and hostmask[0] == self.current_nick and
- 'echo-message' not in self.active_caps):
- return None
+ if command == 'PRIVMSG':
+ # If echo-message wasn't requested then don't send self messages
+ if (hostmask[0] == self.current_nick and
+ 'echo-message' not in self.active_caps):
+ return None
+
+ # Parse the message type
+ msg_type = idc_args.get('TYPE', '').upper()
+ if msg_type == 'NOTICE':
+ command = 'NOTICE'
+ elif msg_type == 'ACTION':
+ args[1] = f'\x01ACTION {args[1]}\x01'
if 'TS' in idc_args:
dt = datetime.datetime.utcfromtimestamp(float(idc_args['TS']))