fix message model

This commit is contained in:
Flam3rboy committed 2021-05-30 01:45:22 +02:00
1 parent f030b13bf5
commit 16099a7b24
2 files changed
+5 -3

No files matched your search

+4 -2
View File
@@ -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 = {
+1 -1
View File
@@ -8,7 +8,7 @@ export function checkToken(token: string, jwtSecret: string): Promise<any> {
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");