From 33c3670cabc8a128442d7f405f255ba85f686524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9B=90=EB=8D=94?= Date: Tue, 5 Jan 2021 11:40:53 +0900 Subject: [PATCH] types: added types --- utils/Query.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/Query.ts b/utils/Query.ts index 521ea14..41d5086 100644 --- a/utils/Query.ts +++ b/utils/Query.ts @@ -2,6 +2,7 @@ import fetch from 'node-fetch' import jwt from 'jsonwebtoken' import fs from 'fs' import knsexy from 'knex' +import { Bot, User } from '../types' const publicPem = fs.readFileSync('./public.pem') const privateKey = fs.readFileSync('./private.key') @@ -16,7 +17,7 @@ export const knex = knsexy({ }, }) -export async function getBot(id: string, owners=true) { +export async function getBot(id: string, owners=true):Promise { const res = await knex('bots').select(['id', 'owners', 'lib', 'prefix', 'votes', 'servers', 'intro', 'desc', 'web', 'git', 'url', 'category', 'status', 'name', 'avatar', 'tag', 'verified', 'trusted', 'partnered', 'discord', 'boosted', 'state', 'vanity', 'bg', 'banner']).where({ id }).orWhere({ vanity: id, boosted: 1 }) if(res[0]) { res[0].category = JSON.parse(res[0].category) @@ -30,7 +31,7 @@ export async function getBot(id: string, owners=true) { return res[0] || null } -export async function getUser(id: string, bots=true) { +export async function getUser(id: string, bots=true):Promise { const res = await knex('users').select(['id', 'avatar', 'tag', 'username', 'perm', 'github']).where({ id }) if(res[0]) { const owned = await knex('bots').select(['id']).where('owners', 'like', `%${id}%`)