#integration tab permissions resetting

19 messages · Page 1 of 1 (latest)

stable locust
#

I've had a bit of an issue when editing code lately. Basically I have some permissions set up for slash commands on the integration section on the server and these permissions keep getting reset which is quite annoying. Is there anyway to update the commands rather than remove them and re-add them?
I assume is what the put API request does

Basically if I do something that breaks the command when I register it to test it, it then resets the permissions in integrations

My command setup is the same as the one in this guide https://discordjs.guide/creating-your-bot/command-handling.html#dynamically-executing-commands

lavish snowBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

stable locust
stable locust
#

I found out there is a way to set default slash permissions which sounded like it would fix my issue. However it looks like I can set the default permissions based on what permissions the member has but I assume there is no way to tie it to roles and channels like in the integration menu?

frosty dirge
#

Without oauth2, bots can only set the default member permissions.
Nothing more.

stable locust
#

Ah that is a shame, do you have any tips to avoid it resetting as much? maybe there is some safe guard for this that I just am not using

frosty dirge
#

dont create the commands on startup?

#

if you create the commands again, the old ones get removed and replaced by the new ones, resulting in "new" commands which have other settings

stable locust
#

It seems to be all or nothing when I have messed up, I guess due to how discord handles that? but if one command file isn't valid it doesn't load any of them and I end up resetting all commands. Is there then a way to check it is valid with the API before "commiting" the commands, something in the rest section maybe?

frosty dirge
#

You could try to use REST.patch instead of REST.put?

stable locust
#

Ah so with using patch, if it sent a blank/invalid command in theory it would tell the API I want to update "nothing" rather than remove this command entirely?

frosty dirge
#

not sure, havent used it

stable locust
#

I tried outright swapping it and it returns this rawError: { message: '405: Method Not Allowed', code: 0 },

frosty dirge
#

:(

stable locust
#

ah it looks like if you patch them one by one it would be allowed but then I worry about getting rate limited

#

and then if I set a delay I worry about it taking ages to finalise >.>

#

Do you know how to retrieve a command id by chance? I can't find any docs on that

frosty dirge
#

either when receiving the interaction with interaction.commandId or fetch all commands and find by name