summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-07-08 21:46:04 +0200
committerRory& <root@rory.gay>2026-07-15 12:03:47 +0200
commit762d72e7ac451fb71b0dbb0fa2c7b9afea29bf40 (patch)
treebc589472cf1a01f0b63bf7106ecd89dff874dfd7 /src/api
parentFix webhook message edit test (diff)
downloadserver-ts-762d72e7ac451fb71b0dbb0fa2c7b9afea29bf40.tar.xz
Fix webhook edit
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/webhooks/#webhook_id/#webhook_token/messages/#message_id.ts25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/api/routes/webhooks/#webhook_id/#webhook_token/messages/#message_id.ts b/src/api/routes/webhooks/#webhook_id/#webhook_token/messages/#message_id.ts

index 0902765c..8d69512a 100644 --- a/src/api/routes/webhooks/#webhook_id/#webhook_token/messages/#message_id.ts +++ b/src/api/routes/webhooks/#webhook_id/#webhook_token/messages/#message_id.ts
@@ -20,21 +20,9 @@ import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server/HTTPError"; import multer from "multer"; import { handleMessage, postHandleMessage, route } from "@spacebar/api/util"; -import { Attachment, Channel, Message, Webhook } from "@spacebar/database"; -import { - MessageCreateEvent, - MessageDeleteEvent, - MessageUpdateEvent, - Snowflake, - SpacebarApiErrors, - emitEvent, - getPermission, - getRights, - uploadFile, - NewUrlUserSignatureData, - DiscordApiErrors, -} from "@spacebar/util"; -import { MessageCreateAttachment, MessageCreateCloudAttachment, MessageCreateSchema, MessageEditSchema, ChannelType } from "@spacebar/schemas"; +import { Channel, Message, Webhook } from "@spacebar/database"; +import { MessageDeleteEvent, MessageUpdateEvent, emitEvent, DiscordApiErrors } from "@spacebar/util"; +import { ChannelType, WebhookExecuteSchema } from "@spacebar/schemas"; const router = Router({ mergeParams: true }); // TODO: message content/embed string length limit @@ -63,7 +51,7 @@ const messageUpload = multer({ router.patch( "/", route({ - requestBody: "MessageEditSchema", + requestBody: "WebhookExecuteSchema", responses: { 200: { body: "Message", @@ -77,7 +65,7 @@ router.patch( }), async (req: Request, res: Response) => { const { webhook_id, webhook_token, message_id } = req.params as { [key: string]: string }; - const body = req.body as MessageEditSchema; + const body = req.body as WebhookExecuteSchema; await assertValidWebhookAuth(webhook_id, webhook_token, message_id); @@ -91,7 +79,8 @@ router.patch( // TODO: should message_reference be overridable? message_reference: message.message_reference, ...body, - author_id: message.author_id, + // author_id: message.author_id, + author_id: undefined, // skip rights check webhook_id: message.webhook_id, channel_id: message.channel_id, id: message_id,