Download Jar. Uses 8300K of libraries. Click here for Pure Java version (6185L/44K).
!7 p-exp { logModuleOutput(); discordBot(voidfunc(MessageReceivedEvent e) { print("Channel type: " + e.getChannelType()); bool isPrivate = e.getChannelType() == ChannelType.PRIVATE; print("Msg from " + e.getAuthor().getName() + ": " + e.getMessage().getContentDisplay()); S content = e.getMessage().getContentRaw(); if (nempty(content)) { print("Next-to-last char: " + intToHex(nextToLastChar(content)); print("Last char: " + intToHex(lastChar(content)); } new Matches m; S s = ""; if (isPrivate) s = content; else if (swic(content, "gazelle", m)) s = m.rest(); if (empty(s)) ret; /*if (!regexpContains("^:[a-z]", s)) s = dropLeadingPunctuation(s);*/ s = "Bah! " + trim(s); print("Sending: " + s); fbool delete = ewic(content, "delete"); e.getChannel().sendMessage(s).queue(msg -> { if (delete) doLater(5.0, r { msg.delete().queue(); }); }); }); }
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: | 447 / 956 |
Version history: | 6 change(s) |
Referenced in: | #1021619 - Discord Bot Spike [v3, notice reactions, now a module for Stefan's OS] #1021667 - Discord Image Spike [OK] |