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


Python IRCClient.msg方法代码示例

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


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

示例1: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 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,代码行数:9,代码来源:irc.py

示例2: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
    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,代码行数:33,代码来源:__init__.py

示例3: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
    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,代码行数:12,代码来源:bot.py

示例4: signedOn

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 def signedOn(self):
     password = yield self.config.get("pass")
     if password:
         IRCClient.msg(self, "NickServ","IDENTIFY {}".format(password.encode("utf8")))
     self.factory.resetDelay()
     self.factory.connection = self
     self.nick_check = LoopingCall(self.nickCheck)
     self.nick_check.start(60)
     self.channels = {}
     channels = yield self.master.modules["db"].channelList()
     for c, p in channels.items():
         self.join(u"{} {}".format(c, p) if p else c, True)
开发者ID:skiddiks,项目名称:Servrhe,代码行数:14,代码来源:irc.py

示例5: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 def msg(self, user, message, length=None):
     """
     Send a message to a channel, enforces message encoding
     """
     encoded_message = unicode(message).encode('ascii', 'ignore')
     if user.startswith('#') and not Channel(self, user).is_active():
         log.msg(
             "ERROR: Trying to send message to inactive channel %s. "
             "Message blocked!" % user
         )
     else:
         log.msg("Sending %r to %r" % (encoded_message, user))
         IRCClient.msg(self, user, encoded_message, length)
开发者ID:ojii,项目名称:bottu,代码行数:15,代码来源:irc.py

示例6: _msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 def _msg(self, target, msg, talk=False):
     msg_utf = msg.decode('utf-8')
     skip = False
     if not talk and self.re_tweets.search(msg) and target in self.filters:
         low_msg_utf = msg_utf.lower()
         for keyword in self.filters[target]:
             if keyword and ("%s" % keyword in low_msg_utf or (keyword.startswith('@') and low_msg_utf.startswith(keyword[1:]+': '))):
                 skip = True
                 reason = keyword
                 break
     if not talk and target in self.silent and self.silent[target] > datetime.today():
         skip = True
         reason = "fuckoff until %s" % self.silent[target]
     self.log(msg_utf, self.nickname, target, filtered=skip)
     if not skip:
         IRCClient.msg(self, target, msg, 450)
     elif config.DEBUG:
         try:
             loggvar("FILTERED: %s [%s]" % (str(msg), reason), target)
         except:
             print colr("ERROR encoding filtered msg", 'red'), msg, reason
             loggvar("FILTERED: %s [%s]" % (msg, reason), target)
开发者ID:kerneis,项目名称:gazouilleur,代码行数:24,代码来源:bot.py

示例7: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 def msg(self, target, message):
     log.msg('<%(nickname)s> %(message)s' %
         dict(nickname=self.nickname, message=message))
     IRCClient.msg(self, target, message)
开发者ID:lojban,项目名称:vlasisku,代码行数:6,代码来源:irc.py

示例8: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 def msg(self, channel, msg, length=None):
     """Log messages sent by the client"""
     log.msg('<%(nickname)s> %(message)s' %
             dict(nickname=self.nickname, message=msg))
     IRCClient.msg(self, channel, msg.encode("utf-8"), length)
开发者ID:lojban,项目名称:valis,代码行数:7,代码来源:protocol.py

示例9: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 def msg(self, channel, message):
     IRCClient.msg(self, channel.encode("utf8"), message.encode("utf8"))
     nick = normalize(self.nickname)
     self.dispatch("sent_message", channel, nick, message)
开发者ID:lae,项目名称:Servrhe,代码行数:6,代码来源:irc.py

示例10: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 def msg(self, channel, message):
     IRCClient.msg(self, channel.encode("utf8"), message.encode("utf8")) # _reallySendLine handles this for us
     nick = normalize(self.nickname)
     self.dispatch("sent_message", channel, nick, message)
开发者ID:skiddiks,项目名称:Servrhe,代码行数:6,代码来源:irc.py

示例11: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 def msg(self, destination, message, length=400):
     """IRCClient.msg re-implementation to split messages in 400bytes parts by default."""
     IRCClient.msg(self, destination, message, length)
开发者ID:Daroth,项目名称:fatbotslim,代码行数:5,代码来源:ircbot.py

示例12: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
    def msg(self, user, message, length=None):
        ''' Send message to user '''

        IRCClient.msg(self, user, message, length)
        echo('[IRC] You->%s: %s' % (user, message))
开发者ID:spicerack,项目名称:sage,代码行数:7,代码来源:client.py

示例13: say

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
    def say(self, channel, message, length=None):
        ''' Say to channel and echo back '''

        IRCClient.msg(self, channel, message, length)
        echo('[%s] <%s> %s' % (channel, self.nickname, message))
开发者ID:spicerack,项目名称:sage,代码行数:7,代码来源:client.py

示例14: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
	def msg(self, user, msg, length=None):
		msg = msg.encode("utf-8")
		if length:
			IRCClient.msg(self, user, msg, length)
		else:
			IRCClient.msg(self, user, msg)
开发者ID:gkistler,项目名称:pytwitchirc,代码行数:8,代码来源:twitch.py

示例15: msg

# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import msg [as 别名]
 def msg(self, to, msg):
     print('-> {0}'.format((to, msg)))
     IRCClient.msg(self, to, msg)
开发者ID:TazeTSchnitzel,项目名称:kittyskittles,代码行数:5,代码来源:main.py


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