From 10c82f97b8d1b29116030e74f36bc59bb725a195 Mon Sep 17 00:00:00 2001 From: ihsangan Date: Thu, 9 May 2024 15:41:45 +0800 Subject: [PATCH] Add Valorant --- README.md | 6 ++++++ index.js | 24 +++++++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a301856..8fc2a06 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,12 @@ GET `sm?id=PLAYER_ID` GET `sus?id=SPACE_ID` **Contoh:** https://api.isan.eu.org/nickname/sus?id=15916600 +### Valorant +GET `valo?id=URLEncodedRiotIdAndTag` + +**Contoh region ID :** https://api.isan.eu.org/nickname/valo?id=yuyun%23123 + +**Contoh region non ID :** https://api.isan.eu.org/nickname/valo?id=Westbourne%23USA ## ID-REG-ONLY Dibawah ini adalah daftar game yang hanya bisa dipakai menggunakan ID yang terdaftar dari region Indonesia ### Mobile Legends: Bang Bang diff --git a/index.js b/index.js index 956d914..dcfcb2e 100644 --- a/index.js +++ b/index.js @@ -115,6 +115,28 @@ async function callAPI(request) { let result = `{"success":true,"game":"Sausage Man","id":"${id}","name":"${data.confirmationFields.username}"}` return result } + if (path.includes('/valo')) { + const body = `voucherPricePoint.id=115691&voucherPricePoint.price=15000.0&voucherPricePoint.variablePrice=0&user.userId=${id}&voucherTypeName=VALORANT&voucherTypeId=109&gvtId=139&shopLang=id_ID` + const request = new Request(endpoint, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + body + }) + const response = await fetch(request) + const data = await response.json() + if (data.success == true) { + let result = `{"success":true,"game":"VALORANT","id":"${id}","region": "Indonesia","name":"${data.confirmationFields.username}"}` + return result + } else if (data.errorCode == -200) { + let result = `{"success":true,"game":"VALORANT","id":"${id}","region": "unknown","name":"${data.confirmationFields.userId}"}` + return result + } else { + let result = `{"success":false,"message":"Cannot find nickname from your request."}` + return result + } + } if (path.includes('/ff')) { const body = `voucherPricePoint.id=8050&voucherPricePoint.price=1000.0&voucherPricePoint.variablePrice=0&user.userId=${id}&voucherTypeName=FREEFIRE&shopLang=id_ID&voucherTypeId=1&gvtId=1` const request = new Request(endpoint, { @@ -185,7 +207,7 @@ async function serveResult(request) { let dc = new URL(request.url).searchParams.get('decode') let code = 200 let result = await callAPI(request) - if (JSON.parse(result).name == undefined) { + if (result.includes(`"undefined"`)) { result = `{"success":false,"message":"Cannot find nickname from your request."}` } if (JSON.parse(result).success == false) {