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

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:

{
  "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",
      "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: Satont API.

2 Likes

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

1 Like

Hello satont.

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

Best Regard F4CT

@f4ct_cs

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.

1 Like

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.

1 Like

Can you make one for winstreaks?

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 :slight_smile: Sorry for my english

simonkrogh2

$(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.

1 Like

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.

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

It works! Thanks so much!

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!

You mean nightbot limit?

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?