mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +01:00
Fixed bug with multiple criteria in the last command.
This commit is contained in:
parent
b1a40f1cfd
commit
ea74e4e898
@ -636,14 +636,14 @@ class FunCommands(callbacks.Privmsg):
|
|||||||
for (option, arg) in optlist:
|
for (option, arg) in optlist:
|
||||||
option = option.strip('-')
|
option = option.strip('-')
|
||||||
if option == 'from':
|
if option == 'from':
|
||||||
predicates.append(lambda m: m.nick == arg)
|
predicates.append(lambda m, arg=arg: m.nick == arg)
|
||||||
elif option == 'in' or option == 'to':
|
elif option == 'in' or option == 'to':
|
||||||
if not ircutils.isChannel(argument):
|
if not ircutils.isChannel(arg):
|
||||||
irc.error(msg, 'Argument to --%s must be a channel.' % arg)
|
irc.error(msg, 'Argument to --%s must be a channel.' % arg)
|
||||||
return
|
return
|
||||||
predicates.append(lambda m: m.args[0] == arg)
|
predicates.append(lambda m, arg=arg: m.args[0] == arg)
|
||||||
elif option == 'with':
|
elif option == 'with':
|
||||||
predicates.append(lambda m: arg in m.args[1])
|
predicates.append(lambda m, arg=arg: arg in m.args[1])
|
||||||
elif option == 'regexp':
|
elif option == 'regexp':
|
||||||
try:
|
try:
|
||||||
r = utils.perlReToPythonRe(arg)
|
r = utils.perlReToPythonRe(arg)
|
||||||
@ -656,9 +656,12 @@ class FunCommands(callbacks.Privmsg):
|
|||||||
if first:
|
if first:
|
||||||
first = False
|
first = False
|
||||||
continue
|
continue
|
||||||
if m.command != 'PRIVMSG':
|
if not m.prefix or m.command != 'PRIVMSG':
|
||||||
continue
|
continue
|
||||||
if all(bool, [f(m) for f in predicates]):
|
for predicate in predicates:
|
||||||
|
if not predicate(m):
|
||||||
|
break
|
||||||
|
else:
|
||||||
if undecorated:
|
if undecorated:
|
||||||
irc.reply(msg, m.args[1])
|
irc.reply(msg, m.args[1])
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user