World record nightbot command

Hi everyone!
Im using this command :
$(urlfetch https://speedrun.travisadaily.com/api/v1/command/record/oot 100)
to try and fetch the ocarina of time 100% world record from speedrun.com. However whenever I do this “booty hunt” is displayed instead! Im using the correct game url id which is “oot” from speedrun so I have no idea what Im doing wrong…
Thanks

update using ocarina_of_time works but now shows the master quest version not the original game…

Im not sure why am_1 deleted their post, it was correct. The solution is to use this as your urlfetch instead:

$(urlfetch https://speedrun.travisadaily.com/api/v1/command/record/$(querystring "oot 100"))

edit: nvm, i see why they did, the game is wrong

Yeah i dont know why it pulls the wrong game though oot should be ocarina

The API website is flawed. It matches the game with the id “booty” because “oot” is a substring of that. As far as I can tell the website doesn’t allow you to specify the ID exactly, without it attempting to guess what you mean.

ok i understand that part but why when i use ocarina_of_time does it pull master quest when surely thats an extenstion of the main string

I’m working on something with speedrun.com’s own API, https://www.speedrun.com/api_records.php?game=oot

so is that still in development or can it be used?

This works, but the name of the game is hardcoded.

$(eval json=$(urlfetch json https://www.speedrun.com/api_records.php?game=oot); record=json["The Legend of Zelda: Ocarina of Time"]["100%"]; hours = Math.floor(record.time / 3600); minutes = Math.floor(record.time % 3600 / 60); seconds = Math.floor(record.time % 3600 % 60); "The Legend of Zelda: Ocarina of Time's 100% record is " + hours + "h " + minutes + "m " + seconds + "m RTA by " + record.player + "!")

oh thats all i was looking for! so is that a copy and pastable command for nightbot? or does it need some changes?
gonna be using this for twitch if that helps

Just copy and paste this into Twitch chat (change the command name if you want). You can change the oot to any other game ID and it should work if it has a 100% record.

!commands add !oot $(eval json=$(urlfetch json https://www.speedrun.com/api_records.php?game=oot); title = Object.keys(json)[0]; record=json[title]["100%"]; hours = Math.floor(record.time / 3600); minutes = Math.floor(record.time % 3600 / 60); seconds = Math.floor(record.time % 3600 % 60); title + "'s 100% record is " + hours + "h " + minutes + "m " + seconds + "m RTA by " + record.player + "!")
1 Like

thanks man you are an absolute dream!

also hate to be annoying but would it be possible to use a $(querystring) to search any catagory? if so where would the querystrings need to be placed
@am_1

!commands add !record $(eval try{json=$(urlfetch json https://www.speedrun.com/api_records.php?game=$(querystring)); title = Object.keys(json)[0]; record=json[title]["100%"]; hours = Math.floor(record.time / 3600); minutes = Math.floor(record.time % 3600 / 60); seconds = Math.floor(record.time % 3600 % 60); title + "'s 100% record is " + hours + "h " + minutes + "m " + seconds + "m RTA by " + record.player + "!"}catch(e){"Invalid speedrun.com game ID"})    

I mean as in change the catagory within the game
I placed a query string instead of “100%” and it seems to work with single string catagories like MST and Glitchless but add symbols or spaces and it freaks

You want $(query) for that, $(querystring) converts characters

Use query instead of querystring

Ok so im using this as the command
$(eval json=$(urlfetch json https://www.speedrun.com/api_records.php?game=oot); title = Object.keys(json)[0]; record=json[title]["$(query)"]; hours = Math.floor(record.time / 3600); minutes = Math.floor(record.time % 3600 / 60); seconds = Math.floor(record.time % 3600 % 60); title + "'s 100% record is " + hours + "h " + minutes + "m " + seconds + "s RTA by " + record.player + “!”) but it just shows me the 100% time even when i put say !record All Medallions

Thanks guys all problems gone!
You two are the best and have a good day/night!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.