Warning: session_start(): open(/var/lib/php/sessions/sess_g1ra8dmtgs6m01fgb9enm2c5ks, 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 Msg {
long msgID, channelID, userID;
long date, edited; // epochSeconds
S text;
}
concept Question {
new Ref msg;
Answer acceptedAnswer;
}
concept Answer {
new Ref msg;
Question question;
}
standardBot1 Asker {
init { dbIndexing(Msg, 'msgID, Msg, 'channelID); }
allServers {
!include #1025906 // DiscordScanner
L linesAfterQuestion(Question q) {
long channelID = q.msg->channelID;
if (channelID == 0) null;
L l = conceptsWhere(Msg, +channelID);
l = takeFirst(10, sortByField date(filter(l, m -> m.date > q.msg->date)));
ret l;
}
}
processSimplified {
optPar Message msg;
optPar long channelID;
optPar long userID;
storeMsg(msg);
if null (s = dropMyPrefixOrNull(s)) null;
if "ask me something" {
S q = "Is " + random(100) + " bigger than " + random(100) + "?";
postInChannel(channelID, discordAt(userID) + " " + q, mm -> {
Msg stored = pairA(storeMsg(mm));
printStruct("New question: " + cnew Question(msg := stored));
});
null;
}
}
}