Libraryless. Click here for Pure Java version (4888L/32K/111K).
!7 static S html() { new StringBuilder buf; buf.append("<html>"); buf.append("<head><title>BotCompany Internal Bots</title></head>"); buf.append("<body>"); buf.append("<h3><a href=" + htmlQuote("http://BotCompany.de") + ">BotCompany.de</a> Bots</h3>"); buf.append("<ul>"); O mainBot = getMainBot(); L<S> botsToList = litlist(getProgramID(mainBot)); O dispatcher = getDispatcher(); if (dispatcher != null) botsToList.addAll((L) call(dispatcher, "getSubBotIDs")); L activeBots = cast get(mainBot, "activeBots"); botsToList.addAll(activeBots); for (S botID : botsToList) { botID = formatSnippetID(botID); S parsedID = "" + parseSnippetID(botID); S title = "?"; pcall { title = getSnippetTitle_cached(botID); } // TODO: free cache occasionally S name = botID + " - " + htmlencode(title); buf.append("<li><a href=" + htmlQuote("/" + parsedID) + ">" + name + "</a> ("); buf.append("<a href=" + htmlQuote("http://code.botcompany.de/" + parsedID) + ">source</a>)</li>"); } buf.append("</ul>"); buf.append("<p>Hit count: " + getOpt(mainBot, "hitCount") + "</p>"); buf.append("<p>Last interactions:</p>"); pcall { int maxInteractionsToPrint = 10; L<Map> history = cast get(mainBot, "history"); for (int i = l(history)-1; i >= 0 && i >= l(history)-maxInteractionsToPrint; i--) { Map m = history.get(i); buf.append("<p>" + htmlencode(m.get("question")) + "<br> " + htmlencode(m.get("answer")) + "</p>"); } } buf.append("</body>"); buf.append("</html>"); ret str(buf); }
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: | 715 / 9488 |
Version history: | 4 change(s) |
Referenced in: | [show references] |