!7 cmodule eeZee > DynDiscordHopper { S url = "https://4b559f3a.ngrok.io"; transient NotTooOften ntoError = notTooOften_1min(); @Override S answer(S input, Map map) { try answer super.answer(input, map); try { long time = sysNow(); S s = loadPageWithTimeout(60.0, url + 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 (cic(str, "Server returned HTTP response code: 502")) // rough ret null with print("Bot is offline (502)"); print(e); ret "Error: " + shorten(100, str); } } }
Began life as a copy of #1023928
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023940 |
Snippet name: | eeZee old [http] |
Eternal ID of this version: | #1023940/1 |
Text MD5: | 590ce88f09bf3ff1f9a632ca432b5a44 |
Author: | stefan |
Category: | javax / discord / a.i. |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-07-13 21:20:55 |
Source code size: | 752 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 225 / 248 |
Referenced in: | -