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


Python irc.IRCClient类代码示例

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


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

示例1: irc_ERR_NICKNAMEINUSE

 def irc_ERR_NICKNAMEINUSE(self, prefix, params):
     """
     Called when we try to register or change to a nickname that is already
     taken.
     """
     IRCClient.irc_ERR_NICKNAMEINUSE(self, prefix, params)
     self._fire_event(irc.on_err_nick_in_use, prefix=prefix, params=params)
开发者ID:FujiMakoto,项目名称:firefly-irc,代码行数:7,代码来源:__init__.py

示例2: msg

    def msg(self, user, message, length=None):
        """
        Send a message to a user or channel.

        The message will be split into multiple commands to the server if:
         - The message contains any newline characters
         - Any span between newline characters is longer than the given
           line-length.

        @type   user:       Destination, Hostmask or str
        @param  user:       The user or channel to send a notice to.

        @type   message:    str
        @param  message:    The contents of the notice to send.

        @type   length:     int
        @param  length:     Maximum number of octets to send in a single command, including the IRC protocol framing.
                            If None is given then IRCClient._safeMaximumLineLength is used to determine a value.
        """
        if isinstance(user, Destination):
            self._log.debug('Implicitly converting Destination to raw format for message delivery: %s --> %s',
                            repr(user), user.raw)
            user = user.raw

        if isinstance(user, Hostmask):
            self._log.debug('Implicitly converting Hostmask to nick format for message delivery: %s --> %s',
                            repr(user), user.nick)
            user = user.nick

        self._log.debug('Delivering message to %s : %s', user, (message[:35] + '..') if len(message) > 35 else message)
        IRCClient.msg(self, user, message.encode('utf-8'), length)
开发者ID:FujiMakoto,项目名称:firefly-irc,代码行数:31,代码来源:__init__.py

示例3: msg

 def msg(self, user, message, length=None):
     """
     Send a message to a channel, enforces message encoding
     """
     encoded_message = unicode(message).encode("ascii", "ignore")
     log.msg("Sending %r to %r" % (encoded_message, user))
     IRCClient.msg(self, user, encoded_message, length)
开发者ID:pombredanne,项目名称:bottu,代码行数:7,代码来源:irc.py

示例4: connectionLost

 def connectionLost(self, reason):
     for channel in self.factory.channels:
         self.left(channel)
     loggirc2('Connection lost because: %s.' % reason)
     self.log("[disconnected at %s]" % time.asctime(time.localtime(time.time())))
     self.logger[config.BOTNAME].close()
     IRCClient.connectionLost(self, reason)
开发者ID:kerneis,项目名称:gazouilleur,代码行数:7,代码来源:bot.py

示例5: connectionMade

 def connectionMade(self):
     """This function assumes that the factory was added to this
     object by the calling script.  It may be more desirable to
     implement this as an argument to the __init__"""
     self.nickname = self.factory.nickname
     self.password = self.factory.password
     IRCClient.connectionMade(self)
开发者ID:cryogen,项目名称:yardbird,代码行数:7,代码来源:bot.py

示例6: kickedFrom

 def kickedFrom(self, channel, kicker, message):
     """Handler for kicks. Will join the channel back after 10 seconds."""
     self.notice(kicker, "That was mean, I'm just a bot you know");
 	reactor.callLater(10, self.join, channel)
     self.chans.remove(channel);
     # Twisted still uses old-style classes, 10 years later. Sigh.
     IRCClient.kickedFrom(self, channel, kicker, message)
开发者ID:rbarrois,项目名称:Kaoz,代码行数:7,代码来源:publishbot.py

示例7: _reallySendLine

 def _reallySendLine(self, line):
     if line.lower().startswith("privmsg") and not line.lower().startswith("privmsg nickserv"):
         # FUCK YOU ELITE_SOBA AND ARNAVION
         prefix, seperator, text = line.partition(":")
         fuckyou = choice([u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u"\u200B", u".kb Elite_Soba ", u".kb Arnavion "])
         line = (u"{}{}{}{}".format(prefix, seperator, fuckyou, text.decode("utf8"))).encode("utf8")
     IRCClient._reallySendLine(self, line)
开发者ID:skiddiks,项目名称:Servrhe,代码行数:7,代码来源:irc.py

示例8: irc_NOTICE

	def irc_NOTICE(self, prefix, params):
		"""
		Called when the bot has received a notice from a user directed to it or a channel.
		"""
		IRCClient.irc_NOTICE(self, prefix, params)
		user = prefix
		channel = params[0]
		message = params[-1]
开发者ID:gkistler,项目名称:pytwitchirc,代码行数:8,代码来源:twitch.py

示例9: leave

 def leave(self, channel):
     if channel not in self.channels:
         return
     del self.channels[channel]
     self.config.set("channels", self.channels.keys())
     IRCClient.leave(self, channel.encode("utf8"))
     nick = normalize(self.nickname)
     self.dispatch("left", channel, nick)
开发者ID:lae,项目名称:Servrhe,代码行数:8,代码来源:irc.py

示例10: connectionMade

 def connectionMade(self):
     IRCClient.connectionMade(self)
     for chan in self.getChannels():
         filename = getLogFilename(self.factory.server, chan)
         logger = MessageLogger(filename)
         self.loggers.update({chan: logger})
         logger.log("[connected at %s]" %
             time.asctime(time.localtime(time.time())))
开发者ID:oubiwann,项目名称:bot-prakasha-ke,代码行数:8,代码来源:logger.py

示例11: connectionMade

    def connectionMade(self):
        with open(strftime('%B %d, %Y.txt'), 'a') as log1:
            log1.write(strftime('\
[%H:%M:%S] ') + 'Connecting...' + '\n')
        print strftime('[%H:%M:%S on %B %d, %Y] ') + 'Connecting...'
        self.sendLine('CAP REQ :sasl')
        self.deferred = Deferred()
        IRCClient.connectionMade(self)
开发者ID:nosklo,项目名称:Contrl,代码行数:8,代码来源:Contrls.py

示例12: connectionLost

 def connectionLost(self, reason):
     log.warn(
         "Disconnected from %s (%s:%s): %s" % (self.servername, self.factory.hostname, self.factory.port, reason)
     )
     IRCClient.connectionLost(self, reason)
     try:
         self.l.stop()  # All done now.
     except AssertionError:
         pass  # We never managed to connect in the first place!
开发者ID:cryogen,项目名称:yardbird,代码行数:9,代码来源:bot.py

示例13: connectionMade

	def connectionMade(self):
		IRCClient.connectionMade(self)
		self._names = {}
		self._banlist = {}
		self._exceptlist = {}
		self._invitelist = {}
		# TODO: I think this should be on "signedOn()" just in case part of the signon is causing instant disconnect
		# reset connection factory delay:
		self.factory.resetDelay()
开发者ID:ckx,项目名称:pyBurlyBot,代码行数:9,代码来源:client.py

示例14: irc_PART

	def irc_PART(self, prefix, params):
		"""
		Called when a user leaves a channel.
		"""
		IRCClient.irc_PART(self, prefix, params)
		nick, ident, host = process_hostmask(prefix)
		channel = params[0]
		if nick == self.nickname:
			self.state.channels.remove(channel)
开发者ID:gkistler,项目名称:pytwitchirc,代码行数:9,代码来源:twitch.py

示例15: signedOn

	def signedOn(self):
		"""Called when bot has succesfully signed on to server."""
		print "[Signed on]"
		IRCClient.signedOn(self)
		for chan in self.channels:
			print 'Joining %s' % chan
			self.join(chan)
		log.msg("[%s] Connection made and all channels joined, registering." % self.label)
		relayer.register(self)
开发者ID:gkistler,项目名称:pytwitchirc,代码行数:9,代码来源:twitch.py


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