feat: added bot remove method

This commit is contained in:
wonderlandpark 2021-04-09 15:31:01 +09:00
parent 8ae8aebd01
commit a15c3fba71

View File

@ -225,6 +225,12 @@ async function getBotSpec(id: string, userID: string) {
return serialize(res[0]) return serialize(res[0])
} }
async function deleteBot(id: string): Promise<boolean> {
const bot = await knex('bots').where({ id }).del()
return !!bot
}
async function updateBot(id: string, data: ManageBot) { async function updateBot(id: string, data: ManageBot) {
const res = await knex('bots').where({ id }) const res = await knex('bots').where({ id })
if(res.length === 0 || res[0].state !== 'ok') return 0 if(res.length === 0 || res[0].state !== 'ok') return 0
@ -436,6 +442,10 @@ export const put = {
submitBot submitBot
} }
export const remove = {
bot: deleteBot
}
export const ratelimit = { export const ratelimit = {
image: (ip: string) => { image: (ip: string) => {
addRequest(ip, imageRateLimit) addRequest(ip, imageRateLimit)