File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
jda/src/main/java/revxrsal/commands/jda Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ plugins {
1616}
1717
1818group = " io.github.revxrsal"
19- version = " 4.0.0-rc.10 "
19+ version = " 4.0.0-rc.11 "
2020
2121java {
2222 toolchain {
Original file line number Diff line number Diff line change 3030import net .dv8tion .jda .api .entities .channel .middleman .MessageChannel ;
3131import net .dv8tion .jda .api .entities .emoji .Emoji ;
3232import net .dv8tion .jda .api .events .interaction .command .SlashCommandInteractionEvent ;
33+ import net .dv8tion .jda .api .interactions .commands .Command ;
3334import org .jetbrains .annotations .NotNull ;
3435import revxrsal .commands .Lamp ;
3536import revxrsal .commands .LampBuilderVisitor ;
@@ -67,7 +68,14 @@ public final class JDAVisitors {
6768 for (ExecutableCommand <A > child : lamp .registry ().commands ()) {
6869 parser .parse (child );
6970 }
70- jda .updateCommands ().addCommands (parser .commands ().values ()).queue ();
71+ jda .retrieveCommands ().queue (existingCommands -> {
72+ existingCommands .forEach (existingCommand -> {
73+ if (existingCommand .getType () == Command .Type .SLASH ) {
74+ jda .deleteCommandById (existingCommand .getId ()).queue ();
75+ }
76+ });
77+ });
78+ parser .commands ().values ().forEach (newCommand -> jda .upsertCommand (newCommand ).queue ());
7179 jda .addEventListener (new JDASlashListener <>(lamp , actorFactory ));
7280 };
7381 }
You can’t perform that action at this time.
0 commit comments