diff --git a/pages/api/v2/bots/[id]/index.ts b/pages/api/v2/bots/[id]/index.ts index c9fe3dc..e4e6eaa 100644 --- a/pages/api/v2/bots/[id]/index.ts +++ b/pages/api/v2/bots/[id]/index.ts @@ -200,7 +200,7 @@ const Bots = RequestHandler() const isPerkAvailable = checkBotFlag(bot.flags, 'partnered') || checkBotFlag(bot.flags, 'trusted') - + const userInfo = await get.user.load(user) if ( ['reported', 'blocked', 'archived'].includes(bot.state) && @@ -219,7 +219,8 @@ const Bots = RequestHandler() const csrfValidated = checkToken(req, res, req.body._csrf) if (!csrfValidated) return - const validated: ManageBot = await getManageBotSchema(isPerkAvailable).validate(req.body, { abortEarly: false }) + const validated: ManageBot = await getManageBotSchema(isPerkAvailable) + .validate(req.body, { abortEarly: false }) .then((el) => el) .catch((e) => { ResponseWrapper(res, { code: 400, errors: e.errors }) @@ -241,28 +242,29 @@ const Bots = RequestHandler() errors: ['다른 커스텀 URL로 다시 시도해주세요.'], }) } - - await webhookClients.internal.noticeLog.send({ - embeds: [ - { - title: '한디리 커스텀 URL 변경', - description: `봇: ${bot.name} - <@${bot.id}> ([${bot.id}](${KoreanbotsEndPoints.URL.bot( - bot.id - )}))`, - fields: [ - { - name: '이전', - value: bot.vanity || '없음', - }, - { - name: '이후', - value: validated.vanity || '없음', - }, - ], - color: Colors.Blue, - }, - ], - }) + if (validated.vanity !== bot.vanity) { + await webhookClients.internal.noticeLog.send({ + embeds: [ + { + title: '한디리 커스텀 URL 변경', + description: `봇: ${bot.name} - <@${bot.id}> ([${ + bot.id + }](${KoreanbotsEndPoints.URL.bot(bot.id)}))`, + fields: [ + { + name: '이전', + value: bot.vanity || '없음', + }, + { + name: '이후', + value: validated.vanity || '없음', + }, + ], + color: Colors.Blue, + }, + ], + }) + } } const result = await update.bot(req.query.id, validated) if (result === 0) return ResponseWrapper(res, { code: 400 })