[ create a new paste ] login | about

Link: http://codepad.org/MxxwWgwI    [ raw code | fork ]

Python, pasted on Sep 5:
import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
from supybot.ircmsgs import voice,devoice,ban,unban
import supybot.ircdb as ircdb

class PublicModeration(callbacks.Plugin):
    """Add the help for "@plugin help PublicModeration" here
    This should describe *how* to use this plugin.
        """

    def __init__(self, irc):
        self.__parent = super(PublicModeration, self)
        self.__parent.__init__(irc)

    def mute_nick(self, irc, msg, args, state, channel, nickname):
        """[#channel] <nickname>

           Mute a nickname in current channel on #channel (mute throught pvt message)
        """
        chan, text = msg.args
        nick = ircutils.nickFromHostmask(msg.prefix)
        if ircutils.isChannel(channel):
                chan = channel
        if irc.state.channels[chan].isOp(nickname):
                self.log.warning('%s tried to mute a op of %s', msg.prefix, chan)
                irc.error('You don\'t mute an op')
                return

        irc.reply('end')     # for debug
        return               # for debug
        hostmask = irc.state.nickToHostmask(nickname)
        (nick, user, host) = ircutils.splitHostmask(hostmask)
        banmask = ircutils.joinHostmask('*', '*', host)

        irc.queueMsg(devoice(chan, nickname))
        irc.queueMsg(ban(chan, banmask))
        self.log.info('%s has muted %s to %s', msg.prefix, nickname, chan)
    mute = wrap(mute_nick, [any(('checkChannelCapability', 'op'), ('checkChannelCapability', 'muter')), ('haveOp', 'i need a op!'), 'nickInChannel'])

Class = PublicModeration


Create a new paste based on this one


Comments: