#slash command only visible to owner
1 messages ยท Page 1 of 1 (latest)
U cant
"visible" can only be done on discord's end via the guild's integration menu. you can use @commands.is_owner() decorator from discord.ext to prevent the callback from running, but the user will still be able to see and "use" the command
if you have a testing guild you can make it a guild command for that guild along with the check.
Just as an alternative, if 'Admin' works for your use case, I think you can pass the default_member_permissions kwarg to the decorator with a Permissions object:
@commands.slash_command(name='asdf', default_member_permissions=discord.Permissions(administrator=True))
async def asdf(self, ctx):
pass
This works for 'new' commands, so you'd have to deregister the command, and re-register to make it automatic.
While I've only used this for command groups, theoretically it should work for individual (parent) commands since it has the same handling. I'm sure someone will correct me if that's wrong. ๐
Does this grey out the command? ๐ค
hides
As Nelo said, it won't even be an available command for anyone without the permission
Interesting.
Thought it greyed out the command. Don't know if that's still a thing.
it used to be greyed out, but discord changed it to hide
Ah, I see.
Yup it should work fine for individual commands
If you have a bearer token then the bot can set a specific permission for that Slash Command that only permits certain members or roles to use that command
However, this is not built into Pycord so you'll have to do it manually
Is there a way to do this but to instead be able to choose it based on roles?
Looking at the Discord API (https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure), it doesn't appear to expose the permissions structure for Roles like it has in the Integration UI
Hopefully that'll come as an upgrade at some point
What do you mean?
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
Under application command permission type, there's a value 1 which indicates role!
Does current pycord not allow you to do this when setting up application command permissions?
I'm struggling with updating my bot to using permissions_v2
I guess that's fetching. Here are the current options for creating, AFAICS:
https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure The only thing I see is default_member_permissions, which, if you click through, are based on grants rather than Roles/Users.
Although there is an endpoint for updating.
Is the endpoint valid?
Actually, this is the answer to your question. Updating Permissions requires a bearer token; pycord does not have support for that.
Are there plans for supporting it?
I'd imagine not, it's a completely separate authorization flow. But you may want to ask in other channels, as I can't speak to their intentions.
Do you know if, by default, newly registered commands are set to admin only?