1
0
mirror of https://github.com/sciwhiz12/Janitor.git synced 2024-11-09 22:51:26 +00:00

Add pong command

This commit is contained in:
Arnold Alejo Nunag 2020-09-02 19:18:20 +08:00
parent e8c09c1a85
commit 6f901aab26
Signed by: sciwhiz12
GPG Key ID: 622CF446534317E1
2 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,8 @@ public class CommandRegistry extends BaseListener {
super(bot);
this.pattern = Pattern.compile("^" + prefix + "([A-Za-z0-9]+).*$");
addCommand("ping", new PingCommand(this));
addCommand("ping", new PingCommand(this, "Pong!"));
addCommand("pong", new PingCommand(this, "Ping!"));
addCommand("ok", new OKCommand(this));
if (bot.getConfig().getOwnerID().isPresent()) {
addCommand("shutdown", new ShutdownCommand(this, bot.getConfig().getOwnerID().get()));

View File

@ -3,12 +3,15 @@ package sciwhiz12.janitor.commands;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
public class PingCommand extends BaseCommand {
public PingCommand(CommandRegistry registry) {
private final String message;
public PingCommand(CommandRegistry registry, String message) {
super(registry);
this.message = message;
}
@Override
public void onCommand(MessageReceivedEvent event) {
event.getMessage().getChannel().sendMessage("Pong!").queue();
event.getMessage().getChannel().sendMessage(message).queue();
}
}