summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-03-23 22:08:30 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-03-23 22:08:30 +0100
commit76d800209e9743181ec2101cd268231c5df140ea (patch)
treecc869f29299bf5559316224fb1bdc5185b11422c
parent:construction: [Route] /messages (diff)
downloadserver-76d800209e9743181ec2101cd268231c5df140ea.tar.xz
:bug: fix message post
-rw-r--r--src/routes/api/v8/channels/#channel_id/messages/index.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/routes/api/v8/channels/#channel_id/messages/index.ts b/src/routes/api/v8/channels/#channel_id/messages/index.ts

index 87427257..437ea3fd 100644 --- a/src/routes/api/v8/channels/#channel_id/messages/index.ts +++ b/src/routes/api/v8/channels/#channel_id/messages/index.ts
@@ -111,6 +111,9 @@ router.post("/", check(MessageCreateSchema), async (req, res) => { // TODO: should it be checked if the message exists? } + const embeds = []; + if (body.embed) embeds.push(body.embed); + const message: Message = { id: Snowflake.generate(), channel_id, @@ -118,9 +121,11 @@ router.post("/", check(MessageCreateSchema), async (req, res) => { author_id: req.user_id, content: req.body, timestamp: new Date(), + embeds, + attachments: [], }; - await new MessageModel().save(); + await new MessageModel(message).save(); await emitEvent({ event: "MESSAGE_CREATE", channel_id, data: {} } as MessageCreateEvent); });