forked from Fascinated/Bat
add coin flip command
This commit is contained in:
parent
3615ef4b92
commit
2695a2994a
@ -3,6 +3,7 @@ package cc.fascinated.bat.features.base;
|
||||
import cc.fascinated.bat.features.Feature;
|
||||
import cc.fascinated.bat.features.FeatureProfile;
|
||||
import cc.fascinated.bat.features.base.commands.botadmin.BotAdminCommand;
|
||||
import cc.fascinated.bat.features.base.commands.fun.CoinFlipCommand;
|
||||
import cc.fascinated.bat.features.base.commands.fun.EightBallCommand;
|
||||
import cc.fascinated.bat.features.base.commands.fun.PPSizeCommand;
|
||||
import cc.fascinated.bat.features.base.commands.fun.image.ImageCommand;
|
||||
@ -47,5 +48,6 @@ public class BaseFeature extends Feature {
|
||||
super.registerCommand(commandService, context.getBean(LookupCommand.class));
|
||||
super.registerCommand(commandService, context.getBean(PPSizeCommand.class));
|
||||
super.registerCommand(commandService, context.getBean(PastebinCommand.class));
|
||||
super.registerCommand(commandService, context.getBean(CoinFlipCommand.class));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package cc.fascinated.bat.features.base.commands.fun;
|
||||
|
||||
import cc.fascinated.bat.command.BatCommand;
|
||||
import cc.fascinated.bat.command.CommandInfo;
|
||||
import cc.fascinated.bat.model.BatGuild;
|
||||
import cc.fascinated.bat.model.BatUser;
|
||||
import lombok.NonNull;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author Fascinated (fascinated7)
|
||||
*/
|
||||
@CommandInfo(
|
||||
name = "coinflip",
|
||||
description = "Flips a coin",
|
||||
userInstall = true
|
||||
)
|
||||
public class CoinFlipCommand extends BatCommand {
|
||||
@Override
|
||||
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member,
|
||||
Message commandMessage, String[] arguments, SlashCommandInteraction event) {
|
||||
event.reply("%s, you flipped a coin and got **%s**!".formatted(user.getDiscordUser().getAsMention(), flip())).queue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Flips a coin
|
||||
*
|
||||
* @return The result of the coin flip
|
||||
*/
|
||||
public String flip() {
|
||||
return new Random().nextBoolean() ? "heads" : "tails";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user