Added /message commands by Zabuzard · Pull Request #1372 · Together-Java/TJ-Bot
Overview
This adds the slash command /message with the following subcommands:
raw, the bot shares the raw content of a given messagepost(andpost-with-message), the bot posts the given message in a channel of choice under its own nameedit(andedit-with-message), the bot edits a message previously posted under its own name
This is mostly meant for administrative purposes, for example to post official messages like announcements or also rules.
Config Changes ❗
This technically has no config changes but I tagged it so whoever does the release doesnt forget the following:
This PR adds new slashcommands that are intended for administrative use only. Discord permissions should be setup to hide these commands from regular users!
Review
Code-wise it is quite similar to the existing TagManageCommand. Structurally it starts with the setup, then helpers, then the actual flows for each subcommand and last but not least Subcommand as helper enum.
The flows themselves start with parsing their options and then have their logic. JDA makes the queuing a bit annoying as usual but should be understandable mostly. For the sake of being able to treat errors individually and abort the rest-queue in between, there are several queue(...) calls instead of a single pipeline (also see TagManageCommand which handles it in a similar way).
I havent found a fitting package, so I gave it a new one. Not super happy with that choice as its just a single file (for now) but its probably the best approach in this case.
No unit tests for now, but creating some should be relatively straightforward.
Testing impressions
raw
post
post-with-message
edit
edit-with-message
edit foreign
Attempting to edit a foreign message:







