1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

SteamIDs!

This commit is contained in:
Steffo 2017-10-08 01:29:01 +02:00
parent f39b077844
commit 9380226408
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: C27544372FBB445D

16
db.py
View file

@ -72,6 +72,22 @@ class Steam(Base):
else: else:
return self.steam_id 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): def update(self):
r = requests.get(f"https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={config['Steam']['api_key']}&steamids={self.steam_id}") 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: if r.status_code != 200: