def fleet_enable(bot, ievent): """ enable a fleet bot. """ if not ievent.rest: ievent.missing("list of fleet bots") return bots = ievent.rest.split() for name in bots: bot = fleet.byname(name) if bot: bot.cfg['enable'] = 1 bot.cfg.save() ievent.reply('enabled %s' % name) start_new_thread(fleet.connect, (name, )) elif name in fleet.avail(): bots = fleet.start([ name, ], enable=True) for bot in bots: ievent.reply('enabled and started %s bot' % name) start_new_thread(fleet.connect, (name, )) else: ievent.reply('no %s bot in fleet' % name)
def fleet_enable(bot, ievent): """ enable a fleet bot. """ if not ievent.rest: ievent.missing("list of fleet bots") return bots = ievent.rest.split() for name in bots: bot = fleet.byname(name) if bot: bot.cfg['enable'] = 1 bot.cfg.save() ievent.reply('enabled %s' % name) start_new_thread(fleet.connect, (name, )) elif name in fleet.avail(): bots = fleet.start([name, ], enable=True) for bot in bots: ievent.reply('enabled and started %s bot' % name) start_new_thread(fleet.connect, (name, )) else: ievent.reply('no %s bot in fleet' % name)
def handle_fleetavail(bot, ievent): """ show available fleet bots. """ ievent.reply('available bots: ', fleet.avail())