From f1a52912bd890868ac110389b7d4ddf0cb76d1b9 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Tue, 6 Apr 2021 20:51:26 +0200 Subject: [PATCH] :bug: fix message --- package-lock.json | Bin 771693 -> 771677 bytes package.json | 2 +- .../channels/#channel_id/messages/index.ts | 6 ++++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2ea05fa2f188017f11ff99d0305a1671773fb6f2..d6182d2b9d927c08eeeaefb35fcbd3011aca81c0 100644 GIT binary patch delta 171 zcmaFcqkp$Yf5TPA=DUpTcNrPC-(_SvSfFWQm}+ihW?^Y!ZkB9jY?+v7W?^PvZjx-7 zlw@R-Vwjv{V3KH-mTaOlai3xPk0K@@W(HywAZ7((HXvr-{-cN^i$#N2qo#M2b9hYO aD9A239b{m8RRsqSa{@8f_Nof*&%OY;iaj&{ delta 180 zcmccHqyM%?f5TNq4rOE0ltfdr#OAAv?N=EYw_jysI#{3q6|^(}N*Y { const channel = await ChannelModel.findOne({ id: channel_id }, { guild_id: true, type: true, permission_overwrites: true }).exec(); if (!channel) throw new HTTPError("Channel not found", 404); + // TODO: are tts messages allowed in dm channels? should permission be checked? if (channel.guild_id) { const permissions = await getPermission(req.user_id, channel.guild_id, channel_id, { channel }); @@ -113,7 +114,7 @@ router.post("/", check(MessageCreateSchema), async (req, res) => { if (body.message_reference) { if (body.message_reference.channel_id !== channel_id) throw new HTTPError("You can only reference messages from this channel"); - // TODO: should it be checked if the message exists? + // TODO: should be checked if the referenced message exists? } const embeds = []; @@ -124,7 +125,7 @@ router.post("/", check(MessageCreateSchema), async (req, res) => { channel_id, guild_id: channel.guild_id, author_id: req.user_id, - content: req.body, + content: body.content, timestamp: new Date(), mention_channels_ids: [], mention_role_ids: [], @@ -133,6 +134,7 @@ router.post("/", check(MessageCreateSchema), async (req, res) => { embeds: [], reactions: [], type: 0, + tts: body.tts, }; await new MessageModel(message).save();