Files
discordeno/helpers/interactions/commands/editGlobalApplicationCommand.ts
Skillz4Killz 3a5bdce32d feat: helpers support strings in args (#2478)
* fix: helpers support strings in args

* fix: fmt
2022-09-15 20:59:02 -05:00

29 lines
1.1 KiB
TypeScript

import type { Bot } from "../../../bot.ts";
import { ApplicationCommand } from "../../../transformers/applicationCommand.ts";
import { BigString, CreateApplicationCommand, DiscordApplicationCommand } from "../../../types/mod.ts";
/**
* Edits a global application command.
*
* @param bot - The bot instance to use to make the request.
* @param commandId - The ID of the command to edit.
* @param options - The parameters for the edit of the command.
* @returns An instance of the edited {@link ApplicationCommand}.
*
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command}
*/
export async function editGlobalApplicationCommand(
bot: Bot,
commandId: BigString,
options: CreateApplicationCommand,
): Promise<ApplicationCommand> {
const result = await bot.rest.runMethod<DiscordApplicationCommand>(
bot.rest,
"PATCH",
bot.constants.routes.COMMANDS_ID(bot.applicationId, commandId),
bot.transformers.reverse.createApplicationCommand(bot, options),
);
return bot.transformers.applicationCommand(bot, result);
}