mirror of
https://github.com/sciwhiz12/Janitor.git
synced 2024-11-12 23:51:25 +00:00
Add pong command
This commit is contained in:
parent
e8c09c1a85
commit
6f901aab26
|
@ -22,7 +22,8 @@ public class CommandRegistry extends BaseListener {
|
||||||
super(bot);
|
super(bot);
|
||||||
this.pattern = Pattern.compile("^" + prefix + "([A-Za-z0-9]+).*$");
|
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));
|
addCommand("ok", new OKCommand(this));
|
||||||
if (bot.getConfig().getOwnerID().isPresent()) {
|
if (bot.getConfig().getOwnerID().isPresent()) {
|
||||||
addCommand("shutdown", new ShutdownCommand(this, bot.getConfig().getOwnerID().get()));
|
addCommand("shutdown", new ShutdownCommand(this, bot.getConfig().getOwnerID().get()));
|
||||||
|
|
|
@ -3,12 +3,15 @@ package sciwhiz12.janitor.commands;
|
||||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
|
||||||
public class PingCommand extends BaseCommand {
|
public class PingCommand extends BaseCommand {
|
||||||
public PingCommand(CommandRegistry registry) {
|
private final String message;
|
||||||
|
|
||||||
|
public PingCommand(CommandRegistry registry, String message) {
|
||||||
super(registry);
|
super(registry);
|
||||||
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCommand(MessageReceivedEvent event) {
|
public void onCommand(MessageReceivedEvent event) {
|
||||||
event.getMessage().getChannel().sendMessage("Pong!").queue();
|
event.getMessage().getChannel().sendMessage(message).queue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user