#Snoweuph - Slash Command Permissions
1 messages · Page 1 of 1 (latest)
Can I do it without creating a Client, with the use of @discordjs/rest what I'm allready using for registering the commands?
yes
yes to what part?
you dont need a client, you can set them through the api
hold on, ill make one
thx :)
Could find anything in the docs, there also is no doc for discord-api-types/v9
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
for the commandid, can i just use the name set in the slashcommand builder?
no, the actual id of the command
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?
the put request will return it
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
so then you can find the command object by name and then use the id
like Routes.applicationGuildCommands is returning them, right?**
await rest.put(
Routes.applicationGuildCommands(process.env.BOT_ID, process.env.TEST_GUILD_ID),
{ body: _commands },
);
yes, where you rest.put(), that will return it
Or you could rest.get them afterwards if you wanted
okay :)
yea :) thx, I will try it out :)
I can just overide multiple commands permissions at a time with it, right? I can save API calls :)
yeah, thats a batch edit, so its overwrites everything with what you put
wait, I can just set it to roles or users, There is no option to set it to specific permissions like ADMINISTARTOR?
nope :/ permissions are kinda terrible atm
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 :)
yeah, they are overhauling it soon, with a UI for server owners to edit permissions for each command like channels
nice, is there a place at that I can listen for it?
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