• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ircmsgs.kick函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中supybot.ircmsgs.kick函数的典型用法代码示例。如果您正苦于以下问题:Python kick函数的具体用法?Python kick怎么用?Python kick使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了kick函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _slot

    def _slot(self, lastItem):
        irc = lastItem.irc
        msg = lastItem.msg
        channel = lastItem.channel
        prefix = lastItem.prefix
        nick = prefix.split('!')[0]
        kind = lastItem.kind

        try:
            ircdb.users.getUser(msg.prefix) # May raise KeyError
            capability = self.registryValue('exempt')
            if capability:
                if ircdb.checkCapability(msg.prefix, capability):
                    return
        except KeyError:
            pass
        punishment = self.registryValue('%s.punishment' % kind, channel)
        reason = _('%s flood detected') % kind
        if punishment == 'kick':
            msg = ircmsgs.kick(channel, nick, reason)
            irc.queueMsg(msg)
        elif punishment == 'ban':
            msg = ircmsgs.ban(channel, prefix)
            irc.queueMsg(msg)
        elif punishment == 'kban':
            msg = ircmsgs.kick(channel, nick, reason)
            irc.queueMsg(msg)
            msg = ircmsgs.ban(channel, prefix)
            irc.queueMsg(msg)
        elif punishment.startswith('mode'):
            msg = ircmsgs.mode(channel, punishment[len('mode'):])
            irc.queueMsg(msg)
        elif punishment.startswith('command '):
            tokens = callbacks.tokenize(punishment[len('command '):])
            self.Proxy(irc, msg, tokens)
开发者ID:v2k,项目名称:Supybot-plugins,代码行数:35,代码来源:plugin.py


示例2: _gegen

    def _gegen(self, irc, msg, target):
        if self._is_voting_enabled(irc, msg, reply=True) and self._check_privileges(irc, msg, reply=True):

            channel = msg.args[0]
            users = irc.state.channels[channel].users
            voting_id = self._calculate_id(target, channel)

            if target == msg.nick or target == irc.nick:
                if self._can_be_kicked(irc, channel, msg.nick):
                    irc.queueMsg(ircmsgs.kick(channel, msg.nick, "Snibeti snab XDD"))
                    self._user_left(irc, msg.nick, channel)
                    return

            if voting_id in self.running_votes:
                voting = self.running_votes[voting_id]
                if voting.add_vote(msg.nick):
                    voting_count = voting.count_votes(users)
                    if voting_count >= voting.threshold:
                        if target in irc.state.channels[channel].ops:
                            irc.queueMsg(ircmsgs.notice(channel, "Einen Versuch war's wert! :--D"))
                            for nick in voting.votes:
                                if self._can_be_kicked(irc, channel, nick):
                                    irc.queueMsg(ircmsgs.kick(channel, nick, "Bis zum nächsten mal!"))
                                    self._user_left(irc, nick, channel)
                        else:
                            self._remove_kebab(irc, channel, target)
                        del self.running_votes[voting_id]
                    else:
                        irc.reply("Stimme gegen %s registriert. Braucht noch %d weitere Stimme(n)." % (
                            target, voting.threshold - voting_count))
                else:
                    voting_count = voting.count_votes(users)
                    irc.reply("Du hast bereits gegen %s gestimmt! Braucht noch %d weitere Stimme(n)." % (
                        target, voting.threshold - voting_count))

            else:
                active_users = self._calculate_active_user(irc, msg)

                if target not in active_users:
                    irc.reply("%s ist inaktiv. Antrag abgelehnt." % target)
                    return

                voting_threshold = self._calculate_voting_threshold(irc, msg, active_users)
                voting = Voting(channel, target, msg.nick, voting_threshold)
                voting.add_vote(msg.nick)

                self.running_votes[voting_id] = voting

                def clean_up():
                    if voting_id in self.running_votes:
                        message = "Abstimmung gegen %s ist erfolglos ausgelaufen." % self.running_votes[voting_id].target
                        irc.queueMsg(ircmsgs.notice(channel, message))
                        del self.running_votes[voting_id]

                schedule.addEvent(clean_up, time.time() + int(self.registryValue("voting_timeout")))

                irc.reply("Abstimmung gegen %s gestartet. Braucht noch %d weitere Stimme(n)." % (
                    target, voting.threshold - 1))
开发者ID:buckket,项目名称:supybot-scherbengericht,代码行数:58,代码来源:plugin.py


示例3: _slot

    def _slot(self, lastItem):
        irc = lastItem.irc
        msg = lastItem.msg
        channel = lastItem.channel
        prefix = lastItem.prefix
        nick = prefix.split('!')[0]
        kind = lastItem.kind

        if not ircutils.isChannel(channel):
                return
        if not self.registryValue('enable', channel):
            return

        try:
            ircdb.users.getUser(msg.prefix) # May raise KeyError
            capability = self.registryValue('exempt')
            if capability:
                if ircdb.checkCapability(msg.prefix,
                        ','.join([channel, capability])):
                    self.log.info('Not punishing %s: they are immune.' %
                            prefix)
                    return
        except KeyError:
            pass
        punishment = self.registryValue('%s.punishment' % kind, channel)
        reason = _('%s flood detected') % kind

        if punishment == 'kick':
            self._eventCatcher(irc, msg, 'kicked', kicked_prefix=prefix)
        if kind == 'kicked':
            reason = _('You exceeded your kick quota.')

        banmaskstyle = conf.supybot.protocols.irc.banmask
        banmask = banmaskstyle.makeBanmask(prefix)
        if punishment == 'kick':
            msg = ircmsgs.kick(channel, nick, reason)
            irc.queueMsg(msg)
        elif punishment == 'ban':
            msg = ircmsgs.ban(channel, banmask)
            irc.queueMsg(msg)
        elif punishment == 'kban':
            msg = ircmsgs.ban(channel, banmask)
            irc.queueMsg(msg)
            msg = ircmsgs.kick(channel, nick, reason)
            irc.queueMsg(msg)
        elif punishment.startswith('mode'):
            msg = ircmsgs.mode(channel, punishment[len('mode'):])
            irc.queueMsg(msg)
        elif punishment.startswith('umode'):
            msg = ircmsgs.mode(channel, (punishment[len('umode'):], nick))
            irc.queueMsg(msg)
        elif punishment.startswith('command '):
            tokens = callbacks.tokenize(punishment[len('command '):])
            self.Proxy(irc, msg, tokens)
开发者ID:TameTimmah,项目名称:Supybot-plugins,代码行数:54,代码来源:plugin.py


示例4: inFilter

 def inFilter(self, irc, msg):
     self.filtering = True
     # We need to check for bad words here rather than in doPrivmsg because
     # messages don't get to doPrivmsg if the user is ignored.
     if msg.command == 'PRIVMSG':
         channel = msg.args[0]
         self.updateRegexp(channel)
         s = ircutils.stripFormatting(msg.args[1])
         if ircutils.isChannel(channel) and self.registryValue('kick', channel):
             if self.words and self.regexp.search(s):
                 c = irc.state.channels[channel]
                 cap = ircdb.makeChannelCapability(channel, 'op')
                 if c.isHalfopPlus(irc.nick):
                     if c.isHalfopPlus(msg.nick) or \
                             ircdb.checkCapability(msg.prefix, cap):
                         self.log.debug("Not kicking %s from %s, because "
                                        "they are halfop+ or can't be "
                                        "kicked.", msg.nick, channel)
                     else:
                         message = self.registryValue('kick.message', channel)
                         irc.queueMsg(ircmsgs.kick(channel, msg.nick, message))
                 else:
                     self.log.warning('Should kick %s from %s, but not opped.',
                                      msg.nick, channel)
     return msg
开发者ID:AssetsIncorporated,项目名称:Limnoria,代码行数:25,代码来源:plugin.py


示例5: roulette

    def roulette(self, irc, msg, args, spin):
        """[spin]

        Fires the revolver.  If the bullet was in the chamber, you're dead.
        Tell me to spin the chambers and I will.
        """
        if spin:
            self._rouletteBullet = random.randrange(0, 6)
            irc.reply(_('*SPIN* Are you feeling lucky?'), prefixNick=False)
            return
        channel = msg.args[0]
        if self._rouletteChamber == self._rouletteBullet:
            self._rouletteBullet = random.randrange(0, 6)
            self._rouletteChamber = random.randrange(0, 6)
            if irc.nick in irc.state.channels[channel].ops or \
                    irc.nick in irc.state.channels[channel].halfops:
                irc.queueMsg(ircmsgs.kick(channel, msg.nick, 'BANG!'))
            else:
                irc.reply(_('*BANG* Hey, who put a blank in here?!'),
                          prefixNick=False)
            irc.reply(_('reloads and spins the chambers.'), action=True)
        else:
            irc.reply(_('*click*'))
            self._rouletteChamber += 1
            self._rouletteChamber %= 6
开发者ID:cnelsonsic,项目名称:Limnoria,代码行数:25,代码来源:plugin.py


示例6: doPrivmsg

 def doPrivmsg(self, irc, msg):
     channel, text = msg.args
     text = text.lower()
     if '#' in channel:
         #print self.regex
         #irc.reply('testing %s against %s' % (text, self._regexString))
         if self.regex.match(text):
             try:
                 hostmask = irc.state.nickToHostmask(msg.nick)
             except KeyError:
                 return
             (nick, user, host) = ircutils.splitHostmask(hostmask)
             user = self._fnUser.sub('*', user)
             banmask = ircutils.joinHostmask('*', user, msg.host)
             if ircutils.hostmaskPatternEqual(banmask, irc.prefix):
                 return
             irc.queueMsg(ban(channel, banmask, 'For swearing. 5 minute timeout'))
             irc.queueMsg(kick(channel, msg.nick, 'For swearing'))
             def unBan():
                 if channel in irc.state.channels and \
                    banmask in irc.state.channels[channel].bans:
                     irc.queueMsg(unban(channel, banmask))
             schedule.addEvent(unBan, time.time()+300)
         elif 'fag' in text.split():
             try:
                 hostmask = irc.state.nickToHostmask(msg.nick)
             except KeyError:
                 return
             (nick, user, host) = ircutils.splitHostmask(hostmask)
             irc.reply('No thanks %s I don\'t smoke' % user)
     return msg
开发者ID:chan-jesus,项目名称:no-cussing-supybot-plugin,代码行数:31,代码来源:plugin.py


示例7: saveLast

	def saveLast(self,irc,msg,match):
		r".+"
		channel = msg.args[0]

		try: self.buffer[channel]
		except: self.buffer[channel]=[]

# Stuff for multikick
		if channel in self.kickuser:
			for each in self.kickuser[channel]:
				if each in msg.nick.lower() and not self.kickuser[channel][each]['num'] <= 0:
					irc.queueMsg(ircmsgs.ban(msg.args[0], msg.nick))
					irc.queueMsg(ircmsgs.kick(msg.args[0], msg.nick, "{}".format(self.kickuser[channel][each]['msg'].replace('#n',str(self.kickuser[channel][each]['num'])))))
					self.kickuser[channel][each]['num']-=1
					def un():
						irc.queueMsg(ircmsgs.unban(msg.args[0],msg.nick))
					schedule.addEvent(un,time.time()+random.randint(10,60)) # 30,120
# END
		line = match.group(0).replace('\x01ACTION','*').strip('\x01')

		if msg.nick.lower() in self.annoyUser:
			def fu():
				irc.queueMsg(ircmsgs.IrcMsg('NOTICE {} :\x02\x03{},{}{}'.format(msg.nick,random.randint(0,15),random.randint(0,15),line)))
			schedule.addEvent(fu,time.time()+random.randint(2,60))

		if re.match(r"^u[/].*[/].*[/].*$", match.group(0)) or re.match(r"^s[/].*[/].*$", match.group(0)):
			return 1
		self.buffer[channel].insert(0,[msg.nick,line])
		if len(self.buffer[channel]) > self.buffsize: self.buffer[channel].pop(self.buffsize)
		return 1
开发者ID:jacksonmj,项目名称:StewieGriffin,代码行数:30,代码来源:plugin.py


示例8: floodPunish

	def floodPunish(self, irc, msg, floodType, dummy = False):
		channel = msg.args[0]

		if (not irc.nick in irc.state.channels[channel].ops) and\
		   (not irc.nick in irc.state.channels[channel].halfops):
			self.log.warning("%s flooded in %s, but not opped.",\
				msg.nick, channel)
			return

		if msg.nick in self.immunities:
			self.log.debug("Not punnishing %s, they are immune.",
				msg.nick)
			return

		if msg.nick in irc.state.channels[channel].ops or\
		   msg.nick in irc.state.channels[channel].halfops or\
		   msg.nick in irc.state.channels[channel].voices:
			self.log.debug("%s flooded in %s. But"\
				+ " I will not punish them because they have"\
				+ " special access.", msg.nick, channel)
			return

		if ircdb.checkCapability(msg.prefix, 'trusted') or\
		   ircdb.checkCapability(msg.prefix, 'admin') or\
		   ircdb.checkCapability(msg.prefix, channel + ',op'):
			self.log.debug("%s flooded in %s. But"\
				+ " I will not punish them because they are"\
				+ " trusted.", msg.nick, channel)
			return

		if msg.host in self.offenses and self.offenses[msg.host] > 2:
			hostmask = irc.state.nickToHostmask(msg.nick)
			banmaskstyle = conf.supybot.protocols.irc.banmask
			banmask = banmaskstyle.makeBanmask(hostmask)
			if not dummy:
				irc.queueMsg(ircmsgs.ban(channel, banmask))
			self.log.warning("Banned %s (%s) from %s for repeated"\
				+ " flooding.", banmask, msg.nick, channel)

		reason = floodType + " flood detected."
		if floodType == "Paste":
			reason += " Use a pastebin like pastebin.ubuntu.com or gist.github.com."

		if not dummy:
			irc.queueMsg(ircmsgs.kick(channel, msg.nick, reason))

		self.log.warning("Kicked %s from %s for %s flooding.",\
				msg.nick, channel, floodType)

		# Don't schedule the same nick twice
		if not (msg.host in self.offenses):
			schedule.addEvent(self.clearOffenses, time.time()+300,
					args=[msg.host])
			self.offenses[msg.host] = 0 # Incremented below
		self.offenses[msg.host] += 1

		self.immunities[msg.nick] = True
		schedule.addEvent(self.unImmunify, time.time()+3,
				args=[msg.nick])
开发者ID:ShadowNinja,项目名称:Limnoria-plugins,代码行数:59,代码来源:plugin.py


示例9: kickme

    def kickme(self, irc, msg, args, reason):
        """[<reason>]

        Kick yourself."""
        if ircutils.isChannel(msg.args[0]):
            irc.queueMsg(ircmsgs.kick(msg.args[0], msg.nick, reason or ''))
        else:
            irc.error(_("This command must be run in a channel."))
开发者ID:GLolol,项目名称:ProgVal-Supybot-plugins,代码行数:8,代码来源:plugin.py


示例10: detonate

        def detonate(self, irc):
            self.active = False
            self.thrown = False
            if self.showCorrectWire:
                # self.irc.reply('Should\'ve gone for the %s wire!' % self.goodWire)
                s = "%s should've gone for the %s wire!" % (self.victim, self.goodWire)
                self.irc.queueMsg(ircmsgs.action(self.channel, s))
            if self.showArt:
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x031,1.....\x0315,1_.\x0314,1-^^---....,\x0315,1,-_\x031,1.......")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x031,1.\x0315,1_--\x0314,1,.';,`.,';,.;;`;,.\x0315,1--_\x031,1...")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x0315,1<,.\x0314,1;'`\".,;`..,;`*.,';`.\x0315,1;'>)\x031,1.")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x0315,1I.:;\x0314,1.,`;~,`.;'`,.;'`,..\x0315,1';`I\x031,1.")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x031,1.\x0315,1\\_.\x0314,1`'`..`';.,`';,`';,\x0315,1_../\x031,1..")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x031,1....\x0315,1```\x0314,1--. . , ; .--\x0315,1'''\x031,1.....")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        "\x031,1..........\x034,1I\x031,1.\x038,1I\x037,1I\x031,1.\x038,1I\x034,1I\x031,1...........",
                    )
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        "\x031,1..........\x034,1I\x031,1.\x037,1I\x038,1I\x031,1.\x037,1I\x034,1I\x031,1...........",
                    )
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel, "\x031,1.......,\x034,1-=\x034,1II\x037,1..I\x034,1.I=-,\x031,1........"
                    )
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel, "\x031,1.......\x034,1`-=\x037,1#$\x038,1%&\x037,1%$#\x034,1=-'\x031,1........"
                    )
                )
            else:
                self.irc.sendMsg(ircmsgs.privmsg(self.channel, "KABOOM!"))
            self.irc.queueMsg(ircmsgs.kick(self.channel, self.victim, "BOOM!"))

            def reinvite():
                if not self.victim in irc.state.channels[self.channel].users:
                    self.irc.queueMsg(ircmsgs.invite(self.victim, self.channel))

            if not self.responded:
                schedule.addEvent(reinvite, time.time() + 5)
开发者ID:EnderBlue,项目名称:supybot,代码行数:58,代码来源:plugin.py


示例11: testKick

 def testKick(self):
     # do it as the stock test user, because he has admin capability and can kick
     gpg = self.irc.getCallback('GPG')
     gpg.authed_users['[email protected]'] = {'nick':'test',
             'keyid':'AAAAAAAAAAAAAAA4', 'fingerprint':'AAAAAAAAAAAAAAAAAAA1AAAAAAAAAAAAAAA4'}
     self.prefix = '[email protected]' 
     self.assertRegexp('gpg ident', 'are identified')
     self.irc.feedMsg(msg=ircmsgs.kick("#test", 'test', prefix=self.prefix))
     self.assertRegexp('gpg ident', 'not identified')
开发者ID:therealplato,项目名称:supybot-bitcoin-marketmonitor,代码行数:9,代码来源:test.py


示例12: doJoin

 def doJoin(self, irc, msg):
     user = ircutils.userFromHostmask(msg.prefix)
     if user == 'root' or user == '~root':
         channel = msg.args[0]
         s = self.registryValue('warning', channel)
         if self.registryValue('warn', channel):
             irc.queueMsg(ircmsgs.notice(msg.nick, s))
         if self.registryValue('kick', channel):
             irc.queueMsg(ircmsgs.kick(channel, msg.nick, s))
开发者ID:D0MF,项目名称:supybot-plugins-1,代码行数:9,代码来源:plugin.py


示例13: doBan

 def doBan():
     if irc.state.channels[channel].isOp(bannedNick):
         irc.queueMsg(ircmsgs.deop(channel, bannedNick))
     irc.queueMsg(ircmsgs.ban(channel, banmask))
     irc.queueMsg(ircmsgs.kick(channel, bannedNick, reason))
     def f():
         if channel in irc.state.channels and \
            banmask in irc.state.channels[channel].bans:
             irc.queueMsg(ircmsgs.unban(channel, banmask))
     schedule.addEvent(f, 3600)
开发者ID:kyl191,项目名称:aurora,代码行数:10,代码来源:plugin.py


示例14: raptors

 def raptors(self, irc, msg, args):
     """takes no arguments"""
     channel = msg.args[0]
     if irc.nick in irc.state.channels[channel].ops:
         irc.queueMsg(ircmsgs.kick(channel, msg.nick, 'Raptor Attack!'))
         irc.reply( ("%(name)s just got attacked by several raptors.  As they " +
                 "pick the remaining meat from %(name)s's bones they look up " +
                 "and see BamaWOLF...")  % {'name': msg.nick}, prefixNick=False )
     else:
         irc.reply("runs screaming", action=True)
开发者ID:Steve-V,项目名称:bot1st-modules,代码行数:10,代码来源:plugin.py


示例15: doPrivmsg

 def doPrivmsg(self, irc, msg):
     currentChannel = msg.args[0]
     if irc.isChannel(msg.args[0]):
         if (msg.args[1] == '\_o< quack!'):
             message = msg.nick + ", don't pretend to be me!";
             # If kickMode is enabled for this channel, and the bot have op capability, let's kick!
             if self.registryValue('kickMode', currentChannel) and irc.nick in irc.state.channels[currentChannel].ops:
                 irc.queueMsg(ircmsgs.kick(currentChannel, msg.nick, message))
             else:
                 # Else, just say it
                 irc.reply(message)
开发者ID:veggiematts,项目名称:supybot-duckhunt,代码行数:11,代码来源:plugin.py


示例16: _check_privileges

 def _check_privileges(self, irc, msg, reply=False):
     channel = msg.args[0]
     if irc.nick not in irc.state.channels[channel].ops:
         if reply:
             irc.reply("%s braucht op ;_;" % irc.nick)
         return False
     if self._calculate_id(msg.nick, channel) in self.recently_joined:
         if reply:
             irc.queueMsg(ircmsgs.kick(channel, msg.nick, "Du warst noch nicht lange genug anwesend um abzustimmen!"))
             self._user_left(irc, msg.nick, channel)
         return False
     return True
开发者ID:buckket,项目名称:supybot-scherbengericht,代码行数:12,代码来源:plugin.py


示例17: doJoin

 def doJoin(self, irc, msg):
     channel = msg.args[0]
     if ircutils.strEqual(irc.nick, msg.nick):
         return
     if not self.registryValue('enable', channel):
         return
     fallthrough = self.registryValue('fallthrough', channel)
     def do(type):
         cap = ircdb.makeChannelCapability(channel, type)
         if ircdb.checkCapability(msg.prefix, cap,
                 ignoreOwner=not self.registryValue('owner')):
             if self.registryValue(type, channel):
                 self.log.info('Scheduling auto-%s of %s in %s.',
                               type, msg.prefix, channel)
                 msgmaker = getattr(ircmsgs, type)
                 schedule_msg(msgmaker(channel, msg.nick))
                 raise Continue # Even if fallthrough, let's only do one.
             elif not fallthrough:
                 self.log.debug('%s has %s, but supybot.plugins.AutoMode.%s'
                                ' is not enabled in %s, refusing to fall '
                                'through.', msg.prefix, cap, type, channel)
                 raise Continue
     def schedule_msg(msg):
         def f():
             irc.queueMsg(msg)
         delay = self.registryValue('delay', channel)
         if delay:
             schedule.addEvent(f, time.time() + delay)
         else:
             f()
     try:
         do('op')
         if 'h' in irc.state.supported['prefix']:
             do('halfop')
         do('voice')
     except Continue:
         return
     c = ircdb.channels.getChannel(channel)
     if c.checkBan(msg.prefix) and self.registryValue('ban', channel):
         period = self.registryValue('ban.period', channel)
         if period:
             def unban():
                 try:
                     if msg.prefix in irc.state.channels[channel].bans:
                         irc.queueMsg(ircmsgs.unban(channel, msg.prefix))
                 except KeyError:
                     # We're not in the channel anymore.
                     pass
             schedule.addEvent(unban, time.time()+period)
         banmask =conf.supybot.protocols.irc.banmask.makeBanmask(msg.prefix)
         irc.queueMsg(ircmsgs.ban(channel, banmask))
         irc.queueMsg(ircmsgs.kick(channel, msg.nick))
开发者ID:boamaod,项目名称:Limnoria,代码行数:52,代码来源:plugin.py


示例18: _remove_kebab

    def _remove_kebab(self, irc, channel, target):
        prefix = irc.state.nickToHostmask(target)
        host = ircutils.hostFromHostmask(prefix)
        hostmask = "*!*@%s" % host

        irc.queueMsg(ircmsgs.ban(channel, hostmask))
        if target in irc.state.channels[channel].users:
            irc.queueMsg(ircmsgs.kick(channel, target, "Das Volk hat entschieden."))

        def unban():
            irc.queueMsg(ircmsgs.unban(channel, hostmask))

        schedule.addEvent(unban, time.time() + int(self.registryValue("ban_duration")))
开发者ID:buckket,项目名称:supybot-scherbengericht,代码行数:13,代码来源:plugin.py


示例19: testKick

 def testKick(self):
     # do it as the stock test user, because he has admin capability and can kick
     gpg = self.irc.getCallback("GPG")
     gpg.authed_users["[email protected]"] = {
         "nick": "test",
         "keyid": "AAAAAAAAAAAAAAA4",
         "fingerprint": "AAAAAAAAAAAAAAAAAAA1AAAAAAAAAAAAAAA4",
         "bitcoinaddress": "1blabsanthoeu",
     }
     self.prefix = "[email protected]"
     self.assertRegexp("gpg ident", "are identified")
     self.irc.feedMsg(msg=ircmsgs.kick("#test", "test", prefix=self.prefix))
     self.assertRegexp("gpg ident", "not identified")
开发者ID:piotrnar,项目名称:supybot-bitcoin-marketmonitor,代码行数:13,代码来源:test.py


示例20: inFilter

    def inFilter(self, irc, msg):
        self.filtering = True
        # We need to check for bad words here rather than in doPrivmsg because
        # messages don't get to doPrivmsg is the user is ignored.
        if msg.command == 'PRIVMSG':
            self.updateRegexp()
            s = ircutils.stripFormatting(msg.args[1])
            channel = msg.args[0]
            if ircutils.isChannel(channel) and self.registryValue('kickban', channel):
                if self.regexp.search(s):
                    if irc.nick in irc.state.channels[channel].ops:
                        message = self.registryValue('kickban.message', channel)
                        bannedHostmask = irc.state.nickToHostmask(msg.nick)
                        banmaskstyle = conf.supybot.protocols.irc.banmask
                        banmask = banmaskstyle.makeBanmask(bannedHostmask)
                        irc.queueMsg(ircmsgs.ban(channel, banmask))
                        irc.queueMsg(ircmsgs.kick(channel, msg.nick, message))
                        expiry = self.registryValue('kickban.banexpire', channel)
                        if expiry > 0:
                         def f():
                          if channel in irc.state.channels and \
                             banmask in irc.state.channels[channel].bans:
                             irc.queueMsg(ircmsgs.unban(channel, banmask))
                         schedule.addEvent(f,time.time()+expiry)
                    else:
                        self.log.warning('Should kickban %s from %s, but not opped.',
                                         msg.nick, channel)

            else: 
                if ircutils.isChannel(channel) and self.registryValue('kick', channel):
                 if self.regexp.search(s):
                    if irc.nick in irc.state.channels[channel].ops:
                        message = self.registryValue('kick.message', channel)
                        irc.queueMsg(ircmsgs.kick(channel, msg.nick, message))
                    else:
                        self.log.warning('Should kick %s from %s, but not opped.',
                                         msg.nick, channel)
        return msg
开发者ID:Affix,项目名称:Fedbot,代码行数:38,代码来源:plugin.py



注:本文中的supybot.ircmsgs.kick函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ircmsgs.mode函数代码示例发布时间:2022-05-27
下一篇:
Python ircmsgs.isCtcp函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap