summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--package-lock.json8
-rw-r--r--package.json2
-rw-r--r--src/routes/channels/#channel_id/messages/index.ts6
3 files changed, 9 insertions, 7 deletions
diff --git a/package-lock.json b/package-lock.json

index 2ea05fa2..d6182d2b 100644 --- a/package-lock.json +++ b/package-lock.json
@@ -16,7 +16,7 @@ "dotenv": "^8.2.0", "express": "^4.17.1", "express-validator": "^6.9.2", - "fosscord-server-util": "github:fosscord/fosscord-server-util#35da56a", + "fosscord-server-util": "github:fosscord/fosscord-server-util", "i18next": "^19.8.5", "i18next-http-middleware": "^3.1.0", "i18next-node-fs-backend": "^2.1.3", @@ -4614,7 +4614,7 @@ }, "node_modules/fosscord-server-util": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#35da56a905da28d8114225f2cec2b2c7a4166de6", + "resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#41e72689476c639aa686074c9bb22d1cb04a6fc4", "license": "ISC", "dependencies": { "jsonwebtoken": "^8.5.1", @@ -16151,8 +16151,8 @@ "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" }, "fosscord-server-util": { - "version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#35da56a905da28d8114225f2cec2b2c7a4166de6", - "from": "fosscord-server-util@github:fosscord/fosscord-server-util#35da56a", + "version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#41e72689476c639aa686074c9bb22d1cb04a6fc4", + "from": "fosscord-server-util@github:fosscord/fosscord-server-util", "requires": { "jsonwebtoken": "^8.5.1", "lambert-db": "^1.1.7", diff --git a/package.json b/package.json
index 52cb5222..f0b540e7 100644 --- a/package.json +++ b/package.json
@@ -28,7 +28,7 @@ "dotenv": "^8.2.0", "express": "^4.17.1", "express-validator": "^6.9.2", - "fosscord-server-util": "github:fosscord/fosscord-server-util#35da56a", + "fosscord-server-util": "github:fosscord/fosscord-server-util", "i18next": "^19.8.5", "i18next-http-middleware": "^3.1.0", "i18next-node-fs-backend": "^2.1.3", 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();