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()
评论列表
文章目录