mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 14:10:22 +00:00
chore: some changes at deny
This commit is contained in:
parent
a2c1347387
commit
b9936fcf02
@ -5,7 +5,7 @@ import RequestHandler from '@utils/RequestHandler'
|
||||
import ResponseWrapper from '@utils/ResponseWrapper'
|
||||
import { get, update } from '@utils/Query'
|
||||
import { DiscordBot, getBotReviewLogChannel } from '@utils/DiscordBot'
|
||||
import { KoreanbotsEndPoints } from '@utils/Constants'
|
||||
import { BotSubmissionDenyReasonPresetsName, KoreanbotsEndPoints } from '@utils/Constants'
|
||||
|
||||
const DenyBotSubmit = RequestHandler()
|
||||
.post(async (req: ApiRequest, res) => {
|
||||
@ -13,9 +13,12 @@ const DenyBotSubmit = RequestHandler()
|
||||
if(bot !== DiscordBot.user.id) return ResponseWrapper(res, { code: 403 })
|
||||
const submit = await get.botSubmit.load(JSON.stringify({ id: req.query.id, date: req.query.date }))
|
||||
if(!submit) return ResponseWrapper(res, { code: 404 })
|
||||
if(submit.state !== 0) return ResponseWrapper(res, { code: 400, message: '대기 중이지 않은 아이디입니다.' })
|
||||
await update.denyBotSubmission(submit.id, submit.date, req.body.reason)
|
||||
get.botSubmit.clear(JSON.stringify({ id: req.query.id, date: req.query.date }))
|
||||
await getBotReviewLogChannel().send(new MessageEmbed().setTitle('거부 됨').setColor('RED').setDescription(`[${submit.id}/${submit.date}](${KoreanbotsEndPoints.URL.submittedBot(submit.id, submit.date)})`).setTimestamp())
|
||||
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}` : ''}`)
|
||||
await getBotReviewLogChannel().send(embed)
|
||||
return ResponseWrapper(res, { code: 200 })
|
||||
})
|
||||
|
||||
@ -26,6 +29,7 @@ interface ApiRequest extends NextApiRequest {
|
||||
}
|
||||
body: {
|
||||
reason?: string
|
||||
note?: string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user