$(eval var str=decodeURIComponent($(urlfetch json https://api.chess.com/pub/player/$(touser)/stats)); if(str==“Remote Server Returned Code 404”){ ‘Not Found’; }else{ bu=JSON.parse(str).puzzle_rush.best ? JSON.parse(str).puzzle_rush.best.score : ‘None’; ‘ $(touser) Puzzle Rush Record is 🢂’+bu})🢀 on chess.com:chess_pawn:
which is related to a chess page, this commands sends the best record in a certain part of the game called “puzzle rush”, I would like to know how to create more like this, for other types of games in the same chess page.
I have some other commands related as well which provide the specific rating a player has in different time controls chess games ( in 1 minute chess, 3 minute chess and 10 minute chess) I can send them too if necessary
I understand that you want to create similar commands based on the API; it returns JSON so it’s quite easy to set up, however, since your request is very broad, the best thing I can offer you is a quick tutorial on how to access data in a JSON.
Hi Emily, I see, I know the specific numbers but I don’t know where to send them afterwards, do I need something to send the data to? like a page or something
FIRST_NAME has PETS_AMOUNT pets, one of which is a RANDOM_PET, and their best friend is FRIEND_NUMBER_4.
Then you command will look like this:
$(eval data = $(urlfetch json API_URL); `${data.firstName} has ${data.pets.length} pets, one of which is a ${data.pets[Math.floor(Math.random() * data.pets.length)]}, and their best friend is ${data.friends[3]}.`;)
If you need further help, I’ll need an example of the data output and an example of the sentence you want to generate, like I showed you, as I can’t help blindfolded.
Sorry if it’s broad. I bring this pics to show what I would like to know if it’s possible to make. So in the command I showed in the first comment it sends this info
I can’t tell you blindfolded, your screenshots help, but I’m still missing the most important part, something similar to this:
You can get it by replacing $(touser) in the URL with your username on chess.com, I can’t know it if you don’t tell me your username, and sometimes people don’t want to give that info publicly, that’s why I offered you to show me an example of what the data looks like in JSON instead.
Now, after comparing the data displayed on the website, and the data available on the API endpoint you provided, it looks like it doesn’t include the data for Puzzle Rush → Best 5 min.
And looking at their API documentation I couldn’t find a public endpoint that would have that data.