Added dreidel command
This commit is contained in:
parent
2ed96e2b3e
commit
0350e3e935
|
@ -83,6 +83,7 @@ public class Kiafumi {
|
||||||
activeCommands.add(new MusicCommand());
|
activeCommands.add(new MusicCommand());
|
||||||
activeCommands.add(new FightCommand());
|
activeCommands.add(new FightCommand());
|
||||||
activeCommands.add(new SeptemberDateCommand());
|
activeCommands.add(new SeptemberDateCommand());
|
||||||
|
activeCommands.add(new DreidelCommand());
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
||||||
|
|
59
src/main/java/moe/oko/Kiafumi/command/DreidelCommand.java
Normal file
59
src/main/java/moe/oko/Kiafumi/command/DreidelCommand.java
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
package moe.oko.Kiafumi.command;
|
||||||
|
|
||||||
|
import moe.oko.Kiafumi.util.CommandInfo;
|
||||||
|
import moe.oko.Kiafumi.util.CommandType;
|
||||||
|
import moe.oko.Kiafumi.util.EmbedUI;
|
||||||
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
|
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class DreidelCommand extends CommandClass{
|
||||||
|
private boolean enabled = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() { return enabled; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() { return "Dreidel"; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void newCommand(String name, SlashCommandInteractionEvent e) {
|
||||||
|
if ("dreidel".equals(name)) {
|
||||||
|
List<String> sides= new ArrayList<>();
|
||||||
|
sides.add("Nun");
|
||||||
|
sides.add("Gimmel");
|
||||||
|
sides.add("Hay");
|
||||||
|
sides.add("Shin");
|
||||||
|
e.deferReply().queue();
|
||||||
|
EmbedBuilder eb = new EmbedBuilder()
|
||||||
|
.setColor(EmbedUI.INFO)
|
||||||
|
.setTitle("Spinning...")
|
||||||
|
.setDescription("*brrrrrrrrrrrrrr*")
|
||||||
|
.setFooter(EmbedUI.BRAND)
|
||||||
|
.setTimestamp(ZonedDateTime.now());
|
||||||
|
e.getHook().sendMessageEmbeds(eb.build()).queue();
|
||||||
|
Random rand = new Random();
|
||||||
|
String result = sides.get(rand.nextInt(sides.size()));
|
||||||
|
EmbedBuilder eb1 = new EmbedBuilder()
|
||||||
|
.setColor(EmbedUI.INFO)
|
||||||
|
.setTitle("You rolled...")
|
||||||
|
.setDescription(result + "!")
|
||||||
|
.setFooter(EmbedUI.BRAND)
|
||||||
|
.setTimestamp(ZonedDateTime.now());
|
||||||
|
e.getHook().editOriginalEmbeds(eb1.build()).completeAfter(3, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CommandInfo> getSlashCommandInfo() {
|
||||||
|
List<CommandInfo> si = new ArrayList<>();
|
||||||
|
CommandInfo ci = new CommandInfo("dreidel", "Spins a dreidel!", CommandType.COMMAND);
|
||||||
|
si.add(ci);
|
||||||
|
return si;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue