mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Added toggles for auto-{op,voice,halfop}
This commit is contained in:
parent
372d22e6c8
commit
acd36c80d4
@ -40,6 +40,7 @@ import conf
|
||||
import debug
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import plugins
|
||||
import privmsgs
|
||||
import ircutils
|
||||
import callbacks
|
||||
@ -58,7 +59,10 @@ def configure(onStart, afterConnect, advanced):
|
||||
# Enforcer: Enforces capabilities on JOIN, MODE, KICK, etc.
|
||||
###
|
||||
_chanCap = ircdb.makeChannelCapability
|
||||
class Enforcer(callbacks.Privmsg):
|
||||
class Enforcer(callbacks.Privmsg, plugins.Toggleable):
|
||||
toggles = plugins.ToggleDictionary({'auto-op': False,
|
||||
'auto-voice': False,
|
||||
'auto-halfop': False})
|
||||
started = False
|
||||
def start(self, irc, msg, args):
|
||||
"""[<CHANSERV> <revenge>]
|
||||
@ -95,10 +99,13 @@ class Enforcer(callbacks.Privmsg):
|
||||
irc.queueMsg(ircmsgs.ban(channel, ircutils.banmask(msg.prefix)))
|
||||
irc.queueMsg(ircmsgs.kick(channel, msg.nick))
|
||||
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'op')):
|
||||
if self.toggles.get('auto-op', channel):
|
||||
irc.queueMsg(ircmsgs.op(channel, msg.nick))
|
||||
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'halfop')):
|
||||
if self.toggles.get('auto-halfop', channel):
|
||||
irc.queueMsg(ircmsgs.halfop(channel, msg.nick))
|
||||
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'voice')):
|
||||
if self.toggles.get('auto-voice', channel):
|
||||
irc.queueMsg(ircmsgs.voice(channel, msg.nick))
|
||||
|
||||
def doTopic(self, irc, msg):
|
||||
|
Loading…
Reference in New Issue
Block a user