[CustomAPI] Csgo Faceit lvl, elo, lifetime stats, match gain/lose elo

Asked Jan 21, 2018·50 replies·Last activity 1 year ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hi Nightbot community.

Today, I want to introduce my little api.satont.ru that can display your CSGO level and elo on faceit.com. It's super easy to use with the eval filter. Why eval? Well, because it allows you to customize the response format in the chat according to your preferences!

Here's an example:
`
$(eval const api = $(urlfetch json https://api.satont.ru/faceit?nick=USERNAME); if (api.error) {'Error';} else { 'Lvl: ' + api['lvl'] + ' Elo: ' + api['elo'] })
`
Just make sure to replace USERNAME with your actual username on faceit!

What's great is that it also supports a custom view using a string format. You can simply use it like this:
`
$(urlfetch http://api.satont.ru/faceit?nick=USERNAME&view=Lvl: {lvl}, elo: {elo} trend: {latestMatchesTrend.simple}), Current match gain: {currentMatch.gain})
`

Complex example looks like that:
`
$(urlfetch http://api.satont.ru/faceit?nick=scoffy&view=Lvl: {lvl}, elo: {elo} trend: {latestMatchesTrend.simple}), Current match gain/lose: {currentMatch.gain}/{currentMatch.lose}, Lifetime Wins: {stats.lifetime.Wins})
`

It result as: Lvl: 10, elo: 3121 trend: L, Current match gain/lose: 25/-25, Lifetime Wins: 2186

You can check supported variables in http://api.satont.ru/docs, current example response is:

json
{
"lvl": 10,
"elo": 3000,
"currentMatch": {
"gain": 28,
"lose": -30
},
"latestMatchesTrend": {
"simple": "WLWLW",
"extended": "W +10 | L -22 | W +24 | L -35 | W +28",
"score": {
"wins": 3,
"loses": 2
}
},
"todayEloDiff": "+14",
"latestMatches": [
{
"team": "team_-HEi5",
"teamScore": "16 / 11",
"map": "de_mirage",
"kd": "0.81",

50 replies

json
"hs": {
"percentage": "69",
"number": "9"
},
"eloDiff": "+27",
"kills": "13",
"death": "16",
"result": "Won"
},
{
"team": "team_-HEi5",
"teamScore": "9 / 16",
"map": "de_mirage",
"kd": "0.76",
"hs": {
"percentage": "62",
"number": "10"
},
"eloDiff": "-25",
"kills": "16",
"death": "21",
"result": "Lost"
}
],
"stats": {
"Total Headshots %": "338592",
"Current Win Streak": "2",
"Longest Win Streak": "19",
"K/D Ratio": "10318.69",
"Average K/D Ratio": "1.21",
"Win Rate %": "60",
"Average Headshots %": "40",
"Matches": "8559",
"Wins": "5163"
}
}

Discord server for support: https://discord.gg/9C6v6wyxX9.

If you command for check other user elo, use this snippet for command response:

$(eval const api = $(urlfetch json http://api.satont.dev/faceit?nick=$(querystring)); if (api.error) {'Error';} else { 'Lvl: ' + api['lvl'] + ' Elo: ' + api['elo'] })

Example:
You: !checkelo Satonteu
Nightbot: Lvl: 6 Elo: 1452

Hello satont.

I can't make it work on my friends stream. Could you sent the exact command?

Best Regard F4CT

@Serene Frog

This command setup should work:

$(eval try{a=JSON.parse(`$(urlfetch json http://api.satont.ru/faceit?nick=$(querystring))`);`Lvl: ${a[`lvl`]} Elo: ${a[`elo`]}`;}catch(e){`Invalid player nickname!`;})

Note that the nickname search is case-sensitive.

Hey, it just says invalid player nickname, what do i do??

The command setup allows you to search up a player's level and ELO. For example, if you set up a !csgo command that searches up a player's level and ELO like so:

!addcom -cd=5 !csgo $(eval try{a=JSON.parse(`$(urlfetch json http://api.satont.ru/faceit?nick=$(querystring))`);`Lvl: ${a[`lvl`]} Elo: ${a[`elo`]}`;}catch(e){`Invalid player nickname!`;})

Then you would use the command like so:

!csgo [nickname]

And note that nickname searches are case-sensitive.

What do you mean? Please describe more better.

Hello guys.
If the faceit name i wanna use to the command is Mikko2stronk, where do i type it in the command? Where should i put the name in the command if u understand me :) Sorry for my english

slight_smile.png

simonkrogh2 (link expired)

js
$(eval const api = $(urlfetch json https://api.satont.dev/faceit?nick=Mikko2stronk); if (api.error) {'Error';} else { 'Lvl: ' + api['lvl'] + ' Elo: ' + api['elo'] })

I want to set up the function where I can query a players elo using !elo [playername] but if no player name is specified, for it to fallback to a set name.

Is this possible? Im trying to keep it all under one command.

You can do some logic before the urlfetch.

$(urlfetch http://api.satont.ru/faceit?nick=$(eval decodeURIComponent(`$(querystring)`)||`fallback name`))

Nesting this thing inside another eval won't work as Nightbot only allows for two levels of variable ensting, so you won't be able to format the urlfetch output, ie make it look pretty. Only way you can format the urlfetch is to hook up the above command as an alias of another command which uses eval to format the urlfetch output.

Sassy Ram said:

Thanks for that, I was a bit confused because I had already tried nesting two of them inside each other with a catch command, and it threw errors.

Hi! I've been trying to use all of the commands you've written here but none seem to work. Some look like this: !addcom -cd=5 !checkelo Invalid player nickname! | Remote Server Returned Code 400 and others like this Unexpected identifier. Can u make on for !check elo [faceit username]. Thank you so much!

It possible via mine api. It's not well documented, but via view param you can set how api response will looks like.

js
$(urlfetch https://api.satont.dev/faceit?nick=$(eval decodeURIComponent(`$(querystring)`)||`fallback name`)&view=Lvl: {lvl}, elo: {elo})

I've released some update!

Now api can give you more information for your bot!

There is eloDiff for current day (from 00:00UTC to 24:00UTC), and latest 5 matches (can be increased if it will have point for someone)

{
"lvl": 10,
"elo": 3000,
"todayEloDiff": "+14",
"latestMatches": [
{
"team": "team_-HEi5",
"teamScore": "16 / 11",
"map": "de_mirage",
"kd": "0.81",
"hs": {
"percentage": "69",
"number": "9"
},
"eloDiff": "+27",
"kills": "13",
"death": "16",
"result": "Won"
},
{
"team": "team_-HEi5",
"teamScore": "9 / 16",
"map": "de_mirage",
"kd": "0.76",
"hs": {
"percentage": "62",
"number": "10"
},
"eloDiff": "-25",
"kills": "16",
"death": "21",
"result": "Lost"
}
]
}

Also i edited my post and added discord link for easy contact me, get support, examples for bot, request some feature or bug.

Cheers everyone who using my api!

Make please the variable names shorter, otherwise the command does not fit into the chat limit of 500 characters!

Yes. On Twitch the maximum length of command = 500 chars. "latestMatches" is toooo long. Or can you give an example of command with latest 5 matches results please?

This command won't work for some reason, I keep getting the "Unexpected Identifier" in chat.. My Faceit is HogWH (can you help?)

Update.

Just added all avaliable properties in custom view.

So now you can use all varaibles via that way: https://api.satont.dev/faceit?nick=FaceitName&view=Elo: {elo}, diff: {todayEloDiff}, lifeTimeStats: {stats.lifeTime['Matches']}

So, it's just supper all from json.

It might help, if your bot not support json for some reason.

Update.

Added trend variables.

json
"latestMatchesTrend": {
"simple": "WLWLW",
"extended": "W +10 | L -22 | W +24 | L -35 | W +28"
},

You can choose what trend you wan't to use!

Example usage:

https://api.satont.ru/faceit?nick=FaceitName&view=Elo: {elo}, diff: {todayEloDiff}, lifeTimeStats: {stats.lifeTime['Matches']}, trend: {latestMatchesTrend.simple}

Hi! Can you please explain in detail how to install it?

Just create command with folowed response:

$(urlfetch http://api.satont.dev/faceit?nick=USERNAME&view=Lvl: {lvl}, elo: {elo})

And change USERNAME with your faceit nickname (case sensitive)

how can i setup those? im so noob in scripts etc

my faceit nickname "phNTMk1nG-" btw

i named my command: "!elo" response: "as you said, but inserted my nickname. and i just literally get what i typed in response.

$(urlfetch http://api.satont.ru/faceit?nick=hasanakhiar&view=Elo: {elo}, diff: {todayEloDiff}, lifeTimeStats: {stats.lifeTime['Matches']}, trend: {latestMatchesTrend.simple}

not working

@Bold Badger You have typo. Use {stats.lifetime['Matches']}

Update:

Removed 5 matches limit for latestMatches and latestMatchesTrend, added loses and wins into api response, so you can build more customizable responses.

My faceit name is Smuli97 and i want command what show elo and my winstreak exemple: Smuli97: Elo:2076⠀win:53%⠀KD:1.09⠀Streak:0

Satont, familiar with any API to grab all 3-4 letter untaken (invalid) usernames ? old API doesn't work anymore.

@Earnest Shark hey, i dont have a overview here can you send me the code where i can show the guys: my lvl, my elo and how much elo ive made today? thanks <3

Please, make attention. Api moved to https://api.satont.dev

Hello id like a command that says elo progression
Example: Lvl:6 elo:1496 diff:0, next lvl: 7, elo needed: +55

is there any way you can make these work for fossabot

Hi, I need help, you can throw off the script for working with elo + dif urgently, I will be very grateful <3

Hello my friend thank you for this very great but im wondering if there is any way to make it not case sensitive cuz that is quite annoying for the getelo command

Added elo gain and lose into api response. Json path: currentMatch.gain , currentMatch.lose . Can be used via view via: {currentMatch.gain} , like $(urlfetch http://api.satont.dev/faceit?nick=Satonteu&view=Lvl: {lvl}, elo: {elo} trend: {latestMatchesTrend.simple}), Current match gain: {currentMatch.gain})

Hello, I want it to be displayed like this when entering this command - xsiyz, lvl: 10, elo: 2714, today: W +25. Total: +25 elo

$(urlfetch http://api.satont.ru/faceit?nick=USERNAME&view=Lvl: {lvl}, elo: {elo}, today: {latestMatchesTrend.simple}, total: {todayEloDiff} elo)

Hi, nightbot gives me the error Error Connecting To Remote Server when I try to enter the !elo command, I entered the last added code. How can I improve the situation? Thanks in advance for your answer!

Friend, I wanted a command to say the level, how many wins and losses he has and how much he gained and lost. Will it be possible to arrange it for me please?

I just wanted to say thank you and do you have paypal?
Or can I sent you a CS skin?
You didn't need to help all these people, but you did. Thank you.

Sup, Satont.I really didn't want to distract you, but the problem is... latestMatchesTrend - I can't display the latest matches.
I wanted to do "LvL: 1 Elo: 0 LastMatches: W W L L W"
I don't know if it's clear. But as I understand it, the site itself apparently crashes and latestMatchesTrend does not output anything .simple does not .extended
Nick One5et, maybe only I have such problems

Hello i would like to know if i need to download that curl stuff so i can use that api or how i use it ?

Hello Satont,

Is it possible to make it so that when the command !matchroom is used, Nightbot responds with a link to the matchroom that the streamer is currently playing?

I was just wondering if this is possible

Thank you for your work.

Didn't find your answer? The community is on Discord.

Ask on Discord