mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
feat(handlers): add getSlashCommand() (#444)
This commit is contained in:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user