AlexzanderFlores / WOKCommands

132 stars 61 forks source link

Updating options won't update the slash command #215

Closed 4lve closed 2 years ago

4lve commented 2 years ago

When editing slash command options it does not detect an update until the size of the array change

Zakichanu commented 2 years ago

Hi,

Can you show your code, just to check what's the problem

4lve commented 2 years ago

Before Editing:

options: [ { name: 'username', description: 'username', required: false, type: DiscordJS.Constants.ApplicationCommandOptionTypes.STRING, }, { name: 'password', description: 'password', required: false, type: DiscordJS.Constants.ApplicationCommandOptionTypes.STRING, } ],

Changing for example required to true or the type won't update the Discord command until you change the array length.

This wont update options: [ { name: 'username', description: 'username', required: true, type: DiscordJS.Constants.ApplicationCommandOptionTypes.STRING, }, { name: 'password', description: 'password', required: true, type: DiscordJS.Constants.ApplicationCommandOptionTypes.STRING, } ],

But this will update options: [ { name: 'username', description: 'username', required: true, type: DiscordJS.Constants.ApplicationCommandOptionTypes.STRING, }, { name: 'password', description: 'password', required: true, type: DiscordJS.Constants.ApplicationCommandOptionTypes.STRING, }, { name: 'temp', description: 'temp', required: false, type: DiscordJS.Constants.ApplicationCommandOptionTypes.STRING, } ],

and after the update removing temp

Zakichanu commented 2 years ago

I don't see a problem with your code, can you explain me what is the purpose of your slash command just to clarify what can be the problem

4lve commented 2 years ago

The problem isnt the code, it's that when the bot is startedit dosen't detect a change in the slash command so it dosen't update to discord. This is because it just looks at the lenght of the array, not the inside of it

Zakichanu commented 2 years ago

Oh yeah, now I see the problem, what I do in that case is that i'm using the wokcommands built-in command !slash [command-id] and then after restarting your app you will get the slash command with updated options

NB : We can list command ids by writing !slash on discord