Libraryless. Click here for Pure Java version (818L/6K/19K).
!752 static int maxQuestionLength = 150; static int maxAnswerLength = 450; answer { if "last dialogs" s = "5 last dialogs"; if "last dialog" s = "1 last dialogs"; if "* last dialogs" { int n = parseInt(m.unq(0)); L history = cast get(getMainBot(), "history"); new StringBuffer buf; int x = max(l(history)-n, 0); for (int i = l(history)-1; i >= x; i--) { O dialog = history.get(i); S q = shorten(getString(dialog, "question"), maxQuestionLength); S a = shorten(getString(dialog, "answer"), maxAnswerLength); buf.append("User: " + q + "\n"); buf.append("Eleutheria: " + a + "\n"); } ret slackSnippet(buf); } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1002468 |
| Snippet name: | Last Dialogs Bot |
| Eternal ID of this version: | #1002468/1 |
| Text MD5: | f5b3f9fdcc973d6605487f04910fa960 |
| Transpilation MD5: | c98ee9f2bb8bc2ce1e253bbfc5cca263 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-01-25 01:32:30 |
| Source code size: | 709 bytes / 25 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1080 / 1576 |
| Referenced in: | [show references] |