summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-04-06 20:51:26 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-04-06 20:51:26 +0200
commitf1a52912bd890868ac110389b7d4ddf0cb76d1b9 (patch)
tree8a36e3d609dc4a33126b7d51b25f90d2b3869d76 /src
parent:bug: revert login (diff)
downloadserver-f1a52912bd890868ac110389b7d4ddf0cb76d1b9.tar.xz
:bug: fix message
Diffstat (limited to 'src')
-rw-r--r--src/routes/channels/#channel_id/messages/index.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/routes/channels/#channel_id/messages/index.ts b/src/routes/channels/#channel_id/messages/index.ts

index 4b9d96a1..7b4b3ec0 100644 --- a/src/routes/channels/#channel_id/messages/index.ts +++ b/src/routes/channels/#channel_id/messages/index.ts
@@ -98,6 +98,7 @@ router.post("/", check(MessageCreateSchema), async (req, res) => { 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();