Complete message command parser and listener
All checks were successful
continuous-integration/drone/push Build is passing

The message command listener is now completed and the bot now also supports message-based commands with multiple aliases.
This commit is contained in:
2022-11-22 16:19:08 +01:00
parent 501b1bc71c
commit a9790b3525
10 changed files with 244 additions and 81 deletions

View File

@@ -0,0 +1,29 @@
package wtf.beatrice.hidekobot.commands.message;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import wtf.beatrice.hidekobot.objects.MessageCommand;
import java.util.Arrays;
import java.util.LinkedList;
public class HelloCommand implements MessageCommand
{
@Override
public LinkedList<String> getCommandLabels() {
return new LinkedList<>(Arrays.asList("hi", "hello", "heya"));
}
@Override
public boolean passRawArgs() {
return false;
}
@Override
public void runCommand(MessageReceivedEvent event, String label, String[] args)
{
String senderId = event.getMessage().getAuthor().getId();
event.getMessage().reply("Hi, <@" + senderId + ">! :sparkles:").queue();
}
}