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

Python ircmsgs.op函数代码示例

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

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



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

示例1: testUnban

 def testUnban(self):
     self.assertError('unban [email protected]')
     self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
     m = self.getMsg('unban [email protected]')
     self.assertEqual(m.command, 'MODE')
     self.assertEqual(m.args, (self.channel, '-b', '[email protected]'))
     self.assertNoResponse(' ', 2)
开发者ID:4poc,项目名称:competitionbot,代码行数:7,代码来源:test.py


示例2: doMode

 def doMode(self, irc, msg):
     channel = msg.args[0]
     chanOp = ircdb.makeChannelCapability(channel, 'op')
     chanVoice = ircdb.makeChannelCapability(channel, 'voice')
     chanHalfOp = ircdb.makeChannelCapability(channel, 'halfop')
     if not ircdb.checkCapability(msg.prefix, chanOp):
         irc.sendMsg(ircmsgs.deop(channel, msg.nick))
     for (mode, value) in ircutils.separateModes(msg.args[1:]):
         if not value:
             continue
         if ircutils.strEqual(value, msg.nick):
             # We allow someone to mode themselves to oblivion.
             continue
         if irc.isNick(value):
             hostmask = irc.state.nickToHostmask(value)
             if mode == '+o':
                 if not self.isOp(irc, channel, hostmask):
                     irc.queueMsg(ircmsgs.deop(channel, value))
             elif mode == '+h':
                 if not ircdb.checkCapability(hostmask, chanHalfOp):
                      irc.queueMsg(ircmsgs.dehalfop(channel, value))
             elif mode == '+v':
                 if not ircdb.checkCapability(hostmask, chanVoice):
                     irc.queueMsg(ircmsgs.devoice(channel, value))
             elif mode == '-o':
                 if ircdb.checkCapability(hostmask, chanOp):
                     irc.queueMsg(ircmsgs.op(channel, value))
             elif mode == '-h':
                 if ircdb.checkCapability(hostmask, chanOp):
                     irc.queueMsg(ircmsgs.halfop(channel, value))
             elif mode == '-v':
                 if ircdb.checkCapability(hostmask, chanOp):
                     irc.queueMsg(ircmsgs.voice(channel, value))
         else:
             assert ircutils.isUserHostmask(value)
开发者ID:AssetsIncorporated,项目名称:Limnoria,代码行数:35,代码来源:plugin.py


示例3: testVoice

 def testVoice(self):
     self.assertError('voice')
     self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
     self.assertNotError('voice')
     m = self.getMsg('voice foo')
     self.failUnless(m.command == 'MODE' and
                     m.args == (self.channel, '+v', 'foo'))
     m = self.getMsg('voice foo bar')
     self.failUnless(m.command == 'MODE' and
                     m.args == (self.channel, '+v', 'foo'))
     m = self.irc.takeMsg()
     self.failUnless(m.command == 'MODE' and
                     m.args == (self.channel, '+v', 'bar'))
开发者ID:4poc,项目名称:competitionbot,代码行数:13,代码来源:test.py


示例4: testIban

    def testIban(self):
        self.irc.feedMsg(ircmsgs.join(self.channel,
                                      prefix='[email protected]'))
        self.assertError('iban [email protected]')
        self.irc.feedMsg(ircmsgs.op(self.channel, self.irc.nick))
        self.assertBan('iban [email protected]', '[email protected]')
        self.assertBan('iban foobar', '[email protected]')

        conf.supybot.protocols.irc.strictRfc.setValue(True)
        self.assertError('iban $a:nyuszika7h')
        self.assertError('unban $a:nyuszika7h')
        conf.supybot.protocols.irc.strictRfc.setValue(False)
        self.assertBan('iban $a:nyuszika7h', '$a:nyuszika7h')
        self.assertNotError('unban $a:nyuszika7h')
开发者ID:4poc,项目名称:competitionbot,代码行数:14,代码来源:test.py


示例5: detonate

        def detonate(self, irc):
            fairnessInvert = False
            if not self.responded:

                if self.sender in irc.state.channels[self.channel].ops and not self.victim in irc.state.channels[self.channel].ops:
                    print(" Sender has ops and victim does not! Throwing for a fairness detonation inversion!" )
                    randNum = self.rng.randint(0,4)
                    if randNum == 0 :
                        irc.reply("The bomb goes klunk.")
                        fairnessInvert = True
                        self.irc.queueMsg(ircmsgs.op(self.channel, self.victim) )
                    else:
                        print "Throw failed."
                    
            self.active = False
            #if self.showCorrectWire:
            #    self.irc.reply('Should\'ve gone for the %s wire!' % self.goodWire)
            if self.showArt:
                self.irc.sendMsg(ircmsgs.privmsg(self.channel, '  (}                  ,^.      .                    .'))
                self.irc.sendMsg(ircmsgs.privmsg(self.channel, ' / \\\\/\.  `      `._-\'   \'`-~.            .'))
                self.irc.sendMsg(ircmsgs.privmsg(self.channel, ' \, \`            )    __   (        .'))
                self.irc.sendMsg(ircmsgs.privmsg(self.channel, ' .  /       .   -<    //\\\\   `_-  .'))
                self.irc.sendMsg(ircmsgs.privmsg(self.channel, '    `           . )  //  \\\\  (   \'     P A N T S P L O D E'))
            detonateMsg = "BOOM!"
            if self.thrown:
                detonateMsg = "KA" + detonateMsg
            else:
                if self.showCorrectWire :
                    detonateMsg += " (it was %s)" % self.goodWire
            self.active = False
            self.thrown = False
            
            if fairnessInvert:
                #self.irc.queueMsg(irc.reply("The bomb goes klunk.") )
                print "Fairness invert activated!"
                newVictim = self.sender
                self.sender = self.victim
                self.victim = newVictim
                #irc.reply("The bomb goes beep!"))
                #time.sleep(10)
            else:
                self.irc.queueMsg(ircmsgs.kick(self.channel, self.victim, detonateMsg) )
                        
            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:alxsoares,项目名称:supybot-plugins,代码行数:48,代码来源:plugin.py


示例6: testOp

 def testOp(self):
     self.assertError('op')
     self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
     self.assertNotError('op')
     m = self.getMsg('op foo')
     self.failUnless(m.command == 'MODE' and
                     m.args == (self.channel, '+o', 'foo'))
     m = self.getMsg('op foo bar')
     self.failUnless(m.command == 'MODE' and
                     m.args == (self.channel, '+o', 'foo'))
     m = self.irc.takeMsg()
     self.failUnless(m.command == 'MODE' and
                     m.args == (self.channel, '+o', 'bar'))
     self.irc.state.supported['MODES'] = 2
     m = self.getMsg('op foo bar')
     try:
         self.failUnless(m.command == 'MODE' and
                         m.args == (self.channel, '+oo', 'foo', 'bar'))
     finally:
         self.irc.state.supported['MODES'] = 1
开发者ID:4poc,项目名称:competitionbot,代码行数:20,代码来源:test.py


示例7: testHandlesModes

    def testHandlesModes(self):
        st = irclib.IrcState()
        st.addMsg(self.irc, ircmsgs.join('#foo', prefix=self.irc.prefix))
        self.failIf('bar' in st.channels['#foo'].ops)
        st.addMsg(self.irc, ircmsgs.op('#foo', 'bar'))
        self.failUnless('bar' in st.channels['#foo'].ops)
        st.addMsg(self.irc, ircmsgs.deop('#foo', 'bar'))
        self.failIf('bar' in st.channels['#foo'].ops)

        self.failIf('bar' in st.channels['#foo'].voices)
        st.addMsg(self.irc, ircmsgs.voice('#foo', 'bar'))
        self.failUnless('bar' in st.channels['#foo'].voices)
        st.addMsg(self.irc, ircmsgs.devoice('#foo', 'bar'))
        self.failIf('bar' in st.channels['#foo'].voices)

        self.failIf('bar' in st.channels['#foo'].halfops)
        st.addMsg(self.irc, ircmsgs.halfop('#foo', 'bar'))
        self.failUnless('bar' in st.channels['#foo'].halfops)
        st.addMsg(self.irc, ircmsgs.dehalfop('#foo', 'bar'))
        self.failIf('bar' in st.channels['#foo'].halfops)
开发者ID:krattai,项目名称:AEBL,代码行数:20,代码来源:test_irclib.py


示例8: doNotice

 def doNotice(self, irc, msg):
     mynick = irc.nick
     user = msg.nick
     hostname = irc.state.nickToHostmask(user)
     (recipients, text) = msg.args
     if ircmsgs.isCtcp(msg) or ircmsgs.isAction(msg) or irc.isChannel(msg.args[0]):  # ignore obvious non.
         return
     elif text.startswith('!ZNCAO'):  # we only process notices with !ZNCAO.
         textparts = text.split()  # split. should be 3.
         if len(textparts) != 3:  # make sure we have 3 parts to a valid ZNC message.
             self.log.error("ERROR: ZNC notice from {0} is malformed. I got: {1}".format(user, text))
             return
         if textparts[0] == "!ZNCAO" and textparts[1] == "CHALLENGE":  # if user is opped and we are not. we get challenge.
             self.log.info("We got a ZNC challenge from {0}".format(user))
             challenge = textparts[2]
             for (key, value) in self._users.items():  # iterate now through our users for key.
                 hostmask, key, channel = value[0]
                 if ircutils.hostmaskPatternEqual(hostmask, hostname):  # if we have a match.
                     if not irc.state.channels[channel].isOp(mynick) and irc.state.channels[channel].isOp(user):  # and they're opped, we're not.
                         response = "!ZNCAO RESPONSE {0}".format(self._zncresponse(key, challenge))  # this key and the challenge.
                         self.log.info("Sending {0} {1}".format(user, response))
                         irc.queueMsg(ircmsgs.notice(user, response))
         elif textparts[0] == "!ZNCAO" and textparts[1] == "RESPONSE":  # means we sent a challenge. we're opped, user is not.
             self.log.info("We got a ZNC response from {0}".format(user))
             if user in self._challenges:  # user is in challenges because their hostname matched.
                 for chan in self._challenges[user]:
                     if irc.state.channels[chan].isOp(mynick) and not irc.state.channels[chan].isOp(user):  # im op. they're not.
                         (chaltime, challenge, chaluser) = self._challenges[user][chan]
                         if chaltime - time.time() < 60:  # challenge less than 60s ago.
                             hostmask, key, channel = self._users[chaluser][0]  # find the user in the db.
                             mychallenge = self._zncresponse(key, challenge)  # create my own based on challenge/key to auth.
                             if mychallenge == textparts[2]:  # compare my md5 hash and theirs.
                                 self.log.info("Giving ZNC OP to {0} on {1} after valid key matching.".format(user, chan))
                                 irc.queueMsg(ircmsgs.op(chan, user))  # op if they're valid.
                             else:  # invalid key.
                                 self.log.info("ERROR: Invalid key from: {0} on {1}".format(user, chan))
                         else:  # key is too old.
                             self.log.info("ERROR: {0} in {1} challenge was more than 60s ago.".format(user, chan))
             else:
                 self.log.info("ERROR: {0} not found in ZNC challenges.".format(user))
开发者ID:reticulatingspline,项目名称:ZNC,代码行数:40,代码来源:plugin.py


示例9: testErrorsWithoutOps

 def testErrorsWithoutOps(self):
     for s in 'op deop halfop dehalfop voice devoice kick invite'.split():
         self.assertError('%s foo' % s)
         self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
         self.assertNotError('%s foo' % s)
         self.irc.feedMsg(ircmsgs.deop(self.channel, self.nick))
开发者ID:4poc,项目名称:competitionbot,代码行数:6,代码来源:test.py


示例10: testWontDeItself

 def testWontDeItself(self):
     for s in 'deop dehalfop devoice'.split():
         self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
         self.assertError('%s %s' % (s, self.nick))
开发者ID:4poc,项目名称:competitionbot,代码行数:4,代码来源:test.py


示例11: testCanDevoiceSelf

 def testCanDevoiceSelf(self):
     self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
     self.assertNotError('devoice %s' % self.nick)
开发者ID:AssetsIncorporated,项目名称:Limnoria,代码行数:3,代码来源:test.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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