Make slash commands interface and load them dynamically
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Slash commands are now loaded dynamically by implementing a SlashCommand interface and storing them in a loaded commands map.
This commit is contained in:
@@ -9,16 +9,23 @@ 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.util.RandomUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CoinFlipCommand
|
||||
public class CoinFlipCommand implements SlashCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return "coinflip";
|
||||
}
|
||||
|
||||
private final Button reflipButton = Button.primary("coinflip_reflip", "Flip again")
|
||||
.withEmoji(Emoji.fromFormatted("\uD83E\uDE99"));
|
||||
|
||||
@Override
|
||||
public void runSlashCommand(@NotNull SlashCommandInteractionEvent event)
|
||||
{
|
||||
// perform coin flip
|
||||
|
||||
Reference in New Issue
Block a user