Libraryless. Click here for Pure Java version (4888L/32K/111K).
1 | !7 |
2 | |
3 | static S html() {
|
4 | new StringBuilder buf; |
5 | |
6 | buf.append("<html>");
|
7 | buf.append("<head><title>BotCompany Internal Bots</title></head>");
|
8 | buf.append("<body>");
|
9 | buf.append("<h3><a href=" + htmlQuote("http://BotCompany.de") + ">BotCompany.de</a> Bots</h3>");
|
10 | buf.append("<ul>");
|
11 | |
12 | O mainBot = getMainBot(); |
13 | |
14 | L<S> botsToList = litlist(getProgramID(mainBot)); |
15 | O dispatcher = getDispatcher(); |
16 | if (dispatcher != null) |
17 | botsToList.addAll((L) call(dispatcher, "getSubBotIDs")); |
18 | |
19 | L activeBots = cast get(mainBot, "activeBots"); |
20 | botsToList.addAll(activeBots); |
21 | |
22 | for (S botID : botsToList) {
|
23 | botID = formatSnippetID(botID); |
24 | S parsedID = "" + parseSnippetID(botID); |
25 | S title = "?"; |
26 | pcall { title = getSnippetTitle_cached(botID); } // TODO: free cache occasionally
|
27 | S name = botID + " - " + htmlencode(title); |
28 | buf.append("<li><a href=" + htmlQuote("/" + parsedID) + ">" + name + "</a> (");
|
29 | buf.append("<a href=" + htmlQuote("http://code.botcompany.de/" + parsedID) + ">source</a>)</li>");
|
30 | } |
31 | buf.append("</ul>");
|
32 | buf.append("<p>Hit count: " + getOpt(mainBot, "hitCount") + "</p>");
|
33 | |
34 | buf.append("<p>Last interactions:</p>");
|
35 | |
36 | pcall {
|
37 | int maxInteractionsToPrint = 10; |
38 | L<Map> history = cast get(mainBot, "history"); |
39 | |
40 | for (int i = l(history)-1; i >= 0 && i >= l(history)-maxInteractionsToPrint; i--) {
|
41 | Map m = history.get(i); |
42 | buf.append("<p>" + htmlencode(m.get("question")) + "<br> " + htmlencode(m.get("answer")) + "</p>");
|
43 | } |
44 | } |
45 | |
46 | buf.append("</body>");
|
47 | buf.append("</html>");
|
48 | ret str(buf); |
49 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1002771 |
| Snippet name: | Bots List Bot (Web) |
| Eternal ID of this version: | #1002771/5 |
| Text MD5: | b9c29e5d66cdf4493b05a1c367d8d065 |
| Transpilation MD5: | 2e10c6e08d7ce7db987024374fb1d6db |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-07-27 13:53:33 |
| Source code size: | 1650 bytes / 49 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 959 / 10141 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |