Complete message command parser and listener
All checks were successful
continuous-integration/drone/push Build is passing
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:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user