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

Python irc.IRCClient类代码示例

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

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



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


示例16: ctcpQuery

    def ctcpQuery(self, user, channel, messages):
        """
        Dispatch method for any CTCP queries received.

        Duplicated CTCP queries are ignored and no dispatch is
        made. Unrecognized CTCP queries invoke L{IRCClient.ctcpUnknownQuery}.
        """
        self._fire_event(irc.on_ctcp, user=Hostmask(user), channel=channel, messages=messages)
        IRCClient.ctcpQuery(self, user, channel, messages)
开发者ID:FujiMakoto,项目名称:firefly-irc,代码行数:9,代码来源:__init__.py


示例17: irc_JOIN

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


示例18: leave

 def leave(self, channel):
     if channel not in self.channels:
         return
     del self.channels[channel]
     IRCClient.leave(self, channel.encode("utf8"))
     nick = normalize(self.nickname)
     self.dispatch("left", channel, nick)
     c, p, ac = yield self.master.modules["db"].channelGet(channel)
     yield self.master.modules["db"].channelSet(c, p, False)
开发者ID:skiddiks,项目名称:Servrhe,代码行数:9,代码来源:irc.py


示例19: connectionMade

    def connectionMade(self):
        self.nickname = self.factory.nick
        self.password = self.factory.password
        self.talkre = re.compile('^%s[>:,] (.*)$' % self.nickname)

        self.executionLock = threading.Semaphore()
        self.pingSelfId = None

        IRCClient.connectionMade(self)
开发者ID:AlanBell,项目名称:Supybot-plugins,代码行数:9,代码来源:fschfsch.py


示例20: msg

    def msg(self, channel, message, log, length=None):
        """ Sends ``message`` to ``channel``.

        Depending on ``log``, the message will be logged or not.

        Do not use this method from plugins, use :meth:`lala.util.msg` instead."""
        if log:
            self.factory.logger.info("%s: %s" % (self.nickname, message))
        message = message.rstrip().encode("utf-8")
        IRCClient.msg(self, channel, message, length)
开发者ID:Nyomancer,项目名称:lala,代码行数:10,代码来源:bot.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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