From 4be5758099c31baae4b7638d8dceb4e8ec341a6b Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 22 Oct 2003 05:35:52 +0000 Subject: [PATCH] Brought BadWords up to the times. --- plugins/BadWords.py | 63 +++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 40 deletions(-) diff --git a/plugins/BadWords.py b/plugins/BadWords.py index 53924e415..4b924886f 100644 --- a/plugins/BadWords.py +++ b/plugins/BadWords.py @@ -80,8 +80,9 @@ nastyChars = '!@#$' * 256 def subber(m): return nastyChars[:len(m.group(1))] -class BadWords(callbacks.Privmsg): +class BadWords(privmsgs.CapabilityCheckingPrivmsg): priority = 1 + capability = 'admin' def __init__(self): callbacks.Privmsg.__init__(self) self.badwords = sets.Set() @@ -102,63 +103,45 @@ class BadWords(callbacks.Privmsg): Adds to the list of words the bot isn't to say. """ - if ircdb.checkCapability(msg.prefix, 'admin'): - word = privmsgs.getArgs(args) - self.badwords.add(word) - self.makeRegexp() - irc.reply(msg, conf.replySuccess) - return - else: - irc.error(msg, conf.replyNoCapability % 'admin') - return - + word = privmsgs.getArgs(args) + self.badwords.add(word) + self.makeRegexp() + irc.reply(msg, conf.replySuccess) + def addbadwords(self, irc, msg, args): """ [ ...] Adds all s to the list of words the bot isn't to say. """ - if ircdb.checkCapability(msg.prefix, 'admin'): - words = privmsgs.getArgs(args).split() - for word in words: - self.badwords.add(word) - self.makeRegexp() - irc.reply(msg, conf.replySuccess) - return - else: - irc.error(msg, conf.replyNoCapability % 'admin') - return + words = privmsgs.getArgs(args).split() + for word in words: + self.badwords.add(word) + self.makeRegexp() + irc.reply(msg, conf.replySuccess) def removebadword(self, irc, msg, args): """ Removes from the list of words the bot isn't to say. """ - if ircdb.checkCapability(msg.prefix, 'admin'): - word = privmsgs.getArgs(args) - self.badwords.remove(word) - self.makeRegexp() - irc.reply(msg, conf.replySuccess) - return - else: - irc.error(msg, conf.replyNoCapability % 'admin') - return + word = privmsgs.getArgs(args) + self.badwords.remove(word) + self.makeRegexp() + irc.reply(msg, conf.replySuccess) def removebadwords(self, irc, msg, args): """ [ ...] Removes all s from the list of words the bot isn't to say. """ - if ircdb.checkCapability(msg.prefix, 'admin'): - words = privmsgs.getArgs(args).split() - for word in words: - self.badwords.remove(word) - self.makeRegexp() - irc.reply(msg, conf.replySuccess) - return - else: - irc.error(msg, conf.replyNoCapability % 'admin') - return + words = privmsgs.getArgs(args).split() + for word in words: + self.badwords.remove(word) + self.makeRegexp() + irc.reply(msg, conf.replySuccess) Class = BadWords + + # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: