Check if a user have the permission to execute a command.

Hello, I'm working on a ticket bot and I would like to have the same permissions for the close command and button. So I would like to check if the user have the permission in the integration tab, in the settings of discord server. But, it's only return true when a permission exist for that specific user. It's doesn't use everyone or role permisison. Did you have other alternative for me ? https://old.discordjs.dev/#/docs/discord.js/main/class/ApplicationCommandPermissionsManager?scrollTo=has
interaction.guild.commands.permissions.has({ command: '1125040422184570990', permissionId: interaction.user.id })
.then(console.log)
.catch(console.error);
interaction.guild.commands.permissions.has({ command: '1125040422184570990', permissionId: interaction.user.id })
.then(console.log)
.catch(console.error);
Discord.js
Discord.js is a powerful node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
1 Reply
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!