Warning: session_start(): open(/var/lib/php/sessions/sess_649tblua7176on1boe9o2vmfsk, 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
sS mechLibID = #1400124;
static O onOutput; // VF1
static L bots;
abstract sclass AbstractThinkBot {
transient VF1 super S> postMessage;
transient new L recentHistory;
abstract void thinkAbout(S input);
void postMessage(S s) {
callF(postMessage, s);
}
}
p {
mech_useLibrary(mechLibID);
L> classes = botClasses();
print("Have think classes: " + classNames(classes));
makeBots();
bot();
}
static L> botClasses() {
ret myNonAbstractClassesImplementing(AbstractThinkBot);
}
svoid makeBots() {
bots = map nuWithoutArguments(botClasses());
}
sS answer(S s) {
new L output;
for (AbstractThinkBot bot : bots) pcall {
bot.postMessage = voidfunc(S s) {
print(">> " + s);
pcallF(onOutput, s);
output.add(s);
}
temp tempSetThreadLocal(telegram_msg_tl(), new Map);
bot.thinkAbout(s);
}
ret rtrim(lines(output));
}