mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-31 07:50:07 +00:00
24 lines
668 B
TypeScript
24 lines
668 B
TypeScript
import type { ModifyWebhook } from "../../types/webhooks/modifyWebhook.ts";
|
|
import type { Webhook } from "../../types/webhooks/webhook.ts";
|
|
import type { Bot } from "../../bot.ts";
|
|
|
|
/** Edit a webhook. Returns the updated webhook object on success. */
|
|
export async function editWebhookWithToken(
|
|
bot: Bot,
|
|
webhookId: bigint,
|
|
webhookToken: string,
|
|
options: Omit<ModifyWebhook, "channelId">,
|
|
) {
|
|
const result = await bot.rest.runMethod<Webhook>(
|
|
bot.rest,
|
|
"patch",
|
|
bot.constants.endpoints.WEBHOOK(webhookId, webhookToken),
|
|
{
|
|
name: options.name,
|
|
avatar: options.avatar,
|
|
},
|
|
);
|
|
|
|
return bot.transformers.webhook(bot, result);
|
|
}
|