本文整理汇总了Python中oyoyo.client.IRCClient.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python IRCClient.__init__方法的具体用法?Python IRCClient.__init__怎么用?Python IRCClient.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oyoyo.client.IRCClient
的用法示例。
在下文中一共展示了IRCClient.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from oyoyo.client import IRCClient [as 别名]
# 或者: from oyoyo.client.IRCClient import __init__ [as 别名]
def __init__(self, logchannel=None, **kwargs):
"""Uses PanHandler automatically."""
IRCClient.__init__(self, PanHandler, **kwargs)
print
"Successfully created", self
self.channels = IRCDict()
self.db = MongoClient(document_class=SON).mzpn
self.logchan = logchannel
示例2: ConfigException
# 需要导入模块: from oyoyo.client import IRCClient [as 别名]
# 或者: from oyoyo.client.IRCClient import __init__ [as 别名]
conf_yaml['channels'],
twitters)
except KeyError, e:
raise ConfigException('"%s" key missing in file: "%s"' % (e.args[0], conf_file))
# Instantiate twitter API instances
twitter_apis = {}
for twitter in twitters:
twitter_apis[twitter.username] = twitter_mod.Api(consumer_key=twitter.cons_key,
consumer_secret=twitter.cons_secret,
access_token_key=twitter.token_key,
access_token_secret=twitter.token_secret)
self.twitter_apis = twitter_apis
# Call super init
IRCClient.__init__(self, BotHandler, host=self.config.host, port=self.config.port,
nick=self.config.nick, connect_cb=self.connect_cb)
def connect_cb(self, unusued_cli):
for channel in self.config.channels:
helpers.join(self, channel)
class BotHandler(DefaultCommandHandler):
def privmsg(self, prefix, chan, msg):
# Check for !tweet command
match = re.match('\!tweet (.*)', msg)
if match:
status = match.group(1).strip()
for twitter in self.client.config.twitters:
if twitter.channel == chan: