本文整理汇总了Python中twisted.words.protocols.irc.IRCClient.connectionMade方法的典型用法代码示例。如果您正苦于以下问题:Python IRCClient.connectionMade方法的具体用法?Python IRCClient.connectionMade怎么用?Python IRCClient.connectionMade使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.words.protocols.irc.IRCClient
的用法示例。
在下文中一共展示了IRCClient.connectionMade方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
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)
示例2: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
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)
示例3: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
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())))
示例4: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
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)
示例5: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
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()
示例6: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
def connectionMade(self):
print "Connection made", self.transport
self.factory.connection = self
IRCClient.connectionMade(self)
if self.factory.queued:
for channel, message in self.factory.queued:
self.send(channel, message)
self.factory.queued = []
self.userData = {}
示例7: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
def connectionMade(self):
"""called when a connection is initiated."""
self.nickname = self.factory.config.nickname
self.password = None if (self.factory.config.srv_pass=='') else self.factory.config.srv_pass
self.versionName = self.factory.config.versionName
self.versionNum = self.factory.config.versionNum
self.realname = self.versionName
self.username = self.versionName
self.userinfo = "%s v%s" % (self.versionName, self.versionNum)
self.pingSelfId = None
self.initPlugins()
IRCClient.connectionMade(self)
示例8: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
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.deferred = Deferred()
IRCClient.connectionMade(self)
示例9: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
def connectionMade(self):
"""Handler for post-connection event.
Send all queued messages.
"""
logger.info(u"connection made to %s", self.transport)
self.factory.connection = self
# Twisted still uses old-style classes, 10 years later. Sigh.
IRCClient.connectionMade(self)
while self.factory.queue:
channel, message = self.factory.queue.popleft()
self.send(channel, message)
示例10: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
def connectionMade(self):
IRCClient.connectionMade(self)
self.shet = ShetClient()
self.shet.install()
self.shet.root = self.root
# Channel monitoring actions
self.on_action = self.shet.add_event("on_action")
self.on_say = self.shet.add_event("on_say")
self.on_join = self.shet.add_event("on_join")
self.on_quit = self.shet.add_event("on_quit")
# This bot can be controlled over SHET
self.shet.add_action(self.bot_path + "say", self.shet_say)
self.shet.add_action(self.bot_path + "say_to", self.shet_say_to)
self.shet.add_action(self.bot_path + "action", self.shet_describe)
self.shet.add_action(self.bot_path + "pm", self.shet_pm)
self.shet.add_action(self.bot_path + "pm_action", self.shet_pm_describe)
# Can listen to bot's PMs
self.on_bot_pm = self.shet.add_event(self.bot_path + "on_pm")
self.on_bot_pm_action = self.shet.add_event(self.bot_path + "on_pm_action")
# User monitoring/contacting
for user in self.user_paths:
path = self.user_paths[user]
user_events = {}
self.user_events[user] = user_events
# Ways to contact the user (via the bot)
self.shet.add_action(path + "bot_say_to", self.get_say_to_fn(user))
self.shet.add_action(path + "bot_pm_to", self.get_pm_to_fn(user))
# User's channel events
user_events["on_join"] = self.shet.add_event(path + "on_join")
user_events["on_quit"] = self.shet.add_event(path + "on_quit")
user_events["on_say"] = self.shet.add_event(path + "on_say")
user_events["on_action"] = self.shet.add_event(path + "on_action")
# Events other can people trigger related to the user
user_events["on_mention"] = self.shet.add_event(path + "on_mention")
user_events["on_address"] = self.shet.add_event(path + "on_address")
# User interractions with the bot
user_events["on_mention_bot"] = self.shet.add_event(path + "on_mention_bot")
user_events["on_address_bot"] = self.shet.add_event(path + "on_address_bot")
user_events["on_pm_bot"] = self.shet.add_event(path + "on_pm_bot")
user_events["on_pm_action_bot"] = self.shet.add_event(path + "on_pm_action_bot")
示例11: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
def connectionMade(self):
IRCClient.connectionMade(self)
echo('IRC: Connected')
示例12: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
def connectionMade(self):
self.sendLine('CAP REQ :sasl')
self.deferred = Deferred()
IRCClient.connectionMade(self)
示例13: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
def connectionMade( self ):
IRCClient.connectionMade( self )
log.info( " Bot connection made")
示例14: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
def connectionMade(self):
self.connected = True
IRCClient.connectionMade(self)
nick = yield self.config.get("nick", "ServrheV4")
self.register(nick.encode("utf8"))
self.dispatch("connected")
示例15: connectionMade
# 需要导入模块: from twisted.words.protocols.irc import IRCClient [as 别名]
# 或者: from twisted.words.protocols.irc.IRCClient import connectionMade [as 别名]
def connectionMade(self):
self.nickname = self.factory.nickname
IRCClient.connectionMade(self)
self.factory.connection = self