diff --git a/package-lock.json b/package-lock.json index ba585fb6..f17afe1c 100644 Binary files a/package-lock.json and b/package-lock.json differ diff --git a/src/routes/channels/#channel_id/messages/index.ts b/src/routes/channels/#channel_id/messages/index.ts index 0b91a977..4b9d96a1 100644 --- a/src/routes/channels/#channel_id/messages/index.ts +++ b/src/routes/channels/#channel_id/messages/index.ts @@ -60,7 +60,11 @@ router.get("/", async (req, res) => { var query: any; if (after) query = MessageModel.find({ channel_id, id: { $gt: after } }); else if (before) query = MessageModel.find({ channel_id, id: { $lt: before } }); - else if (around) query = MessageModel.find({ channel_id, id: { $gt: around - halfLimit, $lt: around + halfLimit } }); + else if (around) + query = MessageModel.find({ + channel_id, + id: { $gt: (BigInt(around) - BigInt(halfLimit)).toString(), $lt: (BigInt(around) + BigInt(halfLimit)).toString() }, + }); else { query = MessageModel.find({ channel_id }).sort({ id: -1 }); }