mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Added conf.replyWhenNotAddressed for RFE #859183.
This commit is contained in:
parent
eca71949b4
commit
bbafb4294e
@ -92,6 +92,8 @@ def addressed(nick, msg):
|
||||
return ''
|
||||
elif msg.args[1] and msg.args[1][0] in conf.prefixChars:
|
||||
return msg.args[1][1:].strip()
|
||||
elif conf.replyWhenNotAddressed:
|
||||
return msg.args[1]
|
||||
else:
|
||||
return ''
|
||||
|
||||
|
@ -140,6 +140,14 @@ replyWithNickPrefix = True
|
||||
###
|
||||
replyWhenAddressedByNick = True
|
||||
|
||||
###
|
||||
# replyWhenNotAddressed: True if the bot should reply to messages even if they
|
||||
# don't address it at all. If you have this on, you'll
|
||||
# almost certainly want to make sure replyWhenNotCommand
|
||||
# is turned off.
|
||||
###
|
||||
replyWhenNotAddressed = False
|
||||
|
||||
###
|
||||
# requireRegistration: Oftentimes a plugin will want to record who added or
|
||||
# changed or messed with it last. Supybot's user database
|
||||
|
@ -151,6 +151,18 @@ class FunctionsTestCase(unittest.TestCase):
|
||||
badmsg = ircmsgs.privmsg('#foo', '%s`: foo' % nick)
|
||||
self.failIf(callbacks.addressed(nick, badmsg))
|
||||
|
||||
def testAddressedReplyWhenNotAddressed(self):
|
||||
msg1 = ircmsgs.privmsg('#foo', '@bar')
|
||||
msg2 = ircmsgs.privmsg('#foo', 'bar')
|
||||
self.assertEqual(callbacks.addressed('blah', msg1), 'bar')
|
||||
try:
|
||||
original = conf.replyWhenNotAddressed
|
||||
conf.replyWhenNotAddressed = True
|
||||
self.assertEqual(callbacks.addressed('blah', msg1), 'bar')
|
||||
self.assertEqual(callbacks.addressed('blah', msg2), 'bar')
|
||||
finally:
|
||||
conf.replyWhenNotAddressed = original
|
||||
|
||||
def testReply(self):
|
||||
prefix = 'foo!bar@baz'
|
||||
channelMsg = ircmsgs.privmsg('#foo', 'bar baz', prefix=prefix)
|
||||
|
Loading…
Reference in New Issue
Block a user