#SOLVED Hide slash commands from everyone but certain users

14 messages · Page 1 of 1 (latest)

oblique gale
#

Is it possible to setup a slash command so that only certain people (the devs) can see it / use it

dapper wolf
#

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

oblique gale
#

[email protected]
[email protected]

module.exports = {
    data: {
        name: "usage",
        description: "Get usage statistics for the bot",
        type: application.command.chat
    },

I have looked through the docs but can only find stuff related to checking a users permissions (like if they can ban when executing a ban command) or checking for roles. I'd like to be able to by default hide the command from everyone else but certain users (and ideally not have to just update certain commands to a specific dev-only guild, as it would be nice to be able to run the commands elsewhere)

torn prawn
#

given the duration, duck is probably making a detailed response, but basically it's meant to be for the server's mods to handle now

primal wagon
#

commands will always be available to members with the admin perm, so to produce this effect, you should consider deploying only to guilds you manage (possibly with a default member permissions of 0)
then you can control who can use the command in the integrations tab of your server's settings

torn prawn
#

alternatively, just check for the user after receiving the interaction, instead of preventing the command from being seen (since admins will see it anyways)

oblique gale
torn prawn
#

admins can do everything except owner actions

#

they are above all permission checks (not hierarchy checks)

oblique gale
#

Thanks for the info, seems slash commands are limited in that regard (I could always resort to legacy commands)

torn prawn
#

you could just have legacy commands for those dev-only commands specifically

oblique gale
#

Thats what I mean

torn prawn
#

and you wouldn't need the MessageContent intent if you use a ping as well

torn prawn