[CustomAPI] faceit last games/matches api

Small Faceit (.com) api to retrieve last CS2 matches, elo, last match stats, live match data, ladder and hub info given a faceit user name.

Usage examples

!elo

!addcom -cd=5 !elo $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { '$(user), my elo is '+ api.elo +' (Lvl: '+ api.level +')' })

output: Xxx, my elo is 2001 (Lvl: 10)

!elo (short format)

!addcom -cd=5 !elo $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=YOUR_FACEIT_USER); if (!api.error) { 'Lvl: '+ api.level + ' Elo: '+ api.elo })

output: Lvl: 10 Elo: 2001

!elo (with today balance)

!addcom -cd=5 !elo $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?&n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { 'Elo: ' + api.elo +' Today: '+ api.today.elo })

output: Elo: 2426 Today: -24

!last (last matches report)

!addcom -cd=5 !last $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { '$(user) my last matches -> ' + api.report; })

output: Xxx, my last matches -> WIN 16:9 Inferno (+11), LOSE 16:13 Nuke (-24), ...)

!today (recent games win, lose count and accumulated elo)

!addcom -cd=5 !today $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?&n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { 'Today -> Win: ' + api.today.win + ' Lose: ' + api.today.lose + ' Elo: ' + api.today.elo })

output: Today -> Win: 3 Lose: 1 Elo: +50

!playing (currently playing match)

!addcom -cd=5 !playing $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?&n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { if (api.current.present) { '$(user), I\'m playing round '+ api.current.round +' on '+ api.current.map +' for '+ api.current.elo +' elo points. Game duration: '+ api.current.duration +' Server: '+ api.current.server  +' Hub: '+ api.current.what} else {'$(user), I\'m playing nothing'}})

output: Xxx, I'm playing round 24 on Mirage for +24/-26 elo points. Game duration: 35' Server: Germany Hub: 5v5 PREMIUM

!playing (short version)

!addcom -cd=5 !playing $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?&n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { '$(user), I\'m playing '+ api.playing })

output: Xxx, I'm playing FaceIt 5v5 FREE, Overpass (Germany), Elo: +22/-28

!stats (stats from the last played match)

!addcom -cd=5 !stats $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { '$(user) my last match stats -> ' + api.last_match })

output: Xxx my last match stats -> Victory on Inferno (16:9), KAD: 12/5/20 KDR: 0.6 HS: 50% MVP: 2 ELO: +11)

!ladder (ladder info)

!addcom -cd=5 !ladder $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { '$(user), I\'m ranked '+ api.ladder })

output: I'm ranked 24 on EU Master League (PTS: 797 W/P: 100/167 WR: 0.6))

!fpl (eu fpl ranking, if playing it, this command is outdated, use !hub command below)

!addcom -cd=5 !fpl $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { api.fpl })

output: Ranking: 144 (Pts: 1482 WR: 0/2 Last: LOSE 16:9 Mirage)

!hub (user rank on whatever hub you want)

!addcom -cd=5 !hub $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?o=hub&n=YOUR_FACEIT_USER&h=FACEIT_HUB_ID); if (api.error) {api.message;} else { api.hub })

output: Ranking: 144 (Pts: 1482 WR: 0/2 Last: LOSE 16:9 Mirage)

Remember that your FACEIT USER NAME IS CASE SENSITIVE, copy it from faceit.

FACEIT_HUB_ID: only for !hub command example, you can get it from the faceit hub url on the address bar, itā€™s a value like 74caad23-077b-4ef3-8b1d-c6a2254dfa75 (this is the value for FPL EU, default value) .

Ladder data may wonā€™t be available for players not participating onā€¦ Iā€™ve added ladder detailed data, so you can create more flexible commands fitting your needs. Check the second post to find out the available detailed data.

LANGUAGE: Most literals returned by the api can be translated by adding the parameter ā€œ&l=LANGUAGE_CODEā€ to the url. Available language codes are: en (English) no (Norwegian) es (Spanish). If needed, please, ask for your language here.

Examples to get data from any faceit user in your chat (eg: !elo s1mple)

Basically replace YOUR_FACEIT_USER with $(touser) and adapt the text.

Elo command (usage: !elo s1mple)

!addcom -cd=5 !elo $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=$(touser)); if (api.error) {api.message;} else { '$(user), $(touser) elo is '+ api.elo +' (Lvl: '+ api.level +')' })

Last games report (usage: !last s1mple)

!addcom -cd=5 !last $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=$(touser)); if (api.error) {api.message;} else { '$(user) last $(touser) matches -> ' + api.report; })

Last game stats (usage: !stats s1mple)

!addcom -cd=5 !stats $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=$(touser)); if (api.error) {api.message;} else { '$(user) last $(touser) match stats -> ' + api.last_match })

Ladder info (usage: !ladder FlipiN)

!addcom -cd=5 !ladder $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=$(touser)); if (api.error) {api.message;} else { '$(user), $(touser) is ranked '+ api.ladder })

Contact me here if you will find some bugs/errors.

1 Like

Current api output:

{
    "elo": 3202,
    "level": "10",
    "playing": "FaceIt 5v5 PREMIUM, Vertigo (Netherlands), Elo: +23/-27",
    "current": {
        "present": true,
        "elo": "+23/-27",
        "map": "Vertigo",
        "server": "Netherlands",
        "what": "5v5 PREMIUM",
        "status": "LIVE",
        "score": "14:14",
        "result": "drawing"
    },
    "today": {
        "present": true,
        "count": 2,
        "elo": "+14",
        "elo_win": 35,
        "elo_lose": 21,
        "win": 1,
        "lose": 1
    },
    "detail": {
        "ladder": {
            "division": "Master League",
            "played": 36,
            "points": 81,
            "position": 1575,
            "present": true,
            "region": "EU",
            "win_rate": 0.47,
            "won": 17
        }
    },
    "ladder": "1575 on EU Master League (PTS: 81 W/P: 17/36 WR: 0.47)",
    "report": "WIN 16:6 Mirage (+35), LOSE 16:6 Vertigo (-21), LOSE 16:8 Inferno (-14), LOSE 10:16 Nuke (-26), WIN 11:16 Nuke (+24)",
    "trend": "WLLLW",
    "last_match": "Victory on Mirage (16:6), KAD: 11/6/14 KDR: 0.79 HS: 45% MVP: 4 ELO: +35",
    "hub": "Position 81 (WR: 1/5 Pts: 1480 Last: LOSE 16:8 Vertigo)",
    "region": "EU",
    "country": "ca",
    "country_flag":"šŸ‡ØšŸ‡¦",
    "region_ranking": 65269,
    "country_ranking": 109,
    "error": false
}

Notes:

For backward compatibility ā€œhubā€ is named ā€œfplcā€ when no o=hub param is given

1 Like

Hello, is it possible to create command, which will print out possible win/lose elo of current match of certain player?

@Javier_Fernandez
Is there any way you could specify how to set it up? Like, mine always say ā€œplayer not foundā€
Faceit ID is: Proxi

@proxi

Elo command (command: !elo)
!addcom -cd=5 !elo $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=Proxi); if (api.error) {api.message;} else { '$(user), my elo is '+ api.elo +' (Lvl: '+ api.level +')' })

Last games report command (command: !last)
!addcom -cd=5 !last $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=Proxi); if (api.error) {api.message;} else { '$(user) my last matches -> ' + api.report; })

Last game stats command (command: !stats)
!addcom -cd=5 !stats $(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?n=Proxi); if (api.error) {api.message;} else { '$(user) my last match stats -> ' + api.last_match })

@fimmer

I gonna try but at this moment I donā€™t know how to get this data once the match has started.

1 Like

@Javier_Fernandez, thank you my guy!

Is there a way how i can use it for six siege when i play on ps4 username NoVeM_Shotgone

hey, is there someway you can or i can change the output to say: Nederlag pĆ„ Inferno insteed of: Defeat on Inferno? And how to i input the ā€œtrendā€ in the command?

And, is it possible to make 1 command for all 3^^ So it says, Lvl 10: 2506 and then the last match history and the trend at last?

@f1lskov try this, for instance

$(eval const api = $(urlfetch json http://api.faceit.myhosting.info:81/?l=YOUR_LANGUAGE&n=YOUR_FACEIT_USER); if (api.error) {api.message;} else { '$(user) --> Lvl '+ api.level +': '+ api.elo +' << '+ api.report +' << '+ api.trend +' << Last game stats: ' + api.last_match })

Output example:
Lvl 7: 1696 << LOSE 19:17 Inferno (-25), WIN 10:16 Inferno (+21), WIN 10:16 Mirage (+22), LOSE 16:8 Inferno (-25), LOSE 16:9 Mirage (-25) << LWWLL << Last game stats: Defeat on Inferno (19:17), KAD: 29/3/23 KDR: 1.26 HS: 31% MVP: 6 ELO: -25

You must replace
YOUR_FACEIT_USER by your faceit user id, remember itā€™s case sensitive.
YOUR_LANGUAGE by your language code (available codes are: Norwegian = no, Spanish = es, English = en)

In this command, where it says ā€œLast game statsā€ you can rewrite with whatever you want. Everything between single quotes is editable.

Hi there. Iā€™ve added a new command !ladder. Find out how to add it on the first post.

This command will give info about the faceit league, current position, points and win rate.

Posible output for command !ladder
I'm ranked 104 on EU Master League (PTS: 419 W/P: 55/94 WR: 0.59)

@Javier_Fernandez 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)

!fplc aint working it says ā€˜[Error Connecting To WebEval Service]ā€™ what can i do?

Hello @f4ct_cs.

Iā€™ve fixed to show an ā€œerrorā€ message: ā€œ[player] is not currently playing FPLCā€. When no actively playing fplc games.

The reason is that I canā€™t have knowledge of the last season youā€™ve played, so I can only rely on last early games data.

hi, !fplc doesnt work. Bot says that (fplc player name) is not playing FPLC . How to fix it? p.s. iā€™m inputting correct YOUR_FACEIT_USERŠ‘ŠµŠ· Š½Š°Š·Š²Š°Š½Šøя (15)

Is it possible to get a stats command for last 20 matches? the stats faceit enhancer provides just in a twitch command instead?

@Javier_Fernandez I have a javascript function which calculates the stats of the last 20 match statistics. If it is possible, I can give you the script to add this to your API ?

I fixed fplc data some week ago.

@dietze if you still have this I can try to include it. Sounds good. Iā€™ve added cache system so I stopped mashing up faceit and wherever I get data.

Iā€™m sorry for the big delay but I fixed this in last weeks. Iā€™ve included an option to get the user ranking from any faceit hub, specifying itā€™s faceit hub id.

So if you still have this need youā€™ll get this info from FPL, FPLC or whatever hub you need.

Just give look to the main post.

Finally I found the way and the api returns this data on field api.playing.elo, give a look to the second post.

Also I added to the main post a new suggested !playing command with data about the currently playing match.

Added !today command with recent consecutive matches resume of wins, loses and elo balance.

Iā€™ve also added detailed data of current match so you can play with and create your own customized output.