mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
Merge pull request #1954 from lts20050703/gh-1906
discord-api-docs: Document X-Audit-Log-Reason on webhook endpoints
This commit is contained in:
@@ -13,8 +13,9 @@ export async function createWebhook(bot: Bot, channelId: bigint, options: Create
|
||||
"post",
|
||||
bot.constants.endpoints.CHANNEL_WEBHOOKS(channelId),
|
||||
{
|
||||
...options,
|
||||
name: options.name,
|
||||
avatar: options.avatar ? await bot.utils.urlToBase64(options.avatar) : undefined,
|
||||
reason: options.reason,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
|
||||
/** Delete a webhook permanently. Requires the `MANAGE_WEBHOOKS` permission. Returns a undefined on success */
|
||||
export async function deleteWebhook(bot: Bot, channelId: bigint, webhookId: bigint) {
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.WEBHOOK_ID(webhookId));
|
||||
export async function deleteWebhook(bot: Bot, webhookId: bigint, reason?: string) {
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.WEBHOOK_ID(webhookId), { reason });
|
||||
}
|
||||
|
||||
@@ -3,10 +3,12 @@ import type { Webhook } from "../../types/webhooks/webhook.ts";
|
||||
import type { Bot } from "../../bot.ts";
|
||||
|
||||
/** Edit a webhook. Requires the `MANAGE_WEBHOOKS` permission. Returns the updated webhook object on success. */
|
||||
export async function editWebhook(bot: Bot, channelId: bigint, webhookId: bigint, options: ModifyWebhook) {
|
||||
export async function editWebhook(bot: Bot, webhookId: bigint, options: ModifyWebhook) {
|
||||
const result = await bot.rest.runMethod<Webhook>(bot.rest, "patch", bot.constants.endpoints.WEBHOOK_ID(webhookId), {
|
||||
...options,
|
||||
name: options.name,
|
||||
avatar: options.avatar,
|
||||
channel_id: options.channelId,
|
||||
reason: options.reason,
|
||||
});
|
||||
|
||||
return bot.transformers.webhook(bot, result);
|
||||
|
||||
@@ -3,4 +3,6 @@ export interface CreateWebhook {
|
||||
name: string;
|
||||
/** Image for the default webhook avatar */
|
||||
avatar?: string | null;
|
||||
/** The reason you are creating this webhook */
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
@@ -6,4 +6,6 @@ export interface ModifyWebhook {
|
||||
avatar?: string | null;
|
||||
/** The new channel id this webhook should be moved to */
|
||||
channelId?: string;
|
||||
/** The reason you are modifying this webhook */
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user