Warning: session_start(): open(/var/lib/php/sessions/sess_1vdqbq3ikbqp5g72c5q58lnekb, 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
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?";
}