Warning: session_start(): open(/var/lib/php/sessions/sess_n0jpun61h0top3l8jid3lm62g9, 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
cmodule Gazelle2 > DynDiscordHopper {
S myName = "Gazelle";
@Override S answer(S s, Map map) {
new Matches m;
long ch = getLong channelID(map);
long userID = getLong userID(map);
s = simpleSpaces_javaTok(s);
if "what's your name" ret myName;
if (swic_trim(s, myName + ", show me ", m)) {
iAmTyping(map);
S query = m.rest();
BufferedImage img = quickVisualize(query);
if (img == null) ret "No image found, sorry!";
postImage(map, uploadToImageServer(img, query));
null;
}
if (swic_trim(s, myName + ", look up ", m)) {
if (isSingleWord($1))
try answer wordNet_pretty($1);
ret ":cry: I don't know";
}
if (ellipsisToDotStarRegexpFindIC("days...year", collapse(s)))
ret nDays(daysUntilEndOfYear()) + " till end of year";
S content = s;
try {
if (swicOneOf(content, "!eval ", "!fresh ", "!real-eval", "!safe-eval ") || eqic(content, "!fresh")) {
O safetyCheck = null;
bool authed = dm_discord_userCanEval(userID);
if (swic_trim(content, "!safe-eval ", m)) {
content = "!eval " + m.rest();
authed = false;
}
/*if (regexpMatches("![a-z\\-]+\\s+again", content)) {
GazelleLine last = dm_discord_nextToLastEvalByUser(userID);
if (last == null) ret "No last eval found";
content = replaceSuffix("again", afterSpace(last.text), content);
}*/
if (!authed)
safetyCheck = botEval_strictSafetyCheck();
iAmTyping(map);
ret with dm_bot_execEvalCmd(voidfunc(S s) {
if (s != null)
postInChannel(ch, shorten(ifEmpty(s, [[""]]), 1000))
}, content, +safetyCheck);
}
} catch print error {
postInChannel(ch, exceptionToStringShort(error));
}
ret super.answer(s, map);
}
}