Valorant !leaderboard/!rank command

Awesome!
And yes, it’s similar to what potatoeaterlove sent.
So, to reach the number 2 here (the second leaderboardRank), the solution is the following:

$(eval a=$(urlfetch json https://REGION.api.riotgames.com/val/ranked/v1/leaderboards/by-act/ACT_ID?api_key=API_KEY); `Leaderboard ranking: ${a.players[1].leaderboardRank}`)

If you wanted to reach the number 90 (the first numberOfWins), you’d do it like this:

$(eval a=$(urlfetch json https://REGION.api.riotgames.com/val/ranked/v1/leaderboards/by-act/ACT_ID?api_key=API_KEY); `Leaderboard ranking: ${a.players[0].numberOfWins}`)

You need to replace REGION with either of these values: ap, br, eu, kr, latam, na, whichever matches with your chat or account the best, but it doesn’t matter much.
Replace ACT_ID with your actId.
And replace API_KEY with you API key, which you can find here. The fact that you use an API key means that you shouldn’t add the command through the chat, but through the dashboard so you don’t leak it.


I have a concern tho’, are you the #2, and someone else is the number #1? What makes me wonder this is that you only have the gameName field for the #2. That would mean that if you reach #1, you’d need to update the command with players[0] instead of players[1], and if you ever drop bellow #200 you won’t appear in the JSON response.
Can you confirm this? If so I’ll have to figure out another way to fetch the correct data, in which case I’ll need to know if the gameName respect the capitalization set by you, and/or what is the puuid made of?

Also, the API key expires every 24h, I wonder if that’ll be an issue.