Permission

const hasManageMessagesPermission = interaction.member.permissions.has('PermissionFlagsBits.ManageMessages');

if (!hasManageMessagesPermission) {
interaction.reply({
content: `**Nie masz uprawnienia do zarzÄ…dzania wnioskami.**`,
ephemeral: true,
});
return;
}
const hasManageMessagesPermission = interaction.member.permissions.has('PermissionFlagsBits.ManageMessages');

if (!hasManageMessagesPermission) {
interaction.reply({
content: `**Nie masz uprawnienia do zarzÄ…dzania wnioskami.**`,
ephemeral: true,
});
return;
}
4 Replies
d.js toolkit
d.js toolkit•10mo 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!
Yoqurt
Yoqurt•10mo ago
why is it not works? (that's interaction on button)
xx_lavaboy_xx123
xx_lavaboy_xx123•10mo ago
you put the PermissionFlagsBits.ManageMessages enum between quotation marks which made it a string, use the enum correctly or if u wanna use a string instead of an enum just pass ManageMessages without the PermissionFlagsBits part into has method
d.js docs
d.js docs•10mo ago
property ButtonInteraction#memberPermissions The permissions of the member, if one exists, in the channel this interaction was executed in
Want results from more Discord servers?
Add your server