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
This commit is contained in:
James Lu 2015-12-17 21:14:17 -08:00
parent 688f00ac4d
commit b347f658f8

View File

@ -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