Download Jar. Uses 8300K of libraries. Click here for Pure Java version (6185L/44K).
1 | !7 |
2 | |
3 | p-exp { |
4 | logModuleOutput(); |
5 | discordBot(voidfunc(MessageReceivedEvent e) { |
6 | print("Channel type: " + e.getChannelType()); |
7 | bool isPrivate = e.getChannelType() == ChannelType.PRIVATE; |
8 | print("Msg from " + e.getAuthor().getName() + ": " + e.getMessage().getContentDisplay()); |
9 | S content = e.getMessage().getContentRaw(); |
10 | if (nempty(content)) { |
11 | print("Next-to-last char: " + intToHex(nextToLastChar(content)); |
12 | print("Last char: " + intToHex(lastChar(content)); |
13 | } |
14 | new Matches m; |
15 | S s = ""; |
16 | if (isPrivate) s = content; |
17 | else if (swic(content, "gazelle", m)) s = m.rest(); |
18 | if (empty(s)) ret; |
19 | /*if (!regexpContains("^:[a-z]", s)) |
20 | s = dropLeadingPunctuation(s);*/ |
21 | s = "Bah! " + trim(s); |
22 | print("Sending: " + s); |
23 | fbool delete = ewic(content, "delete"); |
24 | e.getChannel().sendMessage(s).queue(msg -> { |
25 | if (delete) doLater(5.0, r { |
26 | msg.delete().queue(); |
27 | }); |
28 | }); |
29 | }); |
30 | } |
Began life as a copy of #1021602
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1021618 |
Snippet name: | Discord Bot Spike [v2] |
Eternal ID of this version: | #1021618/7 |
Text MD5: | 2a3682bd6c7eb8a77ab1a73b33498f58 |
Transpilation MD5: | 3b35c4cf2a21a10abfed8d137385d0d8 |
Author: | stefan |
Category: | javax / discord |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-02-22 11:27:10 |
Source code size: | 989 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 448 / 959 |
Version history: | 6 change(s) |
Referenced in: | [show references] |