fix: api bug

This commit is contained in:
wonderlandpark 2021-05-29 01:00:26 +09:00
parent c305a4f6bb
commit 8fb2bb9eef

View File

@ -9,7 +9,7 @@ const BotVoted = RequestHandler()
.get(async (req: ApiRequest, res) => {
const bot = await get.BotAuthorization(req.headers.token)
if(!bot) return ResponseWrapper(res, { code: 401, version: 1 })
const userID = await Yup.string().required().validate(bot).then(el => el).catch(() => null)
const userID = await Yup.string().required().validate(req.query.id).then(el => el).catch(() => null)
if(!userID) return ResponseWrapper(res, { code: 400, version: 1 })
const result = await get.botVote(userID, bot)
return res.json({ code: 200, voted: +new Date() < result + VOTE_COOLDOWN })