From 16099a7b245bf89b1c793d068fa94a1b252a91f8 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sun, 30 May 2021 01:45:22 +0200 Subject: [PATCH] fix message model --- src/models/Message.ts | 6 ++++-- src/util/checkToken.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/models/Message.ts b/src/models/Message.ts index e39c2416..c8ea8395 100644 --- a/src/models/Message.ts +++ b/src/models/Message.ts @@ -125,8 +125,9 @@ export interface Attachment { size: number; // size of file in bytes url: string; // source url of file proxy_url: string; // a proxied url of file - height: number; // height of file (if image) - width: number; // width of file (if image) + height?: number; // height of file (if image) + width?: number; // width of file (if image) + content_type?: string; } export interface Embed { @@ -205,6 +206,7 @@ export const Attachment = { proxy_url: String, // a proxied url of file height: Number, // height of file (if image) width: Number, // width of file (if image) + content_type: String, }; export const EmbedImage = { diff --git a/src/util/checkToken.ts b/src/util/checkToken.ts index 1a52b5b9..73ffb670 100644 --- a/src/util/checkToken.ts +++ b/src/util/checkToken.ts @@ -8,7 +8,7 @@ export function checkToken(token: string, jwtSecret: string): Promise { if (err || !decoded) return rej("Invalid Token"); const user = await UserModel.findOne({ id: decoded.id }, { "user_data.valid_tokens_since": true }).exec(); - if (!user) return rej("User not found"); + if (!user) return rej("Invalid Token"); if (decoded.iat * 1000 < user.user_data.valid_tokens_since.getTime()) return rej("Invalid Token"); if (user.disabled) return rej("User disabled"); if (user.deleted) return rej("User not found");