Make @clearban report errors in batch

This commit is contained in:
tsimpson 2014-04-15 07:14:22 +01:00
parent c45caef11c
commit 7dc11621d8

View File

@ -1593,15 +1593,17 @@ class Bantracker(callbacks.Plugin):
comment = "Cleared by " + msg.nick
removed = []
unknown = []
existing = []
for id in splitID(ids):
try:
mask, channel, removal = self._getBan(id)
except ValueError:
irc.reply("I don't know any ban with id %s" % id)
unknown.append(id)
continue
if removal:
irc.reply("The ban with id %s is already marked as removed" % id)
existing.append(id)
continue
addComment(id, msg.nick, comment)
@ -1613,6 +1615,12 @@ class Bantracker(callbacks.Plugin):
else:
irc.reply("No bans removed")
if unknown:
irc.reply("The following ban ID(s) are unknown: %s" % utils.str.commaAndify(map(str, unknown)))
if existing:
irc.reply("The following ban ID(s) are already marked as removed: %s" % utils.str.commaAndify(map(str, existing)))
clearban = wrap(clearban, ['something', optional('text')])
def _getBan(self, id):