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


Python Bot.join方法代码示例

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


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

示例1: main

# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import join [as 别名]
def main():
    global bot
    bot = Bot("irc.freenode.net", "mydemobot")
    bot.load_plugin("debug")  # FIXME
    bot.load_plugin("monitor")
    monitor = bot.plugins["monitor"]
    bot.run(stop_conditions=[lambda: monitor.welcome_received])
    bot.load_plugin("seen")
    # bot.load_plugin( "nickserv" )
    # nickserv = bot.plugins["nickserv"].module
    # nickserv.NICKSERV_ACCOUNTS[ ("irc.freenode.net","[email protected]") ] \
    # 	= ("mydemobot","74cOpEtGN8")
    bot.join("#mytestchannel")
    bot.load_plugin("quiz")
    quiz = bot.plugins["quiz"].module
    quiz.QUIZ_CHANNELS.append("#mytestchannel")
    quiz.reload_quizdata(".*\.de")
    bot.load_plugin("fun")
    bot.load_plugin("wikipedia")
    while True:
        bot.run(stop_conditions=[lambda: not bot.connection.connected])
        bot.reconnect()
        bot.run(stop_conditions=[lambda: monitor.welcome_received])
        bot.rejoin()
        bot.reinit_plugins()
开发者ID:syslock,项目名称:sozphobine,代码行数:27,代码来源:demo.py

示例2: main

# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import join [as 别名]
def main():
    # Handle configurations
    home_path = os.path.join(os.path.expanduser("~"), ".irk")
    config_path = os.path.join(home_path, "config")

    client_config_file = os.path.join(config_path, "client.conf")
    bot_config_file = os.path.join(config_path, "bot.conf")

    if not os.path.exists(home_path):
        os.mkdir(home_path)

    if not os.path.exists(config_path):
        os.mkdir(config_path)

    if not os.path.exists(client_config_file):
        client_config = config.interactive_build_config(default_client_config)
        config.save_config(client_config_file, client_config)
    else:
        client_config = config.load_config(client_config_file)

    if not os.path.exists(bot_config_file):
        bot_config = config.interactive_build_config(default_bot_config)
        config.save_config(bot_config_file, bot_config)
    else:
        bot_config = config.load_config(bot_config_file)

    # Retroactively patch home_path into configurations.
    client_config['home_path'] = home_path
    bot_config['home_path'] = home_path

    client_proc = Client(client_config)
    bot_proc = Bot(bot_config)
    client_proc.connect_queues(bot_proc)

    client_proc.start()
    bot_proc.start()

    client_proc.join()
    bot_proc.join()
开发者ID:GRAYgoose124,项目名称:irk-new,代码行数:41,代码来源:__main__.py

示例3: range

# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import join [as 别名]
#!/usr/bin/python

from bot import Bot

if __name__ == "__main__":

    bots = []

    for i in range(0, 20):
        b = Bot(ip)
        b.start()

        bots.append(b)

    for b in bots:
        b.join()
开发者ID:jon-stewart,项目名称:mud,代码行数:18,代码来源:stress_test.py

示例4: main

# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import join [as 别名]
def main():
    DIR = os.path.join(os.path.dirname(__file__), "botTest")
    TOCKEN_PATH = os.path.join(DIR, "token")
    LOGGING_PATH = os.path.join(os.path.join(os.path.dirname(__file__), "logs"), "config.json")
    PRIVATE_KEY_PATH = os.path.join(DIR, "private.key")
    PUBLIC_KEY_PATH = os.path.join(DIR, "public.pem")
    purge, webhook_url, install = parse()
    if install != None:
        if not os.path.exists(DIR):
            os.mkdir(DIR)
        with open(TOCKEN_PATH, "w") as f:
            f.write(install + "\n")
        print("End installing")
        return

    if os.path.exists(LOGGING_PATH):
        with open(LOGGING_PATH, "rt") as f:
            config = json.load(f)
        logging.config.dictConfig(config)
    else:
        logging.basicConfig(level=logging.DEBUG)

    with open(TOCKEN_PATH, "r") as f:
        token = f.readline()[:-1]
    bot = Bot(token, DIR)
    if purge:
        bot.purge()
        return
    server = None
    if webhook_url:
        if not os.path.exists(PUBLIC_KEY_PATH):
            print("No public key, please run ssl.sh before !")
            return
        if not os.path.exists(PRIVATE_KEY_PATH):
            print("No private key, please run ssl.sh before !")
            return
        server = WebHookServer(bot, PUBLIC_KEY_PATH, PRIVATE_KEY_PATH, webhook_url)
    else:
        server = PollingServer(bot)
    print("### Start bot...")
    bot.start()
    print("### Bot started")
    print("### Start server...")
    server.start()
    print("### Server started")
    try:
        while True:
            time.sleep(60 * 60)
    except KeyboardInterrupt:
        pass
    print("### Stop server...")
    server.stop()
    print("### Server stopped")
    print("### Stop bot...")
    bot.stop()
    print("### Bot stopped")
    print("### Join server...")
    server.join()
    print("### Server joined")
    print("### Join bot...")
    bot.join()
    print("### Bot joined")
    print("### End of main")
开发者ID:mamaddeveloper,项目名称:teleadmin,代码行数:65,代码来源:main.py


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