Skip to content

Commit f4d388c

Browse files
committed
fix: do not send vanity log when no changes are made
1 parent c9df8d0 commit f4d388c

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

pages/api/v2/bots/[id]/index.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -246,28 +246,29 @@ const Bots = RequestHandler()
246246
errors: ['다른 커스텀 URL로 다시 시도해주세요.'],
247247
})
248248
}
249-
250-
await webhookClients.internal.noticeLog.send({
251-
embeds: [
252-
{
253-
title: '한디리 커스텀 URL 변경',
254-
description: `봇: ${bot.name} - <@${bot.id}> ([${bot.id}](${KoreanbotsEndPoints.URL.bot(
255-
bot.id
256-
)}))`,
257-
fields: [
258-
{
259-
name: '이전',
260-
value: bot.vanity || '없음',
261-
},
262-
{
263-
name: '이후',
264-
value: validated.vanity || '없음',
265-
},
266-
],
267-
color: Colors.Blue,
268-
},
269-
],
270-
})
249+
if (validated.vanity !== bot.vanity) {
250+
await webhookClients.internal.noticeLog.send({
251+
embeds: [
252+
{
253+
title: '한디리 커스텀 URL 변경',
254+
description: `봇: ${bot.name} - <@${bot.id}> ([${
255+
bot.id
256+
}](${KoreanbotsEndPoints.URL.bot(bot.id)}))`,
257+
fields: [
258+
{
259+
name: '이전',
260+
value: bot.vanity || '없음',
261+
},
262+
{
263+
name: '이후',
264+
value: validated.vanity || '없음',
265+
},
266+
],
267+
color: Colors.Blue,
268+
},
269+
],
270+
})
271+
}
271272
}
272273
const result = await update.bot(req.query.id, validated)
273274
if (result === 0) return ResponseWrapper(res, { code: 400 })

0 commit comments

Comments
 (0)