Move to class-based command handling
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Having everything in a single class is bad practice, so different classes for each command were made.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package wtf.beatrice.hidekobot.slashcommands;
|
||||
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import wtf.beatrice.hidekobot.Configuration;
|
||||
import wtf.beatrice.hidekobot.HidekoBot;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class DieCommand
|
||||
{
|
||||
|
||||
public DieCommand(@NotNull SlashCommandInteractionEvent event)
|
||||
{
|
||||
if(Configuration.getBotOwnerId() != event.getMember().getIdLong())
|
||||
{
|
||||
event.reply("Sorry, only the bot owner can run this command!").setEphemeral(true).queue();
|
||||
} else {
|
||||
event.reply("Going to sleep! Cya :sparkles:").queue();
|
||||
Executors.newSingleThreadScheduledExecutor().schedule(HidekoBot::shutdown, 3, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user