feat: added query

This commit is contained in:
원더 2021-01-05 10:31:15 +09:00
parent e61a5ba3f3
commit fa7c81d95d
2 changed files with 73 additions and 0 deletions

51
utils/Constatns.ts Normal file
View File

@ -0,0 +1,51 @@
export const libs = [
'discord.js',
'Eris',
'discord.py',
'discordcr',
'Nyxx',
'Discord.Net',
'DSharpPlus',
'Nostrum',
'coxir',
'DiscordGo',
'Discord4J',
'Javacord',
'JDA',
'Discordia',
'RestCord',
'Yasmin',
'disco',
'discordrb',
'serenity',
'SwiftDiscord',
'Sword',
'기타',
'비공개',
]
export const cats = [
'관리',
'뮤직',
'전적',
'웹 대시보드',
'로깅',
'도박',
'게임',
'밈',
'레벨링',
'유틸리티',
'번역',
'대화',
'NSFW',
'검색',
]
export const reportCats = [
'불법',
'괴롭힘, 모욕, 명예훼손',
'스팸, 도배, 의미없는 텍스트',
'폭력, 자해, 테러 옹호하거나 조장하는 컨텐츠',
'라이선스혹은 권리 침해',
'Discord ToS 위반',
'Koreanbots 가이드라인 위반',
'기타',
]

22
utils/Query.ts Normal file
View File

@ -0,0 +1,22 @@
import fetch from 'node-fetch'
import jwt from 'jsonwebtoken'
import fs from 'fs'
import knsexy from 'knex'
export const knex = knsexy({
client: 'mysql',
connection: {
host: process.env.MYSQL_HOST || 'localhost',
user: process.env.MYSQL_USER || 'root',
password: process.env.MYSQL_PASSWORD,
database: process.env.MYSQL_DATABASE || 'discordbots',
},
})
export async function getBot(id: string) {}
export async function getUser(id: string) {
const res = await knex('users')
.select(['id', 'avatar', 'tag', 'username', 'perm', 'github'])
.where({ id })
}