banremove should only work with bans or quiets.
This commit is contained in:
@ -1469,8 +1469,14 @@ class Bantracker(callbacks.Plugin):
|
||||
irc.reply("Ban '%s' isn't active in %s." % (mask, channel))
|
||||
return
|
||||
|
||||
if ban.type not in ('ban', 'quiet'):
|
||||
irc.reply("Id %s is a %s, only bans or quiets can be autoremoved." \
|
||||
% (id, ban.type))
|
||||
return
|
||||
|
||||
self.managedBans.add(BanRemoval(ban, seconds))
|
||||
irc.replySuccess()
|
||||
|
||||
banremove = wrap(banremove, ['id', 'text'])
|
||||
|
||||
def banlink(self, irc, msg, args, id, highlight):
|
||||
|
@ -371,6 +371,11 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
||||
msg = self.irc.takeMsg() # unban msg
|
||||
self.assertEqual(str(msg).strip(), "MODE #test -q :asd!*@*")
|
||||
|
||||
def testBanremoveBadType(self):
|
||||
self.feedBan('nick', mode='k')
|
||||
self.assertResponse('banremove 1 0',
|
||||
"Id 1 is a removal, only bans or quiets can be autoremoved.")
|
||||
|
||||
def testBanremoveBadId(self):
|
||||
self.assertResponse('banremove 1 0', "I don't know any ban with that id.")
|
||||
|
||||
|
Reference in New Issue
Block a user