From a15c3fba71e82e925a5752110be6e4c15452911f Mon Sep 17 00:00:00 2001 From: wonderlandpark Date: Fri, 9 Apr 2021 15:31:01 +0900 Subject: [PATCH] feat: added bot remove method --- utils/Query.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/Query.ts b/utils/Query.ts index 1cd2631..e8d0a68 100644 --- a/utils/Query.ts +++ b/utils/Query.ts @@ -225,6 +225,12 @@ async function getBotSpec(id: string, userID: string) { return serialize(res[0]) } +async function deleteBot(id: string): Promise { + const bot = await knex('bots').where({ id }).del() + + return !!bot +} + async function updateBot(id: string, data: ManageBot) { const res = await knex('bots').where({ id }) if(res.length === 0 || res[0].state !== 'ok') return 0 @@ -436,6 +442,10 @@ export const put = { submitBot } +export const remove = { + bot: deleteBot +} + export const ratelimit = { image: (ip: string) => { addRequest(ip, imageRateLimit)