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

Python ircmsgs.mode函数代码示例

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

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



在下文中一共展示了mode函数的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

        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


示例2: quiet

    def quiet(self, irc, msg, args, channel, nick, expiry):
        """[<channel>] <nick> [<expiry>]

        Quietens <nick> from <channel> for <expiry>.  If <expiry> isn't given,
        the duration is permanent.
        <channel> is only necessary if the message isn't sent in the channel
        itself.
        """
        if irc.isNick(nick):
            bannedNick = nick
            try:
                bannedHostmask = irc.state.nickToHostmask(nick)
            except KeyError:
                irc.error(format(_('I haven\'t seen %s.'), bannedNick), Raise=True)
        else:
            bannedNick = ircutils.nickFromHostmask(nick)
            bannedHostmask = nick
        if not irc.isNick(bannedNick):
            self.log.warning('%q tried to quiet a non nick: %q',
                             msg.prefix, bannedNick)
            raise callbacks.ArgumentError
        banmaskstyle = conf.supybot.protocols.irc.banmask
        banmask = banmaskstyle.makeBanmask(bannedHostmask)
        if ircutils.strEqual(nick, irc.nick):
            irc.error('I cowardly refuse to quiet myself.', Raise=True)
        thismsg=self.registryValue('message')
        self._sendMsg(irc, ircmsgs.mode(channel, ("+q", banmask)))
        if self.registryValue('SendMsgPvt'):
            self._sendMsg(irc, ircmsgs.privmsg(nick,nick+", "+thismsg ))
        else:
            self._sendMsg(irc, ircmsgs.privmsg(channel,nick+", "+thismsg ))
        def f():
            irc.queueMsg(ircmsgs.mode(channel, ("-q", banmask)))
        if expiry:
        	schedule.addEvent(f, expiry)
开发者ID:GlitterCakes,项目名称:PoohBot,代码行数:35,代码来源: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

        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


示例4: testAddMsgRemovesOpsProperly

 def testAddMsgRemovesOpsProperly(self):
     st = irclib.IrcState()
     st.channels['#foo'] = irclib.ChannelState()
     st.channels['#foo'].ops.add('bar')
     m = ircmsgs.mode('#foo', ('-o', 'bar'))
     st.addMsg(self.irc, m)
     self.failIf('bar' in st.channels['#foo'].ops)
开发者ID:krattai,项目名称:AEBL,代码行数:7,代码来源:test_irclib.py


示例5: banForward

	def banForward(self, irc, msg, channel):
		hostmask = irc.state.nickToHostmask(msg.nick)
		banmaskstyle = conf.supybot.protocols.irc.banmask
		banmask = banmaskstyle.makeBanmask(hostmask)
		irc.queueMsg(ircmsgs.mode(msg.args[0], ("+b", banmask + "$" + channel)))
		self.log.warning("Ban-forwarded %s (%s) from %s to %s.",
				banmask, msg.nick, msg.args[0], channel)
开发者ID:ShadowNinja,项目名称:Limnoria-plugins,代码行数:7,代码来源:plugin.py


示例6: do381

 def do381(self, irc, msg):
     self.log.info("OperUp: Received 381 (successful oper up) on %s: %s", irc.network, msg.args[-1])
     if self.registryValue("operModes"):
         self.log.info("OperUp: Opered up on %s, sending user modes %s",
                       irc.network, ''.join(self.registryValue("operModes")))
         irc.sendMsg(ircmsgs.mode(irc.nick,
                                  self.registryValue("operModes")))
开发者ID:GLolol,项目名称:SupyPlugins,代码行数:7,代码来源:plugin.py


示例7: do381

 def do381(self, irc, msg):
     self.log.info("OperUp: Received 381 (successfully opered up) from "
         "network %s." % irc.network)
     if self.registryValue("operModes"):
         self.log.info("OperUp: Opered up on %s, sending user modes %s"
             % (irc.network, ''.join(self.registryValue("operModes"))))
         irc.sendMsg(ircmsgs.mode(irc.nick, 
             self.registryValue("operModes")))
开发者ID:ProgVal,项目名称:SupyPlugins,代码行数:8,代码来源:plugin.py


示例8: deoper

 def deoper(self, irc, msg, args):
     """takes no arguments.
     Makes the bot deoper by setting user modes -Oo on itself.
     """
     if irc.nested:
         irc.error("This command cannot be nested.", Raise=True)
     irc.sendMsg(ircmsgs.mode(irc.nick, "-Oo"))
     irc.replySuccess()
开发者ID:liam-middlebrook,项目名称:SupyPlugins,代码行数:8,代码来源:plugin.py


示例9: get_bans

 def get_bans(self, irc):
     global queue
     for channel in irc.state.channels.keys():
         if not self.registryValue('enabled', channel):
             continue
         if channel not in self.bans:
             self.bans[channel] = []
         queue.queue(ircmsgs.mode(channel, 'b'))
开发者ID:Affix,项目名称:Fedbot,代码行数:8,代码来源:plugin.py


示例10: unlock

    def unlock(self, irc, msg, args, channel):
        """[<channel>]

        Locks the topic (sets the mode +t) in <channel>.  <channel> is only
        necessary if the message isn't sent in the channel itself.
        """
        irc.queueMsg(ircmsgs.mode(channel, '-t'))
        irc.noReply()
开发者ID:Kefkius,项目名称:mazabot,代码行数:8,代码来源:plugin.py


示例11: unlock

    def unlock(self, irc, msg, args, channel):
        """[<channel>]

        Unlocks the topic (sets the mode -t) in <channel>.  <channel> is only
        necessary if the message isn't sent in the channel itself.
        """
        self._checkManageCapabilities(irc, msg, channel)
        irc.queueMsg(ircmsgs.mode(channel, '-t'))
        irc.noReply()
开发者ID:ElectroCode,项目名称:Limnoria,代码行数:9,代码来源:plugin.py


示例12: unlock

    def unlock(self, irc, msg, args, channel):
        """[<channel>]

        Unlocks the topic (sets the mode -t) in <channel>.  <channel> is only
        necessary if the message isn't sent in the channel itself.
        """
        if not self._checkManageCapabilities(irc, msg, channel):
            capabilities = self.registryValue('requireManageCapability')
            irc.errorNoCapability(capabilities, Raise=True)
        irc.queueMsg(ircmsgs.mode(channel, '-t'))
        irc.noReply()
开发者ID:Elwell,项目名称:supybot,代码行数:11,代码来源:plugin.py


示例13: make_and_join_channel

 def make_and_join_channel(self, irc, nick):
     channel_length = 15
     channel_characters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
     channel_name_chars = []
     for character in xrange(channel_length):
         channel_name_chars.append(random.choice(channel_characters))
     channel_name = '#%s' % ''.join(channel_name_chars)
     irc.queueMsg(ircmsgs.join(channel_name))
     time.sleep(7)
     irc.queueMsg(ircmsgs.mode(channel_name, '+i'))
     self._invite(irc, nick, channel_name)
开发者ID:kg-bot,项目名称:SupyBot,代码行数:11,代码来源:plugin.py


示例14: moderate

	def moderate (self, irc, msg, args, channel, nick):
		"""[channel] nick
		Bascule tous les utilisateurs du canal en mode +v excépté 'nick' puis
		passe le canal en mode +m
		"""
		if not channel:
			channel = msg.args[0]
		if channel in irc.state.channels:
			# TODO: Spécifier la liste des nick au différents canaux
			self.nicks_moderated.append (nick)
			self.voice_func (irc, msg, args, channel)
			irc.queueMsg (ircmsgs.devoice(channel, nick))
			#self.removeNick (irc, channel, nick, "Avertissement")
			irc.queueMsg (ircmsgs.mode(channel, ['+m']))
开发者ID:WnP,项目名称:archange,代码行数:14,代码来源:plugin.py


示例15: doJoin

 def doJoin(self, irc, msg):
     global queue
     for channel in msg.args[0].split(','):
         if msg.nick:
             self.doLog(irc, channel,
                    '*** %s (%s) has joined %s\n' % (msg.nick, msg.prefix.split('!', 1)[1], channel))
         else:
             self.doLog(irc, channel,
                    '*** %s has joined %s\n' % (msg.prefix, channel))
         if not channel in self.bans.keys():
             self.bans[channel] = []
         if msg.prefix.split('!', 1)[0] == irc.nick:
             queue.queue(ircmsgs.mode(channel, 'b'))
     nick = msg.nick.lower() or msg.prefix.lower().split('!', 1)[0]
     self.nicks[nick] = msg.prefix.lower()
开发者ID:Affix,项目名称:Fedbot,代码行数:15,代码来源:plugin.py


示例16: stopGame

	def stopGame(self,irc,msg,args):
		self.gameMode=0
		x=0
		witness=" "
		while x < 3:
			if self.player[x]['role'] is not "killer":
				witness = "witness "
			else:
				witness = ""
				irc.reply("%s was the %s %swearing a %s shirt."%(self.player['name'][x],self.player[x]['role'],witness,self.player[x]['colour']), prefixNick=False)
				x+=1

		irc.queueMsg(ircmsgs.mode(self.channel, "-m"))
		self._devoice(irc, self.player['joined'])

		self.abort=[]
		self.channel=""
		self.roles={}
		self.roles['sane']=0
		self.roles['deluded']=0
		self.roles['killer']=0

		self.player={}
		self.player['joined']=[]
		self.player['name']=[]

		self.player[0]={}
		self.player[0]['user']=""
		self.player[0]['role']=""
		self.player[0]['colour']=""
		self.player[0]['voted']=[]

		self.player[1]={}
		self.player[1]['user']=""
		self.player[1]['role']=""
		self.player[1]['colour']=""
		self.player[1]['voted']=[]

		self.player[2]={}
		self.player[2]['user']=""
		self.player[2]['role']=""
		self.player[2]['colour']=""
		self.player[2]['voted']=[]
开发者ID:antb,项目名称:StewieGriffin,代码行数:43,代码来源:plugin.py


示例17: quiet

    def quiet(self, irc, msg, args, channel, nick, expiry):
        """[<channel>] <nick> [<expiry>]

        Quietens <nick> from <channel> for <expiry>.  If <expiry> isn't given,
        the duration is permanent.
        <channel> is only necessary if the message isn't sent in the channel
        itself.
        """
        if ircutils.strEqual(nick, irc.nick):
            irc.error('I cowardly refuse to quiet myself.', Raise=True)
        thismsg=self.registryValue('message')
        self._sendMsg(irc, ircmsgs.mode(channel, ("+q", nick)))
        if self.registryValue('SendMsgPvt'):
            self._sendMsg(irc, ircmsgs.privmsg(nick,nick+", "+thismsg ))
        else:
            self._sendMsg(irc, ircmsgs.privmsg(channel,nick+", "+thismsg ))
        def f():
            irc.queueMsg(ircmsgs.mode(channel, ("-q", nick)))
        schedule.addEvent(f, expiry)
开发者ID:Affix,项目名称:Fedbot,代码行数:19,代码来源:plugin.py


示例18: extra_modes

 def extra_modes():
     try:
         user = ircdb.users.getUser(ircdb.users.getUserId(msg.prefix))
     except KeyError:
         return
     pattern = re.compile("-|\+")
     for item in self.registryValue("extra", channel):
         try:
             username, modes = pattern.split(item, maxsplit=1)
             modes = item[len(username)] + modes
         except ValueError:  # No - or + in item
             log.error(("%r is not a valid item for " "supybot.plugins.AutoMode.extra") % item)
             continue
         if username != user.name:
             continue
         else:
             self.log.info("Scheduling auto-modes %s of %s in %s.", modes, msg.prefix, channel)
             modes = [modes] + ([msg.nick] * len(pattern.sub("", modes)))
             schedule_msg(ircmsgs.mode(channel, modes), lambda: False)
             break
开发者ID:nW44b,项目名称:Limnoria,代码行数:20,代码来源:plugin.py


示例19: unquiet

    def unquiet(self, irc, msg, args, channel, nick):
        """[<channel>] <nick> [<expiry>]

        Quietens <nick> from <channel> for <expiry>.  If <expiry> isn't given,
        the duration is permanent.
        <channel> is only necessary if the message isn't sent in the channel
        itself.
        """
        if irc.isNick(nick):
            bannedNick = nick
            try:
                bannedHostmask = irc.state.nickToHostmask(nick)
            except KeyError:
                irc.error(format(_('I haven\'t seen %s.'), bannedNick), Raise=True)
        else:
            bannedNick = ircutils.nickFromHostmask(nick)
            bannedHostmask = nick
        if not irc.isNick(bannedNick):
            self.log.warning('%q tried to quiet a non nick: %q',
                             msg.prefix, bannedNick)
            raise callbacks.ArgumentError
        banmaskstyle = conf.supybot.protocols.irc.banmask
        banmask = banmaskstyle.makeBanmask(bannedHostmask)
        irc.queueMsg(ircmsgs.mode(channel, ("-q", banmask)))
开发者ID:GlitterCakes,项目名称:PoohBot,代码行数:24,代码来源:plugin.py


示例20: deoper

 def deoper(self, irc, msg, args):
     """takes no arguments.
     Makes the bot deoper by setting user modes -Oo on itself.
     """
     irc.sendMsg(ircmsgs.mode(irc.nick, "-Oo"))
     irc.replySuccess()
开发者ID:ProgVal,项目名称:SupyPlugins,代码行数:6,代码来源:plugin.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python ircmsgs.nick函数代码示例发布时间:2022-05-27
下一篇:
Python ircmsgs.kick函数代码示例发布时间: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