Skip to content

Commit 9312729

Browse files
committed
Changed the way bot replies
The bot now sends a message with the menu and embed to the channel instead of replying to the even
1 parent db5c2f1 commit 9312729

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

application/src/main/java/org/togetherjava/tjbot/commands/basic/RoleSelectCommand.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,19 @@ public void onSlashCommand(@NotNull SlashCommandEvent event) {
105105
String title = handleOption(titleOption);
106106
String description = handleOption(descriptionOption);
107107

108-
event.replyEmbeds(makeEmbed(title, description))
109-
.addActionRow(menu.build())
110-
.setEphemeral(ephemeral)
111-
.queue();
108+
if (ephemeral) {
109+
event.replyEmbeds(makeEmbed(title, description))
110+
.addActionRow(menu.build())
111+
.setEphemeral(true)
112+
.queue();
113+
} else {
114+
event.getChannel()
115+
.sendMessageEmbeds(makeEmbed(title, description))
116+
.setActionRow(menu.build())
117+
.queue();
118+
119+
event.reply("Message sent successfully!").setEphemeral(true).queue();
120+
}
112121
}
113122

114123
/**
@@ -158,7 +167,7 @@ private static void addMenuOptions(@NotNull SlashCommandEvent event,
158167
@Nullable String description) {
159168

160169
if (title == null) {
161-
title = "Select your roles";
170+
title = "Select your roles:";
162171
}
163172

164173
EmbedBuilder embedBuilder = new EmbedBuilder();
@@ -199,10 +208,13 @@ public void onSelectionMenu(@NotNull SelectionMenuEvent event, @NotNull List<Str
199208
menu.addOption(role.getName(), role.getId());
200209
}
201210

202-
event.replyEmbeds(event.getMessage().getEmbeds().get(0))
203-
.addActionRow(menu.build())
211+
event.getChannel()
212+
.sendMessageEmbeds(event.getMessage().getEmbeds().get(0))
213+
.setActionRow(menu.build())
204214
.queue();
205215

216+
event.reply("Message sent successfully!").setEphemeral(true).queue();
217+
206218
return;
207219
}
208220

0 commit comments

Comments
 (0)