mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Fixed bug where he'd reply that a command didn't match when regexp methods matched.
This commit is contained in:
parent
ec1e60bf00
commit
ab88ee0d25
@ -59,8 +59,14 @@ class MiscCommands(callbacks.Privmsg):
|
||||
if conf.replyWhenNotCommand and msg.nick != irc.nick:
|
||||
s = callbacks.addressed(irc.nick, msg)
|
||||
if s:
|
||||
tokens = callbacks.tokenize(s)
|
||||
for cb in irc.callbacks:
|
||||
if isinstance(cb, callbacks.PrivmsgRegexp) or \
|
||||
isinstance(cb, callbacks.PrivmsgCommandAndRegexp):
|
||||
for (r, _) in cb.res:
|
||||
if r.search(msg.args[1]):
|
||||
return
|
||||
notCommands = []
|
||||
tokens = callbacks.tokenize(s)
|
||||
for command in callbacks.getCommands(tokens):
|
||||
if not callbacks.findCallbackForCommand(irc, command):
|
||||
notCommands.append(repr(command))
|
||||
|
@ -32,7 +32,7 @@
|
||||
from test import *
|
||||
|
||||
class MiscCommandsTestCase(PluginTestCase, PluginDocumentation):
|
||||
plugins = ('MiscCommands', 'Utilities')
|
||||
plugins = ('MiscCommands', 'Utilities', 'ChannelDB')
|
||||
def testReplyWhenNotCommand(self):
|
||||
conf.replyWhenNotCommand = True
|
||||
self.prefix = 'somethingElse!user@host.domain.tld'
|
||||
@ -42,6 +42,12 @@ class MiscCommandsTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.assertRegexp('baz [foo] [bar]', 'not.*commands')
|
||||
conf.replyWhenNotCommand = False
|
||||
|
||||
def testNotReplyWhenRegexpsMatch(self):
|
||||
conf.replyWhenNotCommand = True
|
||||
self.prefix = 'somethingElse!user@host.domain.tld'
|
||||
self.assertNoResponse('@coffee++', 2)
|
||||
conf.replyWhenNotCommand = False
|
||||
|
||||
def testHelp(self):
|
||||
self.assertNotError('help list')
|
||||
self.assertNotError('help help')
|
||||
|
Loading…
Reference in New Issue
Block a user