NightDev Community Forums

[CustomAPI] Csgo faceit lvl and elo

Hi Nightbot community.
Today i want provide my little api, what can show your CSGO lvl and elo on faceit.com
You can do this via eval filter.
Why eval? Because you can change how response will look in chat as you want!
So an example:
$(eval const api = $(urlfetch json http://api.satont.ru/faceit?nick=USERNAME); if (api.error) {'Error';} else { 'Lvl: ' + api['lvl'] + ' Elo: ' + api['elo'] })
Don’t forget change USERNAME to your username on faceit!

Also it’s support custom view via string, so you can just use it like:

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

You can check supported variables in docs!

Discord server for support: Satont API.

1 Like

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

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

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

2 Likes

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 http://api.satont.ru/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 http://api.satont.ru/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?