File tree Expand file tree Collapse file tree 3 files changed +5
-10
lines changed
java/io/github/freya022/botcommands/test/commands/slash
kotlin/io/github/freya022/botcommands/test/commands/slash Expand file tree Collapse file tree 3 files changed +5
-10
lines changed Original file line number Diff line number Diff line change 55import io .github .freya022 .botcommands .api .commands .application .ApplicationCommand ;
66import io .github .freya022 .botcommands .api .commands .application .slash .GuildSlashEvent ;
77import io .github .freya022 .botcommands .api .commands .application .slash .annotations .JDASlashCommand ;
8- import net .dv8tion .jda .api .interactions .InteractionHook ;
98import net .dv8tion .jda .api .interactions .components .buttons .Button ;
109import net .dv8tion .jda .api .interactions .components .selections .SelectOption ;
1110import net .dv8tion .jda .api .interactions .components .selections .StringSelectMenu ;
@@ -32,10 +31,8 @@ public void onSlashEmojis(GuildSlashEvent event) {
3231 .build ();
3332
3433 event .reply (messageData )
35- // Since we reply to a slash command, we need to retrieve the message back
36- .flatMap (InteractionHook ::retrieveOriginal )
3734 // This emoji's name is slightly different as fields can't start with digits
38- .flatMap (message -> message .addReaction (Emojis .HUNDRED_POINTS ))
35+ .flatMap (hook -> hook . getCallbackResponse (). getMessage () .addReaction (Emojis .HUNDRED_POINTS ))
3936 .queue ();
4037 }
4138}
Original file line number Diff line number Diff line change @@ -118,9 +118,8 @@ class SlashNewButtons(
118118
119119 buttons.group(secondButton).ephemeral {
120120 timeout(15 .minutes) {
121- event.hook.retrieveOriginal()
122- .flatMap { event.hook.editOriginalComponents(it.components.asDisabled()) }
123- .queue()
121+ val newComponents = event.hook.callbackResponse.message!! .components.asDisabled()
122+ event.hook.editOriginalComponents(newComponents).queue()
124123 }
125124 }
126125 return firstButton
Original file line number Diff line number Diff line change @@ -99,9 +99,8 @@ class SlashNewSelects(
9999
100100 selectMenus.group(firstSelect).ephemeral {
101101 timeout(15 .seconds) {
102- event.hook.retrieveOriginal()
103- .flatMap { event.hook.editOriginalComponents(it.components.asDisabled()) }
104- .queue()
102+ val newComponents = event.hook.callbackResponse.message!! .components.asDisabled()
103+ event.hook.editOriginalComponents(newComponents).queue()
105104 }
106105 }
107106 return firstSelect
You can’t perform that action at this time.
0 commit comments