1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00
royalnet/newuser.py
2018-06-05 12:33:26 +02:00

47 lines
No EOL
1.1 KiB
Python

import db
session = db.Session()
username = input("Nome account: ")
user = session.query(db.Royal).filter_by(username=username).one_or_none()
if user is None:
user = db.Royal.create(session, username)
session.add(user)
session.commit()
try:
steam = db.Steam.create(session, user.id, input("Steam ID 1: "))
except Exception as e:
print(e)
else:
session.add(steam)
try:
dota = db.Dota.create(session, steam.steam_id)
except Exception as e:
print(e)
else:
session.add(dota)
try:
rl = db.RocketLeague.create(session, steam.steam_id)
except Exception as e:
print(e)
else:
session.add(rl)
try:
osu = db.Osu.create(session, user.id, input("Osu! username: "))
except Exception as e:
print(e)
else:
session.add(osu)
try:
overwatch = db.Overwatch.create(session, user.id, input("Battle.net battletag: "))
except Exception as e:
print(e)
else:
session.add(overwatch)
try:
lol = db.LeagueOfLegends.create(session, user.id, input("League summoner name: "))
except Exception as e:
print(e)
else:
session.add(lol)
session.commit()
session.close()