Skip to content

Commit bf96b07

Browse files
committed
Update the format of the download command, add program descriptions
1 parent 1949249 commit bf96b07

File tree

1 file changed

+50
-25
lines changed

1 file changed

+50
-25
lines changed

src/main/java/org/geysermc/discordbot/commands/DownloadCommand.java

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@
2929
import com.jagrosh.jdautilities.command.CommandEvent;
3030
import com.jagrosh.jdautilities.command.SlashCommand;
3131
import com.jagrosh.jdautilities.command.SlashCommandEvent;
32-
import net.dv8tion.jda.api.EmbedBuilder;
32+
import net.dv8tion.jda.api.components.actionrow.ActionRow;
33+
import net.dv8tion.jda.api.components.buttons.Button;
34+
import net.dv8tion.jda.api.components.buttons.ButtonStyle;
35+
import net.dv8tion.jda.api.components.container.Container;
36+
import net.dv8tion.jda.api.components.section.Section;
37+
import net.dv8tion.jda.api.components.separator.Separator;
38+
import net.dv8tion.jda.api.components.textdisplay.TextDisplay;
39+
import net.dv8tion.jda.api.components.thumbnail.Thumbnail;
3340
import net.dv8tion.jda.api.interactions.commands.Command;
3441
import net.dv8tion.jda.api.interactions.commands.OptionType;
3542
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
@@ -52,17 +59,17 @@ public DownloadCommand() {
5259
this.help = "Sends a link to download the latest version of Geyser or another program";
5360
this.guildOnly = false;
5461

55-
this.defaultDownloadOption = new GeyserDownloadOption("Geyser", "https://geysermc.org/download");
62+
this.defaultDownloadOption = new GeyserDownloadOption("Geyser", "A proxy which allows Bedrock Edition clients to join Java Edition servers.", "https://geysermc.org/download");
5663
this.optionsToRepository = ImmutableMap.<String, DownloadOption>builder()
5764
.put("geyser", this.defaultDownloadOption)
58-
.put("floodgate", new GeyserDownloadOption("Floodgate", "https://geysermc.org/download#floodgate"))
59-
.put("geyseroptionalpack", new GeyserDownloadOption("GeyserOptionalPack", "https://geysermc.org/download/?project=other-projects&geyseroptionalpack=expanded"))
60-
.put("floodgate-modded", new GeyserDownloadOption("Floodgate Modded", "https://modrinth.com/mod/floodgate"))
61-
.put("paper", new DownloadOption("Paper", "https://papermc.io/downloads", "https://github.com/PaperMC.png"))
62-
.put("viaversion", new DownloadOption("ViaVersion", "https://ci.viaversion.com/job/ViaVersion/", "https://github.com/ViaVersion.png"))
63-
.put("hydraulic", new GeyserDownloadOption("Hydraulic (Beta)", "https://geysermc.org/download?project=other-projects&hydraulic=expanded"))
64-
.put("rainbow", new GeyserDownloadOption("Rainbow (Beta)", "https://geysermc.org/download?project=other-projects&rainbow=expanded"))
65-
.put("thunder", new GeyserDownloadOption("Thunder (Beta)", "https://geysermc.org/download?project=other-projects&thunder=expanded"))
65+
.put("floodgate", new GeyserDownloadOption("Floodgate", "A plugin which allows Bedrock Edition clients to join Java edition servers without a Java Edition account.", "https://geysermc.org/download#floodgate"))
66+
.put("geyseroptionalpack", new GeyserDownloadOption("GeyserOptionalPack", "A Bedrock Edition resource pack which provides some fixes and parity changes to Geyser.", "https://geysermc.org/download/?project=other-projects&geyseroptionalpack=expanded"))
67+
.put("floodgate-modded", new GeyserDownloadOption("Floodgate Modded", "A mod which allows Bedrock Edition clients to join Java edition servers without a Java Edition account.", "https://modrinth.com/mod/floodgate"))
68+
.put("paper", new DownloadOption("Paper", "Paper is a server software based on Spigot with better performance and more modern features.", "https://papermc.io/downloads", "https://github.com/PaperMC.png"))
69+
.put("viaversion", new DownloadOption("ViaVersion", "ViaVersion is a plugin which allows modern clients to join older Java Edition servers.", "https://ci.viaversion.com/job/ViaVersion/", "https://github.com/ViaVersion.png"))
70+
.put("hydraulic", new GeyserDownloadOption("Hydraulic (Beta)", "A companion mod to Geyser which allows for Bedrock players to join modded Java Edition servers.", "https://geysermc.org/download?project=other-projects&hydraulic=expanded"))
71+
.put("rainbow", new GeyserDownloadOption("Rainbow (Beta)", "A Minecraft mod to generate Geyser item mappings and bedrock resourcepacks for use with Geyser's custom item API (v2). ", "https://geysermc.org/download?project=other-projects&rainbow=expanded"))
72+
.put("thunder", new GeyserDownloadOption("Thunder (Beta)", "A java application to convert simple Java Edition resource packs to Bedrock Edition ones.", "https://geysermc.org/download?project=other-projects&thunder=expanded"))
6673
.build();
6774

6875
List<Command.Choice> choices = new ArrayList<>();
@@ -86,12 +93,20 @@ protected void execute(CommandEvent event) {
8693

8794
DownloadOption downloadOption = optionsToRepository.getOrDefault(program.toLowerCase(Locale.ROOT), this.defaultDownloadOption);
8895

89-
event.getMessage().replyEmbeds(new EmbedBuilder()
90-
.setTitle("Download " + downloadOption.friendlyName)
91-
.setDescription("Download at " + downloadOption.downloadUrl)
92-
.setThumbnail(downloadOption.imageUrl)
93-
.setColor(BotColors.SUCCESS.getColor())
94-
.build()).queue();
96+
event.getMessage().replyComponents(
97+
Container.of(
98+
Section.of(
99+
Thumbnail.fromUrl(downloadOption.imageUrl),
100+
TextDisplay.of("## " + downloadOption.friendlyName),
101+
TextDisplay.of(downloadOption.description)
102+
),
103+
Separator.createDivider(Separator.Spacing.LARGE),
104+
ActionRow.of(Button.of(ButtonStyle.LINK, downloadOption.downloadUrl, "Download"))
105+
)
106+
.withAccentColor(BotColors.SUCCESS.getColor())
107+
)
108+
.useComponentsV2()
109+
.queue();
95110
}
96111

97112
@Override
@@ -100,29 +115,39 @@ protected void execute(SlashCommandEvent event) {
100115

101116
DownloadOption downloadOption = optionsToRepository.getOrDefault(program.toLowerCase(Locale.ROOT), this.defaultDownloadOption);
102117

103-
event.replyEmbeds(new EmbedBuilder()
104-
.setTitle("Download " + downloadOption.friendlyName)
105-
.setDescription("Download at " + downloadOption.downloadUrl)
106-
.setThumbnail(downloadOption.imageUrl)
107-
.setColor(BotColors.SUCCESS.getColor())
108-
.build()).queue();
118+
event.replyComponents(
119+
Container.of(
120+
Section.of(
121+
Thumbnail.fromUrl(downloadOption.imageUrl),
122+
TextDisplay.of("## " + downloadOption.friendlyName),
123+
TextDisplay.of(downloadOption.description)
124+
),
125+
Separator.createDivider(Separator.Spacing.LARGE),
126+
ActionRow.of(Button.of(ButtonStyle.LINK, downloadOption.downloadUrl, "Download"))
127+
)
128+
.withAccentColor(BotColors.SUCCESS.getColor())
129+
)
130+
.useComponentsV2()
131+
.queue();
109132
}
110133

111134
private static class DownloadOption {
112135
private final String friendlyName;
136+
private final String description;
113137
private final String downloadUrl;
114138
private final String imageUrl;
115139

116-
public DownloadOption(String friendlyName, String downloadUrl, String imageUrl) {
140+
public DownloadOption(String friendlyName, String description, String downloadUrl, String imageUrl) {
117141
this.friendlyName = friendlyName;
142+
this.description = description;
118143
this.downloadUrl = downloadUrl;
119144
this.imageUrl = imageUrl;
120145
}
121146
}
122147

123148
private static class GeyserDownloadOption extends DownloadOption {
124-
public GeyserDownloadOption(String friendlyName, String downloadUrl) {
125-
super(friendlyName, downloadUrl, "https://github.com/GeyserMC.png");
149+
public GeyserDownloadOption(String friendlyName, String description, String downloadUrl) {
150+
super(friendlyName, description, downloadUrl, "https://github.com/GeyserMC.png");
126151
}
127152
}
128153
}

0 commit comments

Comments
 (0)