#Snoweuph - Slash Command Permissions

1 messages · Page 1 of 1 (latest)

wicked sable
#

Can I do it without creating a Client, with the use of @discordjs/rest what I'm allready using for registering the commands?

white fractal
#

yes

wicked sable
#

yes to what part?

white fractal
#

you dont need a client, you can set them through the api

wicked sable
#

okay, there is no example for that on the guide, how would I be going on that?

white fractal
#

hold on, ill make one

wicked sable
#

thx :)

#

Could find anything in the docs, there also is no doc for discord-api-types/v9

white fractal
#
await rest.put(
    Routes.guildApplicationCommandsPermissions('appid', 'guildid'),
        { body: [
            {
                id: 'commandid',
                permissions: [
                    {
                        id: 'user/role id',
                        type: 'USER/ROLE', // might have to be 1/2
                        permission: true, // or false
                    },
                ],
            },
        ] },
);
#

this is example for guild command perms

wicked sable
#

for the commandid, can i just use the name set in the slashcommand builder?

white fractal
#

no, the actual id of the command

wicked sable
#

can I get that from the name per api?

#

Q: How would I make all commands inside the admin Category only admin acces from the permissions level ?
I know that I somehow need to first fetch all the commands that have the admin category, but I would need the ID of them or am I wrong, is the name thats stored inside the SlashCommandBuilder enough?

white fractal
#

the put request will return it

#

so then you can find the command object by name and then use the id

wicked sable
#

like Routes.applicationGuildCommands is returning them, right?**

await rest.put(
                Routes.applicationGuildCommands(process.env.BOT_ID, process.env.TEST_GUILD_ID),
                { body: _commands },
            );
white fractal
#

yes, where you rest.put(), that will return it
Or you could rest.get them afterwards if you wanted

wicked sable
#

okay :)

white fractal
#

yeah that returns them

#

const example = await rest.put() etc

wicked sable
#

yea :) thx, I will try it out :)

wicked sable
white fractal
#

yeah, thats a batch edit, so its overwrites everything with what you put

wicked sable
#

wait, I can just set it to roles or users, There is no option to set it to specific permissions like ADMINISTARTOR?

white fractal
#

nope :/ permissions are kinda terrible atm

wicked sable
#

than all of it doesn't make any sense right now, I will just keep some comments inside there and keep that part of the code, also I planned on Registering the commands globally :/ Thx for your help :)

white fractal
#

yeah, they are overhauling it soon, with a UI for server owners to edit permissions for each command like channels

wicked sable
#

nice, is there a place at that I can listen for it?

white fractal
#

theres the Discord Developers server #resources
they do events like each month explaining their progress on things etc, theres summaries pinned and stuff, thats where i find out

wicked sable
#

thx,, but im just interested in that one thing :)

#

ima gonna close this thread now, thx for your help :)