!7 static Pair text2tag, tag2answer; static SS text2tag_symbols; static new ThreadLocal session; static ThreadLocal> buttons = new ThreadLocal; static Map spellMap; static L countries; concept Session { S cookie; Double lastDollarValue; S lastQuestion; } sbool debug; svoid setSession(S cookie) { session.set(uniq_sync(Session, +cookie)); } svoid clearSession(S cookie) { deleteConcepts(Session, +cookie); } p { db(); // load stuff spellMap = loadSpellList(#1008389); veryBigConsole(); bot(); } sS returnQuestion(S q) { cset(session!, lastQuestion := q); ret q; } sS answer(S s) { if (session! == null) setSession("default"); buttons.set(null); if (creator() == null) if "debug" set debug; S lq = session->lastQuestion; cset(session!, lastQuestion := null); if (eq(lq, "Would you like some tea?")) { if "yes" ret "Here's your tea."; if "no" ret "Very well then."; } if "test buttons" { buttons.set(ll("Yes", "No")); ret returnQuestion("Would you like some tea?"); } S _s = s; s = levenAttract(spellMap, s); if (neqic(s, _s)) print("Spell-correct => " + s); ret "Sorry, I didn't understand that"; } sS initialMessage() { ret "Stefan's Hypercube Bot here. What's up?"; }