This commit is contained in:
Victor Fors 2022-04-06 16:49:50 +02:00
parent e733e5cd0a
commit f27ba6ba8b

27
sstatus
View File

@ -51,21 +51,30 @@ def get_player_summaries(steamids):
}
return steam_query('ISteamUser/GetPlayerSummaries/v0002', lambda data: data['response']['players'], params)
def boldgreen(string):
return '\033[92m' + '\033[1m' + string + '\033[0m'
def boldred(string):
return '\033[91m' + '\033[1m' + string + '\033[0m'
def boldgray(string):
return '\033[90m' + '\033[1m' + string + '\033[0m'
def personastate(n):
states = {
0 : 'Offline',
1 : 'Online',
2 : 'Busy',
3 : 'Away',
4 : 'Snooze',
5 : 'Looking to trade',
6 : 'Looking to play'
0 : boldred('Offline'),
1 : boldgreen('Online'),
2 : boldred('Busy'),
3 : boldgray('Away'),
4 : boldgray('Snooze'),
5 : boldgreen('Looking to trade'),
6 : boldgreen('Looking to play')
}
return states[n]
def main():
#print('\n'.join([friend['steamid'] for friend in get_friend_list(uid)]))
for player in get_player_summaries([friend['steamid'] for friend in get_friend_list(uid)]):
for player in sorted(get_player_summaries([friend['steamid'] for friend in get_friend_list(uid)]), key=lambda player: player['personaname']):
print(player['personaname'] + ': ' + personastate(player['personastate']) + (', playing ' + player['gameextrainfo'] if 'gameextrainfo' in player else ''))