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 debug
|
||||||
import ircdb
|
import ircdb
|
||||||
import ircmsgs
|
import ircmsgs
|
||||||
|
import plugins
|
||||||
import privmsgs
|
import privmsgs
|
||||||
import ircutils
|
import ircutils
|
||||||
import callbacks
|
import callbacks
|
||||||
@ -58,7 +59,10 @@ def configure(onStart, afterConnect, advanced):
|
|||||||
# Enforcer: Enforces capabilities on JOIN, MODE, KICK, etc.
|
# Enforcer: Enforces capabilities on JOIN, MODE, KICK, etc.
|
||||||
###
|
###
|
||||||
_chanCap = ircdb.makeChannelCapability
|
_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
|
started = False
|
||||||
def start(self, irc, msg, args):
|
def start(self, irc, msg, args):
|
||||||
"""[<CHANSERV> <revenge>]
|
"""[<CHANSERV> <revenge>]
|
||||||
@ -95,10 +99,13 @@ class Enforcer(callbacks.Privmsg):
|
|||||||
irc.queueMsg(ircmsgs.ban(channel, ircutils.banmask(msg.prefix)))
|
irc.queueMsg(ircmsgs.ban(channel, ircutils.banmask(msg.prefix)))
|
||||||
irc.queueMsg(ircmsgs.kick(channel, msg.nick))
|
irc.queueMsg(ircmsgs.kick(channel, msg.nick))
|
||||||
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'op')):
|
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'op')):
|
||||||
|
if self.toggles.get('auto-op', channel):
|
||||||
irc.queueMsg(ircmsgs.op(channel, msg.nick))
|
irc.queueMsg(ircmsgs.op(channel, msg.nick))
|
||||||
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'halfop')):
|
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'halfop')):
|
||||||
|
if self.toggles.get('auto-halfop', channel):
|
||||||
irc.queueMsg(ircmsgs.halfop(channel, msg.nick))
|
irc.queueMsg(ircmsgs.halfop(channel, msg.nick))
|
||||||
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'voice')):
|
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'voice')):
|
||||||
|
if self.toggles.get('auto-voice', channel):
|
||||||
irc.queueMsg(ircmsgs.voice(channel, msg.nick))
|
irc.queueMsg(ircmsgs.voice(channel, msg.nick))
|
||||||
|
|
||||||
def doTopic(self, irc, msg):
|
def doTopic(self, irc, msg):
|
||||||
|
Loading…
Reference in New Issue
Block a user