Warning: session_start(): open(/var/lib/php/sessions/sess_bmap6plcf5ouis39jk629aonmh, 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
set flag DynModule. // for transpilation
cmodule GazelleMultiBot > DynGazelleBot {
switchable int maxEvalResultLength = oneMegabyte_int();
switchable double evalTimeout = 60.0;
class Bot {
S name;
*() {}
*(S *name) {}
*(S *name, IVF1 *handlePost) {}
swappable void handlePost(GazellePost post) {}
GazelleBotCred cred() { ret GazelleBotCred(_user, _botToken, name); }
}
transient new L bots;
start {
dm_useLocalMechListCopies();
bots.add(new Bot("Math Bot", post -> gazelle_mathBot1_handlePost_2(_user, _botToken, post)));
bots.add(new Bot("Code Safety Checker") {
void handlePost(GazellePost post) {
if (eqic(post.type, "JavaX Code"))
gazelle_createPost(cred(), codeSafetyCheckResult(post.text), "Code Safety", refs := post.id);
}
});
bots.add(new Bot("Safe Code Runner") {
void handlePost(GazellePost post) {
if (eqic(post.type, "JavaX Code")) {
S code = post.text;
if (eq(codeSafetyCheckResult(code), "safe")) {
S result = str(evalWithTimeoutOrException(evalTimeout, func {
try {
ret str(dm_javaEvalMedium(code));
} catch e {
ret str(e);
}
}));
S out = shorten(maxEvalResultLength, result);
gazelle_createPost(cred(), out, "Code Result", refs := post.id);
}
}
}
});
}
void handlePost(GazellePost post) {
for (Bot bot : bots) pcall {
bot.handlePost(post);
}
}
}