From b347f658f8b085045925c20a2bc15928d1e1966d Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 17 Dec 2015 21:14:17 -0800 Subject: [PATCH] Replacer: swap order of comparisons in message filtering Previously, this would error whenever a message without a first argument was present in irc.state.history. ERROR 2015-12-17T21:12:51 Uncaught exception in _callRegexp: Traceback (most recent call last): File "/home/gl/.local/lib/python3.4/site-packages/supybot/callbacks.py", line 1457, in _callRegexp method(irc, msg, m) File "/home/gl/SupyPlugins/Replacer/plugin.py", line 116, in replacer if m.args[0] == msg.args[0] and \ IndexError: tuple index out of range ERROR 2015-12-17T21:12:51 Exception id: 0x2b96f --- Replacer/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Replacer/plugin.py b/Replacer/plugin.py index 2e7ea96..46a409b 100644 --- a/Replacer/plugin.py +++ b/Replacer/plugin.py @@ -113,8 +113,8 @@ class Replacer(callbacks.PluginRegexp): next(iterable) for m in iterable: - if m.args[0] == msg.args[0] and \ - m.command == 'PRIVMSG': + if m.command == 'PRIVMSG' and \ + m.args[0] == msg.args[0]: target = regex.group('nick') if not ircutils.isNick(str(target), strictRfc=True): return