Beispiel #1
0
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()
Beispiel #2
0
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()
Beispiel #3
0
def commands():
    """Show all installed commands."""
    import chattie.connectors.term as term
    bot = Bot('Chattie', term, get_commands())
    print(helpcmd(bot, ''))
Beispiel #4
0
 def setUp(self):
     self.bot = Bot("test", Inventory(), get_commands())