mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 01:40:08 +00:00
* fix(rest/process_request): use DiscordHTTPResponseCodes * refactor: remove RequestManager * refactor: remove RequestManager and use runMethod()
24 lines
667 B
TypeScript
24 lines
667 B
TypeScript
import { rest } from "../../rest/rest.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: string,
|
|
webhookId: string,
|
|
options: WebhookEditOptions,
|
|
) {
|
|
await requireBotChannelPermissions(channelId, ["MANAGE_WEBHOOKS"]);
|
|
|
|
const result = await rest.runMethod(
|
|
"patch",
|
|
endpoints.WEBHOOK_ID(webhookId),
|
|
{
|
|
...options,
|
|
channel_id: options.channelId,
|
|
},
|
|
);
|
|
|
|
return result as WebhookPayload;
|
|
}
|