mirror of
https://github.com/koreanbots/core.git
synced 2025-12-16 14:30:22 +00:00
feat: logging for v1
This commit is contained in:
parent
c0353e3fe6
commit
71fa4194e6
@ -1,10 +1,14 @@
|
|||||||
import { NextApiRequest} from 'next'
|
import { NextApiRequest} from 'next'
|
||||||
import rateLimit from 'express-rate-limit'
|
import rateLimit from 'express-rate-limit'
|
||||||
|
|
||||||
|
|
||||||
import { get, update } from '@utils/Query'
|
import { get, update } from '@utils/Query'
|
||||||
import RequestHandler from '@utils/RequestHandler'
|
import RequestHandler from '@utils/RequestHandler'
|
||||||
import ResponseWrapper from '@utils/ResponseWrapper'
|
import ResponseWrapper from '@utils/ResponseWrapper'
|
||||||
import { BotStatUpdate, BotStatUpdateSchema } from '@utils/Yup'
|
import { BotStatUpdate, BotStatUpdateSchema } from '@utils/Yup'
|
||||||
|
import { discordLog } from '@utils/DiscordBot'
|
||||||
|
import { KoreanbotsEndPoints } from '@utils/Constants'
|
||||||
|
import { makeDiscordCodeblock } from '@utils/Tools'
|
||||||
|
|
||||||
const limiter = rateLimit({
|
const limiter = rateLimit({
|
||||||
windowMs: 60 * 1000,
|
windowMs: 60 * 1000,
|
||||||
@ -37,6 +41,8 @@ const BotStats = RequestHandler()
|
|||||||
if(botInfo.id !== bot) return ResponseWrapper(res, { code: 403, version: 1 })
|
if(botInfo.id !== bot) return ResponseWrapper(res, { code: 403, version: 1 })
|
||||||
const d = await update.updateServer(botInfo.id, validated.servers)
|
const d = await update.updateServer(botInfo.id, validated.servers)
|
||||||
if(d===1 || d===2) return ResponseWrapper(res, { code: 403, message: `서버 수를 ${[null, '1만', '100만'][d]} 이상으로 설정하실 수 없습니다. 문의해주세요.`, version: 1 })
|
if(d===1 || d===2) return ResponseWrapper(res, { code: 403, message: `서버 수를 ${[null, '1만', '100만'][d]} 이상으로 설정하실 수 없습니다. 문의해주세요.`, version: 1 })
|
||||||
|
get.bot.clear(bot)
|
||||||
|
await discordLog('BOT/STATS', botInfo.id, (new MessageEmbed().setDescription(`${botInfo.name} - <@${botInfo.id}> ([${botInfo.id}](${KoreanbotsEndPoints.URL.bot(botInfo.id)}))`)), null, makeDiscordCodeblock(`${botInfo.servers > validated.servers ? '-' : '+'} ${botInfo.servers} -> ${validated.servers} (${botInfo.servers > validated.servers ? '▼' : '▲'}${Math.abs(validated.servers - botInfo.servers)})`, 'diff'))
|
||||||
return ResponseWrapper(res, { code: 200, message: '성공적으로 업데이트 했습니다.', version: 1 })
|
return ResponseWrapper(res, { code: 200, message: '성공적으로 업데이트 했습니다.', version: 1 })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user