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


Python Bot.stop方法代码示例

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


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

示例1: open

# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import stop [as 别名]
import yaml
import asyncio
import logging

from bot import Bot

if __name__ == '__main__':
    with open('config.yml', 'r') as yml_file:
        config = yaml.load(yml_file)

    # logging.basicConfig(level=logging.DEBUG)

    event_loop = asyncio.get_event_loop()
    bot = Bot(event_loop, config)
    try:
        event_loop.run_until_complete(bot.run())
    except KeyboardInterrupt:
        event_loop.run_until_complete(bot.stop())
开发者ID:City-of-Helsinki,项目名称:helbot,代码行数:20,代码来源:start.py

示例2: Bot

# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import stop [as 别名]
import time
from bot import Bot
import settings
import defaults


################
## DEFAULT BOT ## (You can create multiple bots with different settings)
################

bot = Bot(defaults.algorithm, defaults.pair)
bot.start()
print bot._trade
bot.stop()
print bot._trade
开发者ID:FrancescoA,项目名称:BitcoinBot,代码行数:17,代码来源:main.py

示例3: main

# 需要导入模块: from bot import Bot [as 别名]
# 或者: from bot.Bot import stop [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.stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。