swc/crates/swc_bundler/tests/.cache/deno/9be60b7b9005fa08f1afaf283eccf1e0a15a260f.ts
2021-11-09 20:42:49 +09:00

19 lines
833 B
TypeScript

// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/webhooks/edit_webhook.ts
import { rest } from "../../rest/rest.ts";
import type { ModifyWebhook } from "../../types/webhooks/modify_webhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";
/** Edit a webhook. Requires the `MANAGE_WEBHOOKS` permission. Returns the updated webhook object on success. */
export async function editWebhook(channelId: bigint, webhookId: bigint, options: ModifyWebhook) {
await requireBotChannelPermissions(channelId, ["MANAGE_WEBHOOKS"]);
return await rest.runMethod<Webhook>("patch", endpoints.WEBHOOK_ID(webhookId), {
...options,
channel_id: options.channelId,
});
}