mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
Create batch_edit_slash_command_permissions.ts
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { applicationId } from "../../bot.ts";
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||
|
||||
/** Batch edits permissions for all commands in a guild. Takes an array of partial GuildApplicationCommandPermissions objects including `id` and `permissions`. */
|
||||
export async function batchEditSlashCommandPermissions(
|
||||
guildId: string,
|
||||
options: { id: string; permissions: ApplicationCommandPermissions[] }[],
|
||||
) {
|
||||
return await rest.runMethod(
|
||||
"put",
|
||||
endpoints.COMMANDS_PERMISSIONS(applicationId, guildId),
|
||||
snakeKeysToCamelCase(options),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user