!7 concept Config { new L bots; // contains program IDs } static new L> bots; // pair(program ID, main class) p { db(); loadBots(); } svoid loadBots { cleanUpAndClear(bots); for (S bot : config().bots) bots.add(pair(bot, run(bot))); } answer { lock dbLock(); if "add bot *" { S id = formatSnippetID($1); bots.remove(id); bots.add(0, id); loadBots(); ret "OK"; } if "remove bot *" { S id = formatSnippetID($1); bots.remove(id); loadBots(); ret "OK"; } if "list bots" ret structForUser(config().bots); try answer scanMultipleBots(bots); } static Config config() { ret uniq_sync(Config); }