mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-29 21:54:22 +01:00
Fixed bug where the bot would respond with 'there is no such command' if it wasn't the canonical name.
This commit is contained in:
parent
407da29675
commit
da8ee2a758
@ -68,6 +68,7 @@ class MiscCommands(callbacks.Privmsg):
|
||||
notCommands = []
|
||||
tokens = callbacks.tokenize(s)
|
||||
for command in callbacks.getCommands(tokens):
|
||||
command = callbacks.canonicalName(command)
|
||||
if not callbacks.findCallbackForCommand(irc, command):
|
||||
notCommands.append(repr(command))
|
||||
if notCommands:
|
||||
@ -308,7 +309,6 @@ class MiscCommands(callbacks.Privmsg):
|
||||
message; --regexp requires a regular expression the message must match
|
||||
--fancy determines whether or not to show the nick; the default is not
|
||||
"""
|
||||
|
||||
(optlist, rest) = getopt.getopt(args, '', ['from=', 'in=', 'to=',
|
||||
'with=', 'regexp=',
|
||||
'fancy'])
|
||||
|
@ -579,6 +579,7 @@ class Privmsg(irclib.IrcCallback):
|
||||
try:
|
||||
args = tokenize(s)
|
||||
for command in getCommands(args):
|
||||
command = canonicalName(command)
|
||||
if not findCallbackForCommand(irc, command):
|
||||
return
|
||||
self.Proxy(irc, msg, args)
|
||||
|
@ -36,7 +36,6 @@ class MiscCommandsTestCase(PluginTestCase, PluginDocumentation):
|
||||
def testReplyWhenNotCommand(self):
|
||||
conf.replyWhenNotCommand = True
|
||||
self.prefix = 'somethingElse!user@host.domain.tld'
|
||||
self.irc.nick = 'foobarlkajdf'
|
||||
self.assertRegexp('foo bar baz', 'not.*command')
|
||||
self.assertRegexp('foo | bar | baz', 'not.*commands')
|
||||
self.assertRegexp('baz [foo] [bar]', 'not.*commands')
|
||||
@ -47,6 +46,13 @@ class MiscCommandsTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.prefix = 'somethingElse!user@host.domain.tld'
|
||||
self.assertNoResponse('@coffee++', 2)
|
||||
conf.replyWhenNotCommand = False
|
||||
|
||||
def testNotReplyWhenNotCanonicalName(self):
|
||||
conf.replyWhenNotCommand = True
|
||||
self.prefix = 'somethingElse!user@host.domain.tld'
|
||||
self.assertNotRegexp('STrLeN foobar', 'command')
|
||||
self.assertResponse('StRlEn foobar', '6')
|
||||
conf.repylWhenNotCommand = False
|
||||
|
||||
def testHelp(self):
|
||||
self.assertNotError('help list')
|
||||
|
Loading…
Reference in New Issue
Block a user