当前位置: 首页>>代码示例>>Python>>正文


Python ircmsgs.nick函数代码示例

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


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

示例1: doNickservNotice

 def doNickservNotice(self, irc, msg):
     nick = self._getNick()
     s = ircutils.stripFormatting(msg.args[1].lower())
     on = 'on %s' % irc.network
     networkGroup = conf.supybot.networks.get(irc.network)
     if 'incorrect' in s or 'denied' in s:
         log = 'Received "Password Incorrect" from NickServ %s.  ' \
               'Resetting password to empty.' % on
         self.log.warning(log)
         self.sentGhost = time.time()
         self._setNickServPassword(nick, '')
     elif self._ghosted(s):
         self.log.info('Received "GHOST succeeded" from NickServ %s.', on)
         self.sentGhost = None
         self.identified = False
         irc.queueMsg(ircmsgs.nick(nick))
     elif 'is not registered' in s:
         self.log.info('Received "Nick not registered" from NickServ %s.',
                       on)
     elif 'currently' in s and 'isn\'t' in s or 'is not' in s:
         # The nick isn't online, let's change our nick to it.
         self.sentGhost = None
         irc.queueMsg(ircmsgs.nick(nick))
     elif ('owned by someone else' in s) or \
          ('nickname is registered and protected' in s) or \
          ('nick belongs to another user' in s):
         # freenode, arstechnica, chatjunkies
         # oftc, zirc.org
         # sorcery
         self.log.info('Received "Registered nick" from NickServ %s.', on)
     elif '/msg' in s and 'id' in s and 'password' in s:
         # Usage info for identify command; ignore.
         self.log.debug('Got usage info for identify command %s.', on)
     elif ('please choose a different nick' in s): # oftc, part 3
         # This is a catch-all for redundant messages from nickserv.
         pass
     elif ('now recognized' in s) or \
          ('already identified' in s) or \
          ('password accepted' in s) or \
          ('now identified' in s):
         # freenode, oftc, arstechnica, zirc, ....
         # sorcery
         self.log.info('Received "Password accepted" from NickServ %s.', on)
         self.identified = True
         for channel in irc.state.channels.keys():
             self.checkPrivileges(irc, channel)
         for channel in self.channels:
             irc.queueMsg(networkGroup.channels.join(channel))
         if self.waitingJoins:
             for m in self.waitingJoins:
                 irc.sendMsg(m)
             self.waitingJoins = []
     elif 'not yet authenticated' in s:
         # zirc.org has this, it requires an auth code.
         email = s.split()[-1]
         self.log.warning('Received "Nick not yet authenticated" from '
                          'NickServ %s.  Check email at %s and send the '
                          'auth command to NickServ.', on, email)
     else:
         self.log.debug('Unexpected notice from NickServ %s: %q.', on, s)
开发者ID:Kefkius,项目名称:mazabot,代码行数:60,代码来源:plugin.py

示例2: doNick

 def doNick(self, irc, msg):
     nick = self._getNick()
     if ircutils.strEqual(msg.args[0], irc.nick) and \
        ircutils.strEqual(irc.nick, nick):
         self._doIdentify(irc)
     elif ircutils.strEqual(msg.nick, nick):
         irc.sendMsg(ircmsgs.nick(nick))
开发者ID:MrTiggr,项目名称:supybot_fixes,代码行数:7,代码来源:plugin.py

示例3: testFirstCommands

 def testFirstCommands(self):
     try:
         originalNick = conf.supybot.nick()
         originalUser = conf.supybot.user()
         originalPassword = conf.supybot.networks.test.password()
         nick = 'nick'
         conf.supybot.nick.setValue(nick)
         user = 'user any user'
         conf.supybot.user.setValue(user)
         expected = [ircmsgs.nick(nick), ircmsgs.user('supybot', user)]
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         self.assertEqual(msgs, expected)
         password = 'password'
         conf.supybot.networks.test.password.setValue(password)
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         expected.insert(0, ircmsgs.password(password))
         self.assertEqual(msgs, expected)
     finally:
         conf.supybot.nick.setValue(originalNick)
         conf.supybot.user.setValue(originalUser)
         conf.supybot.networks.test.password.setValue(originalPassword)
开发者ID:krattai,项目名称:AEBL,代码行数:29,代码来源:test_irclib.py

示例4: testNick

 def testNick(self):
     self.prefix = '[email protected]'
     self.assertRegexp('gpg ident', 'are identified')
     self.irc.feedMsg(msg=ircmsgs.nick('newnick', prefix=self.prefix))
     self.assertRegexp('gpg ident', 'not identified')
     self.prefix = 'newnick' + '!' + self.prefix.split('!',1)[1]
     self.assertRegexp('gpg ident', 'You are identified')
开发者ID:therealplato,项目名称:supybot-bitcoin-marketmonitor,代码行数:7,代码来源:test.py

示例5: testNick

 def testNick(self):
     self.prefix = "[email protected]"
     self.assertRegexp("gpg ident", "are identified")
     self.irc.feedMsg(msg=ircmsgs.nick("newnick", prefix=self.prefix))
     self.assertRegexp("gpg ident", "not identified")
     self.prefix = "newnick" + "!" + self.prefix.split("!", 1)[1]
     self.assertRegexp("gpg ident", "You are identified")
开发者ID:piotrnar,项目名称:supybot-bitcoin-marketmonitor,代码行数:7,代码来源:test.py

示例6: nick

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

        Changes the bot's nick to <nick>.  If no nick is given, returns the
        bot's current nick.
        """
        if nick:
            conf.supybot.nick.setValue(nick)
            irc.queueMsg(ircmsgs.nick(nick))
            self.pendingNickChanges[irc.getRealIrc()] = irc
        else:
            irc.reply(irc.nick)
开发者ID:fbesser,项目名称:Limnoria,代码行数:12,代码来源:plugin.py

示例7: nick

    def nick(self, irc, msg, args, nick, network):
        """[<nick>] [<network>]

        Changes the bot's nick to <nick>.  If no nick is given, returns the
        bot's current nick.
        """
        network = network or irc.network
        if nick:
            group = getattr(conf.supybot.networks, network)
            group.nick.setValue(nick)
            irc.queueMsg(ircmsgs.nick(nick))
            self.pendingNickChanges[irc.getRealIrc()] = irc
        else:
            irc.reply(irc.nick)
开发者ID:frumiousbandersnatch,项目名称:Limnoria,代码行数:14,代码来源:plugin.py

示例8: __call__

 def __call__(self, irc, msg):
     self.__parent.__call__(irc, msg)
     if self.disabled(irc):
         return
     nick = self._getNick()
     if nick not in self.registryValue('nicks'):
         return
     nickserv = self.registryValue('NickServ')
     password = self._getNickServPassword(nick)
     ghostDelay = self.registryValue('ghostDelay')
     if nick and nickserv and password and \
        not ircutils.strEqual(nick, irc.nick):
         if irc.afterConnect and (self.sentGhost is None or
            (self.sentGhost + ghostDelay) < time.time()):
             if nick in irc.state.nicksToHostmasks:
                 self._doGhost(irc)
             else:
                 irc.sendMsg(ircmsgs.nick(nick)) # 433 is handled elsewhere.
开发者ID:MrTiggr,项目名称:supybot_fixes,代码行数:18,代码来源:plugin.py

示例9: testFirstCommands

 def testFirstCommands(self):
     try:
         originalNick = conf.supybot.nick()
         originalUser = conf.supybot.user()
         originalPassword = conf.supybot.networks.test.password()
         nick = 'nick'
         conf.supybot.nick.setValue(nick)
         user = 'user any user'
         conf.supybot.user.setValue(user)
         expected = [
             ircmsgs.nick(nick),
             ircmsgs.user('limnoria', user),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-notify')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'extended-join')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'multi-prefix')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'metadata-notify')),
             ircmsgs.IrcMsg(command='CAP', args=('REQ', 'account-tag')),
             ircmsgs.IrcMsg(command='CAP', args=('END',)),
         ]
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         self.assertEqual(msgs, expected)
         password = 'password'
         conf.supybot.networks.test.password.setValue(password)
         irc = irclib.Irc('test')
         msgs = [irc.takeMsg()]
         while msgs[-1] != None:
             msgs.append(irc.takeMsg())
         msgs.pop()
         expected.insert(0, ircmsgs.password(password))
         self.assertEqual(msgs, expected)
     finally:
         conf.supybot.nick.setValue(originalNick)
         conf.supybot.user.setValue(originalUser)
         conf.supybot.networks.test.password.setValue(originalPassword)
开发者ID:Web-Development-Guru,项目名称:Limnoria,代码行数:38,代码来源:test_irclib.py

示例10: doQuit

 def doQuit(self, irc, msg):
     if ircmsgs.isSplit(msg):
         irc.reply("GOOD JOB OPERS!", prefixNick=False)
         if msg.nick == self.oper_nick:
             irc.queueMsg(ircmsgs.nick(self.oper_nick))
开发者ID:AnonymousAutist,项目名称:GoodJobOpers,代码行数:5,代码来源:plugin.py

示例11: _sendNick

 def _sendNick(self, irc, nick):
     self.log.info('Attempting to switch to nick %s on %s.',
                   nick, irc.network)
     irc.sendMsg(ircmsgs.nick(nick))
开发者ID:4poc,项目名称:competitionbot,代码行数:4,代码来源:plugin.py

示例12: nick

 def nick():
     irc.queueMsg(ircmsgs.nick(target))
开发者ID:Ban3,项目名称:Limnoria,代码行数:2,代码来源:plugin.py

示例13: doNickservNotice

 def doNickservNotice(self, irc, msg):
     if self.disabled(irc):
         return
     nick = self._getNick(irc.network)
     s = ircutils.stripFormatting(msg.args[1].lower())
     on = "on %s" % irc.network
     networkGroup = conf.supybot.networks.get(irc.network)
     if "incorrect" in s or "denied" in s:
         log = 'Received "Password Incorrect" from NickServ %s.  ' "Resetting password to empty." % on
         self.log.warning(log)
         self.sentGhost = time.time()
         self._setNickServPassword(nick, "")
     elif self._ghosted(irc, s):
         self.log.info('Received "GHOST succeeded" from NickServ %s.', on)
         self.sentGhost = None
         self.identified = False
         irc.queueMsg(ircmsgs.nick(nick))
     elif "is not registered" in s:
         self.log.info('Received "Nick not registered" from NickServ %s.', on)
     elif "currently" in s and "isn't" in s or "is not" in s:
         # The nick isn't online, let's change our nick to it.
         self.sentGhost = None
         irc.queueMsg(ircmsgs.nick(nick))
     elif (
         ("owned by someone else" in s)
         or ("nickname is registered and protected" in s)
         or ("nick belongs to another user" in s)
     ):
         # freenode, arstechnica, chatjunkies
         # oftc, zirc.org
         # sorcery
         self.log.info('Received "Registered nick" from NickServ %s.', on)
     elif "/msg" in s and "id" in s and "password" in s:
         # Usage info for identify command; ignore.
         self.log.debug("Got usage info for identify command %s.", on)
     elif "please choose a different nick" in s:  # oftc, part 3
         # This is a catch-all for redundant messages from nickserv.
         pass
     elif (
         ("now recognized" in s)
         or ("already identified" in s)
         or ("already logged in" in s)
         or ("successfully identified" in s)
         or ("password accepted" in s)
         or ("now identified" in s)
     ):
         # freenode, oftc, arstechnica, zirc, ....
         # sorcery
         self.log.info('Received "Password accepted" from NickServ %s.', on)
         self.identified = True
         for channel in irc.state.channels.keys():
             self.checkPrivileges(irc, channel)
         for channel in self.channels:
             irc.queueMsg(networkGroup.channels.join(channel))
         waitingJoins = self.waitingJoins.pop(irc.network, None)
         if waitingJoins:
             for m in waitingJoins:
                 irc.sendMsg(m)
     elif "not yet authenticated" in s:
         # zirc.org has this, it requires an auth code.
         email = s.split()[-1]
         self.log.warning(
             'Received "Nick not yet authenticated" from '
             "NickServ %s.  Check email at %s and send the "
             "auth command to NickServ.",
             on,
             email,
         )
     else:
         self.log.debug("Unexpected notice from NickServ %s: %q.", on, s)
开发者ID:carriercomm,项目名称:Limnoria,代码行数:70,代码来源:plugin.py


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