discord.js: ApplicationCommand#edit doesn't unset defaultMemberPermission
Which package is this bug report for?
discord.js
Issue description
- Create a command with a defaultMemberPermission set
- Edit it by passing the entire command object again, but this time without the defaultMemberPermission property
- Observe how it is still set on Discord
As a sidenote, I believe this issue would be fixed by initiating the default_member_permissions variable in ApplicationCommandManager.transformCommand as null
, I just won’t PR it as I’m not sure if that would have unwanted side-effects
https://github.com/discordjs/discord.js/blob/6912faa9b3852adbacc7d0b002aae81be041f529/packages/discord.js/src/managers/ApplicationCommandManager.js#L236
Code sample
const command = {
name: "test",
description: "A test command",
defaultMemberPermissions: 8n
}
const discordCommand = await client.application.commands.create(command)
delete command.defaultMemberPermissions
await discordCommand.edit(command)
console.log(discordCommand.defaultMemberPermissions)
Package version
14.9.0
Node.js version
18.14.2
Operating system
Windows 11
Priority this issue should have
Low (slightly annoying)
Which partials do you have configured?
Not applicable (subpackage bug)
Which gateway intents are you subscribing to?
Not applicable (subpackage bug)
I have tested this issue on a development release
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (15 by maintainers)
The solution to this problem is to ask to add
PUT: /applications/:application-id/commands/:command-id
route or document it if it’s already exists.