cli.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:Chattie 作者: chasinglogic 项目源码 文件源码
def run(name, connector, inventory):
    """Run the bot.

    By default will run with the first available connector.
    """
    connectors = get_connectors()
    if len(connectors) == 0:
        print("ERROR: No available connectors!")
        os.exit(1)

    conn_pkg = connectors[0].load()
    for c in connectors:
        if c.name == connector:
            conn_pkg = c.load()

    inventories = get_inventories()
    if len(inventories) == 0:
        print("ERROR: No available inventories!")
        os.exit(1)

    for i in inventories:
        if i.name == inventory:
            inventory_pkg = i.load()

    commands = get_commands()
    print('comm', commands)
    inventory = inventory_pkg.Inventory()
    bot = Bot(name, inventory, commands)
    connector = conn_pkg.Connector(bot)
    print("Listening for messages...")
    connector.listen()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号