Warning: session_start(): open(/var/lib/php/sessions/sess_fac1q9u14gnflgued9qi43r9d9, 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 eeZee > DynDiscordHopper {
switchable S url = "tcp://0.tcp.ngrok.io:16892";
switchable S httpURL = "https://55392290.ngrok.io";
transient S prefix = "<@599426196647706645> ";
transient S drbPrefix = "<@599426196647706645> drb ";
transient L authorizedUsers = ll(463778175432785932);
transient NotTooOften ntoError = notTooOften_1min();
@Override S answer(S input, Map map) {
try answer super.answer(input, map);
new Matches m;
long userID = getLong userID(map);
print("User ID: " + userID);
if (contains(authorizedUsers, userID)
&& swic_trim(input, prefix + "set url ", m)) {
setField(httpURL := m.rest());
ret "URL set to " + httpURL + ", master";
}
long time = sysNow();
S s;
try {
if (startsWith_trim(input, drbPrefix, m)) {
input = m.rest();
temp DialogIO io = talkToTCPURL(url);
io.sendLine(trim(firstLine(input)));
new LS lines;
while (addUnlessNull(lines, io.readLine()) != null);
s = lines_rtrim(lines);
} else
s = loadPageWithTimeout(60.0, httpURL + hquery(message := input));
print("Got " + (s == null ? "timeout" : nChars(s)) + " in " + elapsedSeconds(time) + " s");
ret s;
} catch e {
if (!ntoError.yo()) null;
S str = exceptionToStringShort(e);
if (cicOneOf(str, "Server returned HTTP response code: 502",
"FileNotFoundException")) // rough
ret null with print("Bot is offline (502/404)");
print(e);
ret "Error: " + shorten(100, str);
}
}
}