mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Fixed bug in MiscCommands.replyWhenNotCommand that it would respond to unhandled CTCP requests.
This commit is contained in:
parent
9ca4050b9b
commit
0f30bbc359
@ -53,12 +53,16 @@ def replyWhenNotCommand(irc, msg, notCommands):
|
|||||||
apparent command actually isn't a command. Replace it with something that
|
apparent command actually isn't a command. Replace it with something that
|
||||||
suits your purposes more, if you want.
|
suits your purposes more, if you want.
|
||||||
"""
|
"""
|
||||||
|
def isCtcpCommand(s):
|
||||||
|
return s.startswith('\x01')
|
||||||
|
if not any(isCtcpCommand, notCommands):
|
||||||
|
notCommands = map(repr, notCommands)
|
||||||
if len(notCommands) == 1:
|
if len(notCommands) == 1:
|
||||||
s = '%s is not a command.' % notCommands[0]
|
s = '%s is not a command.' % notCommands[0]
|
||||||
else:
|
else:
|
||||||
s = '%s are not commands' % \
|
s = '%s are not commands' % \
|
||||||
utils.commaAndify(notCommands)
|
utils.commaAndify(notCommands)
|
||||||
irc.queueMsg(callbacks.reply(msg, s))
|
irc.reply(msg, s)
|
||||||
|
|
||||||
|
|
||||||
class MiscCommands(callbacks.Privmsg):
|
class MiscCommands(callbacks.Privmsg):
|
||||||
@ -86,7 +90,7 @@ class MiscCommands(callbacks.Privmsg):
|
|||||||
command = callbacks.canonicalName(command)
|
command = callbacks.canonicalName(command)
|
||||||
cbs = callbacks.findCallbackForCommand(irc, command)
|
cbs = callbacks.findCallbackForCommand(irc, command)
|
||||||
if not cbs:
|
if not cbs:
|
||||||
notCommands.append(repr(command))
|
notCommands.append(command)
|
||||||
elif len(cbs) > 1:
|
elif len(cbs) > 1:
|
||||||
ambiguousCommands[command] = [cb.name() for cb in cbs]
|
ambiguousCommands[command] = [cb.name() for cb in cbs]
|
||||||
if notCommands:
|
if notCommands:
|
||||||
|
Loading…
Reference in New Issue
Block a user