Start implementing message-base commands
All checks were successful
continuous-integration/drone/push Build is passing
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:
parent
882c695484
commit
526880e1f1
@ -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);
|
||||||
|
}
|
@ -5,7 +5,18 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public interface SlashCommand
|
public interface SlashCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Get the command's registered label, or how Discord sees and runs the registered command.
|
||||||
|
*
|
||||||
|
* @return the command label.
|
||||||
|
*/
|
||||||
String getCommandName();
|
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);
|
void runSlashCommand(@NotNull SlashCommandInteractionEvent event);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user