From d007acc64e464deafda2d86a89c5a6ff469823e5 Mon Sep 17 00:00:00 2001 From: Rory& Date: Wed, 24 Sep 2025 00:03:03 +0200 Subject: [PATCH] Logging of empty messages --- .../routes/channels/#channel_id/messages/#message_id/index.ts | 2 +- src/api/util/handlers/Message.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/routes/channels/#channel_id/messages/#message_id/index.ts b/src/api/routes/channels/#channel_id/messages/#message_id/index.ts index c0bff75b..6fa4cd38 100644 --- a/src/api/routes/channels/#channel_id/messages/#message_id/index.ts +++ b/src/api/routes/channels/#channel_id/messages/#message_id/index.ts @@ -93,7 +93,7 @@ router.patch( } } else rights.hasThrow("SELF_EDIT_MESSAGES"); - // //@ts-expect-error Something is wrong with message_reference here, TS complains since "channel_id" is optional in MessageCreateSchema + //@ts-expect-error Something is wrong with message_reference here, TS complains since "channel_id" is optional in MessageCreateSchema const new_message = await handleMessage({ ...message, // TODO: should message_reference be overridable? diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts index 54e73fc8..e350fad7 100644 --- a/src/api/util/handlers/Message.ts +++ b/src/api/util/handlers/Message.ts @@ -207,6 +207,7 @@ export async function handleMessage(opts: MessageOptions): Promise { !opts.poll && !opts.components?.length ) { + console.log("[Message] Rejecting empty message:", opts, message); throw new HTTPError("Empty messages are not allowed", 50006); } @@ -494,7 +495,7 @@ interface MessageOptions extends MessageCreateSchema { embeds?: Embed[]; reactions?: Reaction[]; channel_id?: string; - // attachments?: Attachment[]; // why are we masking this? + attachments?: Attachment[]; // why are we masking this? edited_timestamp?: Date; timestamp?: Date; username?: string;