From c6c5d34f9d30ff7c42fd1bfc56b35e4e693ce96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Fri, 26 Jan 2024 16:40:46 +0100 Subject: [PATCH] faceit: Print CS2 elo --- faceit.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/faceit.go b/faceit.go index aaf4a65..1e88023 100644 --- a/faceit.go +++ b/faceit.go @@ -24,9 +24,9 @@ type faceitClient struct { type playerInfo struct { PlayerID string `json:"player_id"` Games struct { - CSGO struct { + CS2 struct { Elo int `json:"faceit_elo"` - } `json:"csgo"` + } `json:"cs2"` } `json:"games"` } @@ -59,7 +59,7 @@ func (b *bot) getElo(channel string, parsed []string) (int, error) { var url string if len(parsed) > 1 { - url = fmt.Sprintf("https://open.faceit.com/data/v4/players?nickname=%s&game=csgo", parsed[1]) + url = fmt.Sprintf("https://open.faceit.com/data/v4/players?nickname=%s&game=cs2", parsed[1]) } else { playerID, err := b.getPlayerID(channel) if err != nil { @@ -75,7 +75,7 @@ func (b *bot) getElo(channel string, parsed []string) (int, error) { return 0, err } - return player.Games.CSGO.Elo, nil + return player.Games.CS2.Elo, nil } func (b *bot) getPlayerID(channel string) (string, error) { @@ -95,7 +95,7 @@ func (b *bot) getPlayerID(channel string) (string, error) { func (b *bot) setFaceitID(faceitAPIKey string, channel string, name string) error { client := newFaceitClient(faceitAPIKey) - url := fmt.Sprintf("https://open.faceit.com/data/v4/players?nickname=%s&game=csgo", name) + url := fmt.Sprintf("https://open.faceit.com/data/v4/players?nickname=%s&game=cs2", name) player, err := client.getPlayerInfo(url) if err != nil { -- 2.44.0