コード例 #1
0
ファイル: cli.py プロジェクト: zeroBitOfDiff/Chattie
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 = None
    for c in connectors:
        if c.name == connector:
            conn_pkg = c.load()

    if conn_pkg is None:
        conn_pkg = connectors[0].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()
    inventory = inventory_pkg.Inventory()
    bot = Bot(name, inventory, commands)
    connector = conn_pkg.Connector(bot)
    print("Listening for messages...")
    connector.listen()
コード例 #2
0
ファイル: cli.py プロジェクト: barleyj/Chattie
def run(name, connector):
    """Run the bot.

    By default will run with the first available connector.
    """
    conn = None
    available = get_connectors()
    for c in available:
        if c.name == connector:
            conn = c.load()

    commands = get_commands()
    print('comm', commands)
    bot = Bot(name, conn, commands)
    bot.run()
コード例 #3
0
ファイル: cli.py プロジェクト: zeroBitOfDiff/Chattie
def doc(connector_name):
    """View the doc for the given connector."""
    connectors = get_connectors()
    for c in connectors:
        if c.name == connector_name:
            print(getdoc(c.load()))
コード例 #4
0
ファイル: cli.py プロジェクト: zeroBitOfDiff/Chattie
def connectors():
    """Show all installed connectors."""
    connectors = get_connectors()
    for c in connectors:
        print(c.name)