!7 concept Config { new L bots; /* contains program IDs */ } static L> bots = synchroList(); // pair(program ID, main class) static JList lCommands, lBots; p-subst { db(); loadBots(); if (isMainProgram()) { swing { addToWindowSplitRight_aggressive(consoleFrame(), jvsplit( withMargin(withCenteredTitle("Bots", lBots = jlist())), withMargin(withCenteredTitle("Commands", lCommands = jlist_dragEnabled())))); awtCalcEvery(lBots, 1000, f updateBotsList); centerConsole(600, 600); } updateCommandList(); focusConsole(); botSleep(); } } svoid loadBots { cleanUpAndClear(bots); for (S x : config().bots) bots.add(pair(x, runSubBot(x))); updateCommandList(); } answer { lock dbLock(); if "add bot *" { setAddOrMoveToFront(config().bots, formatSnippetID($1)); config().change(); loadBots(); ret "OK"; } if "remove bot *" { config().bots.remove(formatSnippetID($1)); config().change(); loadBots(); ret "OK"; } if "list bots" ret sfu(config().bots); try answer scanMultipleBots(secondOfPairs(bots), s); } svoid updateCommandList { fillListWithStrings(lCommands, knownCommands()); } svoid updateBotsList { fillListWithStrings(lBots, snippetsWithTitles(firstOfPairs(bots))); } static L knownCommands() { ret getSupportedQuestions_multipleBots(concatLists(ll(mc()), secondOfPairs(bots))); } static Config config() { ret uniq_sync(Config); }