Warning: session_start(): open(/var/lib/php/sessions/sess_jpoln8ect7dbn9kkfitq0jc7f0, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!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()))));
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))); }
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, firstOfPairs(bots)); }
static L knownCommands() {
ret getSupportedQuestions_multipleBots(concatLists(ll(mc()), secondOfPairs(bots)));
}
static Config config() { ret uniq_sync(Config); }