Any way to check if the bot has sufficient perms to execute a command with SlashCommandBuilder()?

setDefaultMemberPermissions() exists but it only checks the executing user's perms. I also want to add perm checks for my bot.
15 Replies
d.js toolkit
d.js toolkit2w 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!
treble/luna
treble/luna2w ago
wdym? discord doesnt know what your command does
midorina
midorinaOP2w ago
but I can pass the flags, no?
treble/luna
treble/luna2w ago
so also doesnt know which permissions it needs no you can set member permissions yes
midorina
midorinaOP2w ago
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages) // this exists. this checks user's perms
.setBotPermission(PermissionFlagsBits.ManageMessages); // this is what I need
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages) // this exists. this checks user's perms
.setBotPermission(PermissionFlagsBits.ManageMessages); // this is what I need
treble/luna
treble/luna2w ago
Not possible you have to do checks when the command is ran
midorina
midorinaOP2w ago
im curious why such a simple method does not exist on the builder
treble/luna
treble/luna2w ago
because discord doesnt provide it
midorina
midorinaOP2w ago
what do you mean?
treble/luna
treble/luna2w ago
exactly what i said
midorina
midorinaOP2w ago
it's in interaction.guild.members.me.permissions
treble/luna
treble/luna2w ago
yes indeed. a slash command builder is in no way related to that a slash command builder creates data to send to discord bot permissions arent part of that data
midorina
midorinaOP2w ago
it does not have to be in the slash command data that we send to Discord. it's a check that the lib can do when the command is executed, no?
treble/luna
treble/luna2w ago
no thats up to you to do djs is an api wrapper not a framework
midorina
midorinaOP2w ago
I see. thanks

Did you find this page helpful?