mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 14:10:22 +00:00
feat: added datadog metrix
This commit is contained in:
parent
ebcf251326
commit
22c8249a3c
@ -1,6 +1,7 @@
|
||||
import { NextApiRequest } from 'next'
|
||||
import rateLimit from 'express-rate-limit'
|
||||
import { MessageEmbed } from 'discord.js'
|
||||
import tracer from 'dd-trace'
|
||||
|
||||
import { CaptchaVerify, get, put, remove, update } from '@utils/Query'
|
||||
import ResponseWrapper from '@utils/ResponseWrapper'
|
||||
@ -83,6 +84,11 @@ const Bots = RequestHandler()
|
||||
})
|
||||
const userinfo = await get.user.load(user)
|
||||
await getBotReviewLogChannel().send(new MessageEmbed().setAuthor(`${userinfo.username}#${userinfo.tag}`, KoreanbotsEndPoints.URL.root + KoreanbotsEndPoints.CDN.avatar(userinfo.id, { format: 'png', size: 256 }), KoreanbotsEndPoints.URL.user(userinfo.id)).setTitle('대기 중').setColor('GREY').setDescription(`[${result.id}/${result.date}](${KoreanbotsEndPoints.URL.submittedBot(result.id, result.date)})`).setTimestamp())
|
||||
await tracer.trace('botSubmits.submitted', (async span => {
|
||||
span.setTag('id', result.id)
|
||||
span.setTag('date', result.date)
|
||||
span.setTag('user', userinfo.id)
|
||||
}))
|
||||
return ResponseWrapper(res, { code: 200, data: result })
|
||||
})
|
||||
.delete(async (req: DeleteApiRequest, res) => {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { NextApiRequest } from 'next'
|
||||
import { MessageEmbed } from 'discord.js'
|
||||
import tracer from 'dd-trace'
|
||||
|
||||
import RequestHandler from '@utils/RequestHandler'
|
||||
import ResponseWrapper from '@utils/ResponseWrapper'
|
||||
@ -19,8 +20,13 @@ const ApproveBotSubmit = RequestHandler()
|
||||
get.botSubmit.clear(JSON.stringify({ id: req.query.id, date: req.query.date }))
|
||||
get.bot.clear(req.query.id)
|
||||
const embed = new MessageEmbed().setTitle('승인').setColor('GREEN').setDescription(`[${submit.id}/${submit.date}](${KoreanbotsEndPoints.URL.submittedBot(submit.id, submit.date)})`).setTimestamp()
|
||||
if(req.body.note) embed.addField('📃 정보', req.body.note)
|
||||
if(req.body.reviewer) embed.addField('📃 정보', `심사자: ${req.body.reviewer}`)
|
||||
await getBotReviewLogChannel().send(embed)
|
||||
await tracer.trace('botSubmits.approve', (async span => {
|
||||
span.setTag('id', submit.id)
|
||||
span.setTag('date', submit.date)
|
||||
span.setTag('reviewer', req.body.reviewer)
|
||||
}))
|
||||
return ResponseWrapper(res, { code: 200 })
|
||||
})
|
||||
|
||||
@ -30,7 +36,7 @@ interface ApiRequest extends NextApiRequest {
|
||||
date: string
|
||||
}
|
||||
body: {
|
||||
note?: string
|
||||
reviewer?: string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ const DenyBotSubmit = RequestHandler()
|
||||
await update.denyBotSubmission(submit.id, submit.date, req.body.reason)
|
||||
get.botSubmit.clear(JSON.stringify({ id: req.query.id, date: req.query.date }))
|
||||
const embed = new MessageEmbed().setTitle('거부').setColor('RED').setDescription(`[${submit.id}/${submit.date}](${KoreanbotsEndPoints.URL.submittedBot(submit.id, submit.date)})`).setTimestamp()
|
||||
if(req.body.note || req.body.reason) embed.addField('📃 정보', `${req.body.reason ? `사유: ${BotSubmissionDenyReasonPresetsName[req.body.reason] || req.body.reason}\n`: ''}${req.body.note ? `${req.body.note}` : ''}`)
|
||||
if(req.body.reviewer || req.body.reason) embed.addField('📃 정보', `${req.body.reason ? `사유: ${BotSubmissionDenyReasonPresetsName[req.body.reason] || req.body.reason}\n`: ''}${req.body.reviewer ? `심사자: ${req.body.reviewer}` : ''}`)
|
||||
await getBotReviewLogChannel().send(embed)
|
||||
return ResponseWrapper(res, { code: 200 })
|
||||
})
|
||||
@ -29,7 +29,7 @@ interface ApiRequest extends NextApiRequest {
|
||||
}
|
||||
body: {
|
||||
reason?: string
|
||||
note?: string
|
||||
reviewer: string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user