Start implementing message-base commands
All checks were successful
continuous-integration/drone/push Build is passing

Slash commands can't be used for everything, so we need something to fall back on.
This commit is contained in:
Bea 2022-11-22 14:40:44 +01:00
parent 882c695484
commit 526880e1f1
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package wtf.beatrice.hidekobot.objects;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public interface MessageCommand
{
/**
* Get the command's label, which is used when determining if this is the correct command or not.
*
* @return the command label.
*/
String getCommandName();
/**
* Run the command logic by parsing the event and replying accordingly.
*
* @param event the received message event. It should not be used for parsing message contents data as
* the arguments already account for it in a better way.
* @param args a pre-formatted list of arguments, excluding the bot prefix and the command name.
* This is useful because command logic won't have to change in case the bot prefix is changed,
* removed, or we switch to another method of triggering commands (ping, trigger words, ...).
*/
void runCommand(MessageReceivedEvent event, String[] args);
}

View File

@ -5,7 +5,18 @@ import org.jetbrains.annotations.NotNull;
public interface SlashCommand
{
/**
* Get the command's registered label, or how Discord sees and runs the registered command.
*
* @return the command label.
*/
String getCommandName();
/**
* Run the command logic by parsing the event and replying accordingly.
*
* @param event the received slash command event.
*/
void runSlashCommand(@NotNull SlashCommandInteractionEvent event);
}