I've been developing a discord bot for the game Counter Strike Global Offensive and upon me trying to widen its features i've come across something i've never seen before. I have been looking for the past 4 hours and can't find anything related close enough for me to make a connection. I am using this plugin for the game that places a text file in my servers directory that I will be FTPing to gain access to (I got that part down pretty easily). https://github.com/splewis/get5/wiki/Stats-system
I do have my users stats and soon to be settings that are stored on a json file, but thats with a format that I know of, this file is generated by the game server whenever I run a command (ill be doing it with another plugin at the end of each game automatically) so I have no control of changing the format.
What i'm trying to do: Read specific lines of data from a unknown structured text file and turn those into strings after each game.
My code (just reading the text file)
with open('get5_matchstats.cfg', 'r') as file:
data = file.read()
print(data)
Output (exact same as text file):
"Stats"
{
"series_type" "bo1"
"map0"
{
"team1"
{
"76561628991367478"
{
"roundsplayed" "7"
"name" "CoC Legende"
"deaths" "3"
"damage" "415"
"kills" "4"
"headshot_kills" "2"
"1kill_rounds" "4"
"firstdeath_ct" "2"
"firstkill_ct" "1"
}
"7655212110096592"
{
"roundsplayed" "7"
"name" "payperview"
"deaths" "2"
"firstdeath_ct" "1"
"damage" "672"
"kills" "6"
"1kill_rounds" "1"
"headshot_kills" "3"
"3kill_rounds" "1"
"firstkill_ct" "1"
"assists" "1"
"2kill_rounds" "1"
}
"76561198821291593"
{
"roundsplayed" "7"
"name" "dog"
"damage" "458"
"deaths" "3"
"assists" "1"
"firstdeath_ct" "1"
"firstkill_ct" "2"
"kills" "4"
"1kill_rounds" "1"
"headshot_kills" "2"
"3kill_rounds" "1"
}
"76561668131605879"
{
"roundsplayed" "7"
"name" "Cat"
"damage" "640"
"firstkill_ct" "1"
"kills" "7"
"2kill_rounds" "1"
"bomb_defuses" "1"
"1kill_rounds" "5"
"tradekill" "1"
"headshot_kills" "1"
}
"76566648819479703"
{
"roundsplayed" "7"
"name" "BackAndImBetter"
"damage" "801"
"kills" "9"
"3kill_rounds" "2"
"firstkill_ct" "1"
"headshot_kills" "3"
"assists" "1"
"2kill_rounds" "1"
"deaths" "1"
"bomb_defuses" "1"
"1kill_rounds" "1"
}
"score" "6"
}
"team2"
{
"76561198120865213"
{
"roundsplayed" "7"
"name" "Squid"
"damage" "231"
"deaths" "6"
"firstdeath_t" "2"
"kills" "1"
"headshot_kills" "1"
"1kill_rounds" "1"
}
"76561198355321210"
{
"roundsplayed" "7"
"name" "Chub vc_0"
"damage" "106"
"kills" "1"
"deaths" "6"
"1kill_rounds" "1"
"firstdeath_t" "1"
}
"76561197963353523"
{
"roundsplayed" "7"
"name" "Bravo"
"damage" "630"
"assists" "1"
"deaths" "6"
"firstdeath_t" "1"
"bomb_plants" "2"
"kills" "3"
"1kill_rounds" "1"
"firstkill_t" "1"
"2kill_rounds" "1"
}
"76561198111573735"
{
"roundsplayed" "7"
"name" "Manager"
"damage" "255"
"firstkill_t" "2"
"kills" "3"
"headshot_kills" "1"
"deaths" "6"
"2kill_rounds" "1"
"1kill_rounds" "1"
"firstdeath_t" "2"
}
"76561198853686342"
{
"roundsplayed" "7"
"name" "Compliment"
"damage" "282"
"deaths" "6"
"assists" "1"
"firstkill_t" "1"
"kills" "1"
"headshot_kills" "1"
"1kill_rounds" "1"
}
"score" "0"
}
"mapname" "de_season"
}
}
Process finished with exit code 0
Before needing this information I will have their steam64ID (the large set of numbers) which I will use to create a link between their discord account and game stats.
The only thing I believe I need help with is figuring how specifically to get things like team score, user kills, deaths, damage etc.
Thanks a lot for your guys' time, having this bit of knowledge will help me progress my bot significantly.