From 493d4bfea093221d50bc55714c2fde59b582000c Mon Sep 17 00:00:00 2001 From: luk3yx Date: Sun, 24 Apr 2022 15:09:34 +1200 Subject: Don't bother trying to send CTCPs --- miniirc_idc.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'miniirc_idc.py') diff --git a/miniirc_idc.py b/miniirc_idc.py index 3e32454..48dc7c2 100644 --- a/miniirc_idc.py +++ b/miniirc_idc.py @@ -47,12 +47,12 @@ class IDC(miniirc.IRC): # Translate IDC keyword arguments into IRC positional ones if idc_cmd == 'PRIVMSG': msg = idc_args['MESSAGE'] - msg_type = idc_args.get('TYPE') command = 'PRIVMSG' + msg_type = idc_args.get('TYPE') if msg_type == 'NOTICE': command = 'NOTICE' - elif msg_type: - msg = f'\x01{idc_args["TYPE"]} {msg}\x01' + elif msg_type == 'ACTION': + command = f'\x01ACTION {msg}\x01' args = [self.current_nick, msg] elif idc_cmd == 'CHANMSG': command = 'PRIVMSG' @@ -117,18 +117,16 @@ class IDC(miniirc.IRC): # have to be blocked. if target == 'NickServ': return - msg_type = None + msg = args[1] - if msg.startswith('\x01'): - msg = msg.rstrip('\x01') - try: - msg_type, msg = msg.split(' ', 1) - except ValueError: - msg_type, msg = msg, '' - if cmd == 'NOTICE': - msg_type += '-REPLY' - elif cmd == 'NOTICE': + msg_type: Optional[str] + if cmd == 'NOTICE': msg_type = 'NOTICE' + elif msg.startswith('\x01ACTION'): + msg = msg[8:].rstrip('\x01') + msg_type = 'ACTION' + else: + msg_type = None self.idc_send('CHANMSG' if target.startswith('#') else 'PRIVMSG', target=target, type=msg_type, message=msg, id=label) -- cgit v1.2.3