Search code examples
discordpermissionsdiscord.jsbots

.setDefaultMemberPermissions is not working in my discord.js bot


I've been trying to make a bot and i discovered the setdefaultmemberpermission, but it doesn't seem to work for me. Could someone help out please? When i execute the command without the administrator permission, it still allows me to do the command.

Here is my code:

const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('embed')
        .setDescription('Sends a embed!')
        .setDefaultMemberPermissions(PermissionFlagsBits.ADMINISTRATOR),

Solution

  • Change this:

    PermissionFlagsBits.ADMINISTRATOR
    

    To this:

    PermissionFlagsBits.Administrator
    

    Reference: PermissionsBitFeld#Flags, PermissionFlagBits