Remove the need to register slash commands separately
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
We modified the slash command interface to allow getting command data, and created a generic implementation of it that automatically retrieves data from the command data. The interface should not be used now. Instead, extending the implementation is preferred as it provides a semi-working command already.
This commit is contained in:
@@ -5,21 +5,25 @@ import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.CommandData;
|
||||
import net.dv8tion.jda.api.interactions.commands.build.Commands;
|
||||
import net.dv8tion.jda.api.interactions.components.ActionRow;
|
||||
import net.dv8tion.jda.api.interactions.components.buttons.Button;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import wtf.beatrice.hidekobot.Cache;
|
||||
import wtf.beatrice.hidekobot.objects.SlashCommand;
|
||||
import wtf.beatrice.hidekobot.objects.SlashCommandImpl;
|
||||
import wtf.beatrice.hidekobot.util.RandomUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CoinFlipCommand implements SlashCommand
|
||||
public class CoinFlipCommand extends SlashCommandImpl
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "coinflip";
|
||||
public CommandData getSlashCommandData()
|
||||
{
|
||||
return Commands.slash("coinflip",
|
||||
"Flip a coin and get head or tails.");
|
||||
}
|
||||
|
||||
private final Button reflipButton = Button.primary("coinflip_reflip", "Flip again")
|
||||
|
||||
Reference in New Issue
Block a user