#SlashCommandBuilder permissions.

18 messages · Page 1 of 1 (latest)

foggy kindle
#

Hey guys, I have a command that looks like the follow:

module.exports = {
  data: new SlashCommandBuilder()
    .setName('moderation')
    .setDescription('Moderation utility tools')
    .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
    .addSubcommand((subcommand) =>
      subcommand
        .setName('purge')
        .setDescription('Removes {n} number of messages')
        .addNumberOption((option) =>
          option.setRequired(true).setName('n').setDescription('Amount of messages, max 100')
        )
    ),
  async execute(interaction: CommandInteraction) {
    try {
await purgeMessages(interaction)
ephemeral: true })
    } catch (error) {
      console.log('❌ ERROR: moderation(): ', error)
    }
  },
}

Is there any specific reason for the .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) to not work correctly? Seems that everyone has the option to use it, I was expecting it to only work with Admin privileged

Discord.JS V13.6.0

buoyant oarBOT
#

• 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.

silk wind
#

It’s only the defaultMemberPermissions. The guild owner/admins can override that anyway they like

#

And you might want to consider updating to 13.10, as I‘m not even sure if 13.6 supports defaultMemberPermissions correctly

foggy kindle
#

I just noticed the suggested 13.10 tag, so I just updated

#

When you mean overwrite is from the Discord Guild settings?

#

so having it in 0 expecting them to enable it later should do the work, or?

foggy kindle
#

Fair enough. Thanks a lot!

#

Is there any 'best practice' related to the permissions?

#

like, default it to 0 and haver them enable later, or?

nocturne nest
#

Probably default to perms the command would need, if it's something like kick or ban

foggy kindle
#

Weird enough, not even with '0' will disable it for everyone for example, now with v3.10

silk wind
foggy kindle
#

Oooooooohhhh

#

and is there a way around that?

#

I was checking the documentation again in cased I missed it, there's no mention of that, would be probably nice to have.