diff --git a/utils/Query.ts b/utils/Query.ts index 29ee381..22481d3 100644 --- a/utils/Query.ts +++ b/utils/Query.ts @@ -14,7 +14,7 @@ import { sign, verify } from './Jwt' export const imageRateLimit = new TLRU({ maxAgeMs: 60000 }) -async function getBot(id: string, owners=true) { +async function getBot(id: string, owners=true):Promise { const res = await knex('bots') .select([ 'id', @@ -61,7 +61,7 @@ async function getBot(id: string, owners=true) { return res[0] ?? null } -async function getUser(id: string, bots = true) { +async function getUser(id: string, bots = true):Promise { const res = await knex('users') .select(['id', 'perm', 'github']) .where({ id }) @@ -203,7 +203,7 @@ async function getImage(url: string):Promise { } async function getDiscordUser(id: string):Promise { - return DiscordBot.users.cache.get(id) ?? await DiscordBot.users.fetch(id, false, true).then(u => u).catch(()=>null) + return DiscordBot.users.cache.get(id) ?? await DiscordBot.users.fetch(id, false, true).then(u => u.toJSON()).catch(()=>null) } async function assignToken(info: TokenRegister):Promise {