!7 concept Config { new L bots; /* contains program IDs */ } static new L> bots; // pair(program ID, main class) p-subst { db(); loadBots(); botSleep(); } svoid loadBots { cleanUpAndClear(bots); for (S bot : config().bots) bots.add(pair(bot, runSubBot(bot))); } answer { lock dbLock(); if "add bot *" { setAddOrMoveToFront(config().bots, formatSnippetID($1)); loadBots(); ret "OK"; } if "remove bot *" { config().bots.remove(formatSnippetID($1)); loadBots(); ret "OK"; } if "list bots" ret sfu(config().bots); try answer scanMultipleBots(map(f second, bots), s); } static Config config() { ret uniq_sync(Config); }