mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
fix: snakelize request body
This commit is contained in:
@@ -5,6 +5,7 @@ import type { DiscordenoEditWebhookMessage } from "../../../types/discordeno/edi
|
||||
import { Errors } from "../../../types/discordeno/errors.ts";
|
||||
import { DiscordAllowedMentionsTypes } from "../../../types/messages/allowed_mentions_types.ts";
|
||||
import { endpoints } from "../../../util/constants.ts";
|
||||
import { snakelize, validateComponents } from "../../../util/utils.ts";
|
||||
|
||||
/** To edit your response to a slash command. If a messageId is not provided it will default to editing the original response. */
|
||||
export async function editSlashResponse(token: string, options: DiscordenoEditWebhookMessage) {
|
||||
@@ -12,6 +13,10 @@ export async function editSlashResponse(token: string, options: DiscordenoEditWe
|
||||
throw Error(Errors.MESSAGE_MAX_LENGTH);
|
||||
}
|
||||
|
||||
if (options.components?.length) {
|
||||
validateComponents(options.components);
|
||||
}
|
||||
|
||||
if (options.embeds && options.embeds.length > 10) {
|
||||
options.embeds.splice(10);
|
||||
}
|
||||
@@ -43,7 +48,7 @@ export async function editSlashResponse(token: string, options: DiscordenoEditWe
|
||||
options.messageId
|
||||
? endpoints.WEBHOOK_MESSAGE(applicationId, token, options.messageId)
|
||||
: endpoints.INTERACTION_ORIGINAL_ID_TOKEN(applicationId, token),
|
||||
options
|
||||
snakelize(options)
|
||||
);
|
||||
|
||||
// If the original message was edited, this will not return a message
|
||||
|
||||
Reference in New Issue
Block a user