mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +01:00
Brought BadWords up to the times.
This commit is contained in:
parent
13c10c899e
commit
4be5758099
@ -80,8 +80,9 @@ nastyChars = '!@#$' * 256
|
|||||||
def subber(m):
|
def subber(m):
|
||||||
return nastyChars[:len(m.group(1))]
|
return nastyChars[:len(m.group(1))]
|
||||||
|
|
||||||
class BadWords(callbacks.Privmsg):
|
class BadWords(privmsgs.CapabilityCheckingPrivmsg):
|
||||||
priority = 1
|
priority = 1
|
||||||
|
capability = 'admin'
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
self.badwords = sets.Set()
|
self.badwords = sets.Set()
|
||||||
@ -102,63 +103,45 @@ class BadWords(callbacks.Privmsg):
|
|||||||
|
|
||||||
Adds <word> to the list of words the bot isn't to say.
|
Adds <word> to the list of words the bot isn't to say.
|
||||||
"""
|
"""
|
||||||
if ircdb.checkCapability(msg.prefix, 'admin'):
|
word = privmsgs.getArgs(args)
|
||||||
word = privmsgs.getArgs(args)
|
self.badwords.add(word)
|
||||||
self.badwords.add(word)
|
self.makeRegexp()
|
||||||
self.makeRegexp()
|
irc.reply(msg, conf.replySuccess)
|
||||||
irc.reply(msg, conf.replySuccess)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
irc.error(msg, conf.replyNoCapability % 'admin')
|
|
||||||
return
|
|
||||||
|
|
||||||
def addbadwords(self, irc, msg, args):
|
def addbadwords(self, irc, msg, args):
|
||||||
"""<word> [<word> ...]
|
"""<word> [<word> ...]
|
||||||
|
|
||||||
Adds all <word>s to the list of words the bot isn't to say.
|
Adds all <word>s to the list of words the bot isn't to say.
|
||||||
"""
|
"""
|
||||||
if ircdb.checkCapability(msg.prefix, 'admin'):
|
words = privmsgs.getArgs(args).split()
|
||||||
words = privmsgs.getArgs(args).split()
|
for word in words:
|
||||||
for word in words:
|
self.badwords.add(word)
|
||||||
self.badwords.add(word)
|
self.makeRegexp()
|
||||||
self.makeRegexp()
|
irc.reply(msg, conf.replySuccess)
|
||||||
irc.reply(msg, conf.replySuccess)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
irc.error(msg, conf.replyNoCapability % 'admin')
|
|
||||||
return
|
|
||||||
|
|
||||||
def removebadword(self, irc, msg, args):
|
def removebadword(self, irc, msg, args):
|
||||||
"""<word>
|
"""<word>
|
||||||
|
|
||||||
Removes <word> from the list of words the bot isn't to say.
|
Removes <word> from the list of words the bot isn't to say.
|
||||||
"""
|
"""
|
||||||
if ircdb.checkCapability(msg.prefix, 'admin'):
|
word = privmsgs.getArgs(args)
|
||||||
word = privmsgs.getArgs(args)
|
self.badwords.remove(word)
|
||||||
self.badwords.remove(word)
|
self.makeRegexp()
|
||||||
self.makeRegexp()
|
irc.reply(msg, conf.replySuccess)
|
||||||
irc.reply(msg, conf.replySuccess)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
irc.error(msg, conf.replyNoCapability % 'admin')
|
|
||||||
return
|
|
||||||
|
|
||||||
def removebadwords(self, irc, msg, args):
|
def removebadwords(self, irc, msg, args):
|
||||||
"""<word> [<word> ...]
|
"""<word> [<word> ...]
|
||||||
|
|
||||||
Removes all <word>s from the list of words the bot isn't to say.
|
Removes all <word>s from the list of words the bot isn't to say.
|
||||||
"""
|
"""
|
||||||
if ircdb.checkCapability(msg.prefix, 'admin'):
|
words = privmsgs.getArgs(args).split()
|
||||||
words = privmsgs.getArgs(args).split()
|
for word in words:
|
||||||
for word in words:
|
self.badwords.remove(word)
|
||||||
self.badwords.remove(word)
|
self.makeRegexp()
|
||||||
self.makeRegexp()
|
irc.reply(msg, conf.replySuccess)
|
||||||
irc.reply(msg, conf.replySuccess)
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
irc.error(msg, conf.replyNoCapability % 'admin')
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
Class = BadWords
|
Class = BadWords
|
||||||
|
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user