diff --git a/src/api/handlers/webhook.ts b/src/api/handlers/webhook.ts index 4b6643d89..bec85f4ea 100644 --- a/src/api/handlers/webhook.ts +++ b/src/api/handlers/webhook.ts @@ -9,6 +9,7 @@ import { ExecuteSlashCommandOptions, ExecuteWebhookOptions, MessageCreateOptions, + SlashCommand, UpsertSlashCommandOptions, WebhookCreateOptions, WebhookPayload, @@ -214,6 +215,17 @@ export function createSlashCommand(options: CreateSlashCommandOptions) { ); } +/** Fetchs the global command for the given ID. If a guildID is provided, the guild command will be fetched. */ +export async function getSlashCommand(commandID: string, guildID?: string) { + const result = await RequestManager.get( + guildID + ? endpoints.COMMANDS_GUILD_ID(applicationID, guildID, commandID) + : endpoints.COMMANDS_ID(applicationID, commandID), + ); + + return result as SlashCommand; +} + /** Fetch all of the global commands for your application. */ export function getSlashCommands(guildID?: string) { // TODO: Should this be a returned as a collection?