mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +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:
|
if conf.replyWhenNotCommand and msg.nick != irc.nick:
|
||||||
s = callbacks.addressed(irc.nick, msg)
|
s = callbacks.addressed(irc.nick, msg)
|
||||||
if s:
|
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 = []
|
notCommands = []
|
||||||
|
tokens = callbacks.tokenize(s)
|
||||||
for command in callbacks.getCommands(tokens):
|
for command in callbacks.getCommands(tokens):
|
||||||
if not callbacks.findCallbackForCommand(irc, command):
|
if not callbacks.findCallbackForCommand(irc, command):
|
||||||
notCommands.append(repr(command))
|
notCommands.append(repr(command))
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
class MiscCommandsTestCase(PluginTestCase, PluginDocumentation):
|
class MiscCommandsTestCase(PluginTestCase, PluginDocumentation):
|
||||||
plugins = ('MiscCommands', 'Utilities')
|
plugins = ('MiscCommands', 'Utilities', 'ChannelDB')
|
||||||
def testReplyWhenNotCommand(self):
|
def testReplyWhenNotCommand(self):
|
||||||
conf.replyWhenNotCommand = True
|
conf.replyWhenNotCommand = True
|
||||||
self.prefix = 'somethingElse!user@host.domain.tld'
|
self.prefix = 'somethingElse!user@host.domain.tld'
|
||||||
@ -41,6 +41,12 @@ class MiscCommandsTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
self.assertRegexp('foo | bar | baz', 'not.*commands')
|
self.assertRegexp('foo | bar | baz', 'not.*commands')
|
||||||
self.assertRegexp('baz [foo] [bar]', 'not.*commands')
|
self.assertRegexp('baz [foo] [bar]', 'not.*commands')
|
||||||
conf.replyWhenNotCommand = False
|
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):
|
def testHelp(self):
|
||||||
self.assertNotError('help list')
|
self.assertNotError('help list')
|
||||||
|
Loading…
Reference in New Issue
Block a user