diff --git a/src/helpers/webhooks/edit_webhook_message.ts b/src/helpers/webhooks/edit_webhook_message.ts index d49ca7dfb..f1565263b 100644 --- a/src/helpers/webhooks/edit_webhook_message.ts +++ b/src/helpers/webhooks/edit_webhook_message.ts @@ -9,8 +9,7 @@ import { endpoints } from "../../util/constants.ts"; export async function editWebhookMessage( webhookId: bigint, webhookToken: string, - messageId: bigint, - options: EditWebhookMessage, + options: EditWebhookMessage & { messageId?: bigint }, ) { if (options.content && options.content.length > 2000) { throw Error(Errors.MESSAGE_MAX_LENGTH); @@ -62,7 +61,9 @@ export async function editWebhookMessage( const result = await rest.runMethod( "patch", - endpoints.WEBHOOK_MESSAGE(webhookId, webhookToken, messageId), + options.messageId + ? endpoints.WEBHOOK_MESSAGE(webhookId, webhookToken, options.messageId) + : endpoints.WEBHOOK_MESSAGE_ORIGINAL(webhookId, webhookToken), { ...options, allowedMentions: options.allowedMentions }, ); diff --git a/src/util/constants.ts b/src/util/constants.ts index 132f802f7..24f86e828 100644 --- a/src/util/constants.ts +++ b/src/util/constants.ts @@ -138,6 +138,8 @@ export const endpoints = { `${baseEndpoints.BASE_URL}/webhooks/${webhookId}`, WEBHOOK_MESSAGE: (webhookId: bigint, token: string, messageId: bigint) => `${baseEndpoints.BASE_URL}/webhooks/${webhookId}/${token}/messages/${messageId}`, + WEBHOOK_MESSAGE_ORIGINAL: (webhookId: bigint, token: string) => + `${baseEndpoints.BASE_URL}/webhooks/${webhookId}/${token}/messages/@original`, WEBHOOK_SLACK: (webhookId: bigint, token: string) => `${baseEndpoints.BASE_URL}/webhooks/${webhookId}/${token}/slack`, WEBHOOK_GITHUB: (webhookId: bigint, token: string) =>