[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

how to do this but for other regions? For example my rank in Moldova?

@tiwosslave hey is there any way you can do a “elo + trend” command
output example: Lvl: 10 Elo: 2001 Trend: WWLWL
or
Xxx, my elo is 2001 (Lvl: 10) (Trend: WWLWL)

do you have command like today elo + - and how much elo do you have in same command
need exmple ; Elo: 1874. Today: 1W, 2L, -25 elo. The current match: +24/-26 elo

Yes @Face_it_BABAofficial , you can do something like this:
$(eval const api = $(urlfetch json https://faceit.lcrypt.eu/?n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { 'Elo: ' + api.elo +(api.today.present ? '. Today: '+ api.today.win +'W, '+ api.today.lose +'L, '+ api.today.elo +' elo' : '') +(api.current.present ? '. The current match: ' + api.current.elo + ' elo' : '')})

Don’t forget to change “YOUR_FACEIT_USER” to your actual faceit username (case sensitive)

From this command you can expect three different outputs; in case the player has/hasn’t played today and if the player is/isn’t playing at the moment, you’ll get one of this:

Elo: 2885
Elo: 2290. Today: 2W, 1L, +10 elo
Elo: 3881. Today: 5W, 0L, +105 elo. The current match: +20/-30 elo

Hi, can you change this same code to get:

Xxx, my elo is 2885 (Lvl: 10).
Xxx, my elo is 2885 (Lvl: 10). Today: 2W, 1L, +10 elo.
Xxx, my elo is 2885 (Lvl: 10). Today: 5W, 0L, +105 elo. The current match: +20/-30 elo

Thanks in advance :brown_heart:

@a7fera

$(eval const api = $(urlfetch json https://faceit.lcrypt.eu/?n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { '$(user), my elo is ' + api.elo + ' (Lvl: '+ api.level +').' + (api.today.present ? ' Today: '+ api.today.win +'W, '+ api.today.lose +'L, '+ api.today.elo +' elo.' : '') +(api.current.present ? ' The current match: ' + api.current.elo + ' elo' : '')})

1 Like

pls help I want it to look like this:
Lvl: 0, Elo: 0, Today: +0, Trend: WWWWL

guys i’m trying setup command !elo but nothing work any idea?

@bladeevich

$(eval const api = $(urlfetch json https://faceit.lcrypt.eu/?n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { 'Lvl: '+ api.level +', Elo: ' + api.elo + (api.today.present ? ', Today: ' + api.today.elo : '') +', Trend: ' + api.trend })

It will show as you requested, if you haven’t played today it’ll skip the Today: elo part.

@kTxddd

Did you get it to work?

All these commands will work only if the Nightbot account is properly linked with the Twitch account.

After this, you need to visit your nightbot.tv/dashboard and press the button to make the bot join your chat, if it’s not.

The commands in the first post (and which ever command starting with !addcom) are intended for streamer/moderator to copy and paste it straight into your chat in twitch.

You can also create a custom command in your Nightbot dashboard, then you just need to paste the part since $(eval till the end.

Hello everyone,
I have noticed that the change in Elo (“elo”, “elo_win”, “elo_lose”) under “today” is no longer updated. It always remains zero. There were definitely games played today.
Have there been any changes to the Faceit API?

Kind regards
Quai

Yo, what do I put as the command to check other peoples elo? It’s the same command to check my own elo. Example, to check my own elo the command prompt is !elo. So what should the command be to check other peoples elo since I cant use the same command?

help pls make this

Elo: 3863. Today → Win: 3 Lose: 3 Elo: +1