From fa7c81d95d6e440921bc27fd91f656ef34cc52c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9B=90=EB=8D=94?= Date: Tue, 5 Jan 2021 10:31:15 +0900 Subject: [PATCH] feat: added query --- utils/Constatns.ts | 51 ++++++++++++++++++++++++++++++++++++++++++++++ utils/Query.ts | 22 ++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 utils/Constatns.ts create mode 100644 utils/Query.ts diff --git a/utils/Constatns.ts b/utils/Constatns.ts new file mode 100644 index 0000000..8e87caf --- /dev/null +++ b/utils/Constatns.ts @@ -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 가이드라인 위반', + '기타', +] diff --git a/utils/Query.ts b/utils/Query.ts new file mode 100644 index 0000000..eb37c44 --- /dev/null +++ b/utils/Query.ts @@ -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 }) +}