Invalid command for interaction application

Viewed 310

I register an SlashCommand... but it answered "Invalid command for interaction application" Can somebody help...

 @Override
    public void onSlashCommand(SlashCommandEvent event) {

        if (event.getName().equals("login")) {

            EmbedBuilder buil = new EmbedBuilder();
            buil.setColor(Color.RED);
            buil.appendDescription("Du hast deinen DiscordAccount noch nicht mit dem TurnierSystem verknüpft... Benutze ?connect um die Accounts zu verknüpfen.");
            buil.setAuthor("TurnierSystem");
            buil.setTitle("Discord Login (Fehler)");

           event.replyEmbeds(buil.build()).queue();

        }
1 Answers

This response means that the Discord client tried to use an old version of the command that it had cached. If you simply retype the command, it should use the updated command instead.

The cause of this behavior is from calling upsertCommand when you start your bot. This will replace the existing command and make the client cache invalid.

You can use updateCommands().addCommands(allOfYourCommands).queue() instead, to prevent this from happening. However, keep in mind you need to put all your commands in addCommands(...), not just one at a time!

Related