fix: unable to edit if webhook is null (#551)

* fix: unable to edit if webhook is null

* fix: use null instead of true

* fix: equivalent bug in servers
This commit is contained in:
Eunwoo Choi 2023-04-08 17:22:51 +09:00 committed by GitHub
parent 72843bfeb1
commit 336300bd9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -158,7 +158,7 @@ const Bots = RequestHandler()
})
if (!validated) return
const key = await verifyWebhook(validated.webhookURL)
const key = validated.webhookURL ? await verifyWebhook(validated.webhookURL) : null
if(key === false) {
return ResponseWrapper(res, { code: 400, message: '웹후크 주소를 검증할 수 없습니다.', errors: ['웹후크 주소가 올바른지 확인해주세요.\n웹후크 주소 검증에 대한 자세한 내용은 API 문서를 참고해주세요.'] })
}

View File

@ -138,7 +138,7 @@ const Servers = RequestHandler()
const invite = await DiscordBot.fetchInvite(validated.invite).catch(() => null)
if(invite?.guild.id !== server.id || invite.expiresAt) return ResponseWrapper(res, { code: 400, message: '올바르지 않은 초대코드입니다.', errors: ['입력하신 초대코드가 올바르지 않습니다. 올바른 초대코드를 입력했는지 다시 한 번 확인해주세요.', '만료되지 않는 초대코드인지 확인해주세요.'] })
const key = await verifyWebhook(validated.webhook)
const key = validated.webhook ? await verifyWebhook(validated.webhook) : null
if(key === false) {
return ResponseWrapper(res, { code: 400, message: '웹후크 주소를 검증할 수 없습니다.', errors: ['웹후크 주소가 올바른지 확인해주세요.\n웹후크 주소 검증에 대한 자세한 내용은 API 문서를 참고해주세요.'] })
}