From d824f957fe3aed4186e73d140d15861e54f70fa3 Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 29 Jun 2024 13:23:05 +0100 Subject: [PATCH] add vote command --- .../bat/command/impl/general/VoteCommand.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/main/java/cc/fascinated/bat/command/impl/general/VoteCommand.java diff --git a/src/main/java/cc/fascinated/bat/command/impl/general/VoteCommand.java b/src/main/java/cc/fascinated/bat/command/impl/general/VoteCommand.java new file mode 100644 index 0000000..cf448fe --- /dev/null +++ b/src/main/java/cc/fascinated/bat/command/impl/general/VoteCommand.java @@ -0,0 +1,36 @@ +package cc.fascinated.bat.command.impl.general; + +import cc.fascinated.bat.command.BatCommand; +import cc.fascinated.bat.command.CommandInfo; +import cc.fascinated.bat.common.EmbedUtils; +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.channel.middleman.MessageChannel; +import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction; +import org.springframework.stereotype.Component; + +/** + * @author Fascinated (fascinated7) + */ +@Component +@CommandInfo(name = "vote", description = "Vote for the bot", guildOnly = false) +public class VoteCommand extends BatCommand { + private static final String[] VOTE_LINKS = new String[]{ + "https://top.gg/bot/1254161119975833652/vote" + }; + + @Override + public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { + StringBuilder builder = new StringBuilder(); + builder.append("You can vote for the bot by clicking the following links:\n\n"); + for (String link : VOTE_LINKS) { + builder.append("%s\n".formatted(link)); + } + interaction.replyEmbeds(EmbedUtils.genericEmbed() + .setDescription(builder.toString()) + .build() + ).queue(); + } +}