本文整理汇总了Python中oyoyo.client.IRCClient.mainLoop方法的典型用法代码示例。如果您正苦于以下问题:Python IRCClient.mainLoop方法的具体用法?Python IRCClient.mainLoop怎么用?Python IRCClient.mainLoop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oyoyo.client.IRCClient
的用法示例。
在下文中一共展示了IRCClient.mainLoop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from oyoyo.client import IRCClient [as 别名]
# 或者: from oyoyo.client.IRCClient import mainLoop [as 别名]
def main():
if not botconfig.DEBUG_MODE:
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler("errors.log")
fh.setLevel(logging.WARNING)
logger.addHandler(fh)
if botconfig.VERBOSE_MODE:
hdlr = logging.StreamHandler(sys.stdout)
hdlr.setLevel(logging.DEBUG)
logger.addHandler(hdlr)
formatter = UTCFormatter('[%(asctime)s] %(message)s', '%d/%b/%Y %H:%M:%S')
for handler in logger.handlers:
handler.setFormatter(formatter)
else:
logging.basicConfig(level=logging.DEBUG)
formatter = UTCFormatter('[%(asctime)s] %(message)s', '%H:%M:%S')
for handler in logging.getLogger().handlers:
handler.setFormatter(formatter)
cli = IRCClient(
{"privmsg":modules.common.on_privmsg,
"notice":lambda a, b, c, d: modules.common.on_privmsg(a, b, c, d, True),
"":modules.common.__unhandled__},
host=botconfig.HOST,
port=botconfig.PORT,
authname=botconfig.USERNAME,
password=botconfig.PASS,
nickname=botconfig.NICK,
sasl_auth=botconfig.SASL_AUTHENTICATION,
use_ssl=botconfig.USE_SSL,
connect_cb=modules.common.connect_callback
)
cli.mainLoop()
示例2: main
# 需要导入模块: from oyoyo.client import IRCClient [as 别名]
# 或者: from oyoyo.client.IRCClient import mainLoop [as 别名]
def main():
evt = Event("init", {})
evt.dispatch()
src.plog("Connecting to {0}:{1}{2}".format(botconfig.HOST, "+" if botconfig.USE_SSL else "", botconfig.PORT))
cli = IRCClient(
{"privmsg": lambda *s: None,
"notice": lambda *s: None,
"": handler.unhandled},
host=botconfig.HOST,
port=botconfig.PORT,
authname=botconfig.USERNAME,
password=botconfig.PASS,
nickname=botconfig.NICK,
ident=botconfig.IDENT,
real_name=botconfig.REALNAME,
sasl_auth=botconfig.SASL_AUTHENTICATION,
server_pass=botconfig.SERVER_PASS,
use_ssl=botconfig.USE_SSL,
cert_verify=var.SSL_VERIFY,
cert_fp=var.SSL_CERTFP,
client_certfile=var.SSL_CERTFILE,
client_keyfile=var.SSL_KEYFILE,
cipher_list=var.SSL_CIPHERS,
tokenbucket=TokenBucket(var.IRC_TB_BURST, var.IRC_TB_DELAY, init=var.IRC_TB_INIT),
connect_cb=handler.connect_callback,
stream_handler=src.stream,
)
cli.mainLoop()
示例3: main
# 需要导入模块: from oyoyo.client import IRCClient [as 别名]
# 或者: from oyoyo.client.IRCClient import mainLoop [as 别名]
def main():
cli = IRCClient(
{"privmsg": handler.on_privmsg,
"notice": lambda a, b, c, d: handler.on_privmsg(a, b, c, d, True),
"": handler.unhandled},
host=botconfig.HOST,
port=botconfig.PORT,
authname=botconfig.USERNAME,
password=botconfig.PASS,
nickname=botconfig.NICK,
ident=botconfig.IDENT,
real_name=botconfig.REALNAME,
sasl_auth=botconfig.SASL_AUTHENTICATION,
use_ssl=botconfig.USE_SSL,
connect_cb=handler.connect_callback,
stream_handler=src.stream,
)
cli.mainLoop()
示例4: main
# 需要导入模块: from oyoyo.client import IRCClient [as 别名]
# 或者: from oyoyo.client.IRCClient import mainLoop [as 别名]
def main():
src.plog("Connecting to {0}:{1}{2}".format(botconfig.HOST, "+" if botconfig.USE_SSL else "", botconfig.PORT))
cli = IRCClient(
{"privmsg": handler.on_privmsg,
"notice": lambda a, b, c, d: handler.on_privmsg(a, b, c, d, True),
"": handler.unhandled},
host=botconfig.HOST,
port=botconfig.PORT,
authname=botconfig.USERNAME,
password=botconfig.PASS,
nickname=botconfig.NICK,
ident=botconfig.IDENT,
real_name=botconfig.REALNAME,
sasl_auth=botconfig.SASL_AUTHENTICATION,
server_pass=botconfig.SERVER_PASS,
use_ssl=botconfig.USE_SSL,
connect_cb=handler.connect_callback,
stream_handler=src.stream,
)
cli.mainLoop()