From 93802264083e2049fdf97642946a0c9ef3d3c4e5 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 8 Oct 2017 01:29:01 +0200 Subject: [PATCH] SteamIDs! --- db.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/db.py b/db.py index 6d2115b5..a01a2c33 100644 --- a/db.py +++ b/db.py @@ -72,6 +72,22 @@ class Steam(Base): else: return self.steam_id + def steam_id_1(self): + return self.steam_id + + def steam_id_2(self): + # Got this code from a random github gist. It could be completely wrong. + z = (int(self.steam_id) - 76561197960265728) // 2 + y = int(self.steam_id) % 2 + return f"STEAM_0:{y}:{z}" + + def steam_id_3(self, full=False): + # Got this code from a random github gist. It could be completely wrong. + if full: + return f"[U:1:{int(self.steam_id) - 76561197960265728}]" + else: + return f"{int(self.steam_id) - 76561197960265728}" + def update(self): r = requests.get(f"https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={config['Steam']['api_key']}&steamids={self.steam_id}") if r.status_code != 200: