sclass BakedBot { VirtualMechLists lists = new SimpleMechLists; Class bot; *(VirtualMechLists *lists) { _init(); } *() { _init(); } void _init { bot = hotwireDependentSharingClasses(#1017706, VirtualMechLists); setOpt(bot, mechLibID := null); //lists.verbose = true; setLists(lists); runMain(bot); } S answer(S s) { ret unnull(callAnswerMethod(bot, s)); } S check(S input, S expectedOutput) { ret assertEqualsVerbose_match(unnull(expectedOutput), answer(print("> ", input))); } bool pcheck(S input, S expectedOutput) { pcall-short { check(input, expectedOutput); true; } false; } bool pcheckOrPrintLog(S input, S expectedOutput) { if (pcheck(input, expectedOutput)) true; ret false with printLines((LS) getOpt(getBot('TelegramFactsBot), 'checkingLog)); } void setList(S name, S text) { lists.setText(name, text); } S getList(S name) { ret lists.mL_raw(name); } void setAuthorized(bool b) { setOpt(bot, authorized := b); } S answerAuthed(S s) { final bool authedOld = isTrue(getOpt(bot, 'authorized)); setAuthorized(true); tempAfterwards(r { setAuthorized(authedOld); }); ret answer(s); } void setLists(VirtualMechLists lists) { this.lists = lists; setAll(callOpt(bot, 'mechMode), readMode := lists, writeMode := lists); } O getBot(S shortClassName) { ret firstWithShortClassName((L) get(bot, 'bots), shortClassName); } }