[CustomAPI] faceit last games/matches api

I have figured out how to use all the variables in different context from the api data. But one thing i doesnt understand is the difference between “urlfetch json” and “eval const api”, and ofc the: “-cd=5” that u use a lot infront of the commands. Could you maybe explain those 3, so i have a full understanding of what im actually typing? :slight_smile:

$(urlfetch) tells nightbot to acess a website… json tells him what kinda data he’s lookin for… $(eval) tells him to evaluate javascript code… const is javascript code declaring a constant variable… api in this instance, is the name of the variable being declared… and -cd=5 sets the cooldown of the command to 5 seconds when u’re typing it from the chat using the !addcom or the !commands add command

As requested by dm I’ve added TLS encryption certificates in order to have secure urls.

You’d also see I’ve edited my posts with a new domain. That’s because I don’t have full control over the old one. The previous domain (api.faceit.myhosting.info) will continue work, but it’s recommended update urls to the new one, cause I can’t guarantee it’s life time.

1 Like

Hello, would it be able to add an api for position in elo, for example.

“PLAYER is Ranked #23 with an ELO of 3756 in EU on Faceit”

and then you can EU/NA/OCE/WORLD etc… maybe this is already doable with api.ladder already, but any help would be nice :slight_smile:

@hauntlex api.region and api.region_ranking are the fields for user region rank.

$(eval const api = $(urlfetch json https://faceit.lcrypt.eu/?n=$(touser)); if (api.error) {api.message;} else { '$(touser) is Ranked #' + api.region_ranking + ' with an ELO of '+ api.elo + ' in '+ api.region + ' on Faceit' })

This eval will give your desired output:
fl0m is Ranked #32 with an ELO of 3443 in NA on Faceit

I used fl0m in this example but you can hardcode your player by replacing both $(touser) references in the eval with your player id.

Super, did you make this just now or was it always available? Sick eitherway, thanks <3

This data was added on last february 20th