From 79c236dde569125ab18dd947bbe9ec09afad0a1f Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Sun, 25 Apr 2021 16:33:03 +0100 Subject: [PATCH] Create get_slash_command_permission.ts --- .../commands/get_slash_command_permission.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/helpers/commands/get_slash_command_permission.ts diff --git a/src/helpers/commands/get_slash_command_permission.ts b/src/helpers/commands/get_slash_command_permission.ts new file mode 100644 index 000000000..f34362b9f --- /dev/null +++ b/src/helpers/commands/get_slash_command_permission.ts @@ -0,0 +1,15 @@ +import { applicationId } from "../../bot.ts"; +import { rest } from "../../rest/rest.ts"; +import { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts"; +import { endpoints } from "../../util/constants.ts"; + +/** Fetches command permissions for a specific command for your application in a guild. Returns a GuildApplicationCommandPermissions object. */ +export async function getSlashCommandPermission( + guildId: string, + commandId: string, +) { + return await rest.runMethod( + "get", + endpoints.COMMANDS_PERMISSION(applicationId, guildId, commandId), + ); +}