diff --git a/src/main/java/wtf/beatrice/hidekobot/objects/MessageCommand.java b/src/main/java/wtf/beatrice/hidekobot/objects/MessageCommand.java new file mode 100644 index 0000000..9deb7d2 --- /dev/null +++ b/src/main/java/wtf/beatrice/hidekobot/objects/MessageCommand.java @@ -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); +} diff --git a/src/main/java/wtf/beatrice/hidekobot/objects/SlashCommand.java b/src/main/java/wtf/beatrice/hidekobot/objects/SlashCommand.java index 54c3251..066a10b 100644 --- a/src/main/java/wtf/beatrice/hidekobot/objects/SlashCommand.java +++ b/src/main/java/wtf/beatrice/hidekobot/objects/SlashCommand.java @@ -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); }