Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !addcom !valorank $(eval response = `$(urlfetch json https://api.henrikdev.xyz/valorant/v1/mmr/ap/Kiki/7590)`; try { json = JSON.parse(response); currenttierpatched = json.data.currenttierpatched; currenttierpatched == null ? "None" : currenttierpatched; } catch(e) { `${e}: ${response}`.substr(0, 400)})
- Note: the URL API needs to be formatted like this: https://api.henrikdev.xyz/valorant/v1/mmr/[region]/[username]/[tagline]
- Above example of https://api.henrikdev.xyz/valorant/v1/mmr/ap/Kiki/7590 with breakdown as follows:
- [Region]
- ap = asia pacific
- na = north america
- eu = europe
- kr = korea
- If your IGN is Kiki#7590: your [username] is Kiki, your [tagline] is 7590.
- ^ This command will display as: Diamond 2.
- The below is the API response:{ "status": "200", "data": { "currenttier": 19, "currenttierpatched": "Diamond 2", "ranking_in_tier": 56, "mmr_change_to_last_game": -21, "elo": 1656 } }
- You can add more command for currenttier, ranking_in_tier, mmr_change_to_last_game and elo, just replace the variable respectively such as:
- !addcom !valoelo $(eval response = `$(urlfetch json https://api.henrikdev.xyz/valorant/v1/mmr/ap/Kiki/7590)`; try { json = JSON.parse(response); elo = json.data.elo; elo == null ? "None" : elo; } catch(e) { `${e}: ${response}`.substr(0, 400)})
- Which will return the result as: 1656.
- ---
- If you want to display like:
- [Diamond 2]: 1656.
- It will need to be like this:
- $(eval response = `$(urlfetch json https://api.henrikdev.xyz/valorant/v1/mmr/ap/Kiki/7590)`; try { json = JSON.parse(response); currenttierpatched = json.data.currenttierpatched; elo = json.data.elo; currenttierpatched && elo == null ? "None" : "[" + currenttierpatched + "]: " + elo + "."; } catch(e){`${e}: ${response}`.substr(0, 400)})
- ---
- Main (Kiki#7590 - ap region): [Diamond 3] - Ranking #29 / Elo: 1729.
- Main (Kiki#7590 - ap region): $(eval response = `$(urlfetch json https://api.henrikdev.xyz/valorant/v1/mmr/ap/Kiki/7590)`; try { json = JSON.parse(response); currenttierpatched = json.data.currenttierpatched; ranking_in_tier = json.data.ranking_in_tier; elo = json.data.elo; currenttierpatched && ranking_in_tier && elo == null ? "None" : "[" + currenttierpatched + "] - Ranking #" + ranking_in_tier + " / Elo: " + elo + "."; } catch(e){`${e}: ${response}`.substr(0, 400)})
Add Comment
Please, Sign In to add comment