Compare commits

...

2 Commits

Author SHA1 Message Date
confestim
3c6f96d1dd merge 2023-05-05 16:30:00 +02:00
confestim
384a239b13 Some changes within the client, for clarity 2023-05-05 16:28:48 +02:00
4 changed files with 76 additions and 15 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ config*
db.sqlite3
__pycache__/
migrations/
build/
dist/

View File

@ -56,12 +56,12 @@ async def parse_history(connection, history:dict, old_ids:list) -> list:
parsed_matches = []
new = 0
for i in history["games"]["games"]:
if i["gameType"] == "CUSTOM_GAME" and str(i["gameId"]) not in old_ids:
if i["gameType"] == "CUSTOM_GAME" and str(i["gameId"]) not in old_ids and not i["gameMode"] == "PRACTICETOOL":
new += 1
match = await connection.request('get', f'/lol-match-history/v1/games/{i["gameId"]}')
match = await match.json()
#print(match)
print(match)
parsed_match = {
"game_id": match["gameId"],
"participants": {
@ -89,7 +89,8 @@ async def parse_history(connection, history:dict, old_ids:list) -> list:
parsed_match["participants"]["t2"]["summoners"].append({"name":match["participantIdentities"][player]["player"]["summonerName"], "kda": calculate_kda(kills, assists, deaths)})
parsed_matches.append(parsed_match)
if not new:
print("Already up to date, thanks.")
print("Already up to date, thanks. Program will now close.")
time.sleep(3)
sys.exit()
return parsed_matches
@ -114,12 +115,25 @@ async def connect(connection):
except IndexError:
print("User does not exist, register through discord please.")
print("Program will now close")
time.sleep(5)
sys.exit()
# Case 3: It belongs to nobody and has yet to be claimed.
if not claimed["discord"]:
print("This account has not yet been claimed. Please claim it (if its yours) by typing in !claim ACCOUNTNAME to the bot in Discord and running this program again.")
print(claimed)
for i in range(10):
time.sleep(.5)
sys.stdout.write(".")
sys.stdout.flush()
sys.exit()
if claimed:
# Case 1: It belongs to somebody
if claimed['lol_id'] and claimed['lol']:
print(f"Welcome, {claimed['discord']}. Thank you for contributing to custoMM!")
print(claimed)
print("If this is not you, contact admin.")
# Notify them (if that is the case) that we will do nothing about their new name (slight TODO).
@ -137,7 +151,6 @@ async def connect(connection):
"discord_id":claimed["discord_id"],
"discord":claimed["discord"]
})
print(account.content)
if account.status_code == 200:
print(f"Alright, the account is now yours, {claimed['discord']}.")
else:
@ -151,16 +164,9 @@ async def connect(connection):
# All cases are covered, everything else will be considered a bug.
else:
raise WhatTheFuckDidYouDo()
# Case 3: It belongs to nobody and has yet to be claimed.
else:
print("This account has not yet been claimed. Please claim it (if its yours) by typing in !claim ACCOUNTNAME to the bot in Discord and running this program again.")
for i in range(10):
time.sleep(.5)
sys.stdout.write(".")
sys.stdout.flush()
sys.exit()
time.sleep(5)
# Match History
@ -188,6 +194,7 @@ async def connect(connection):
async def disconnect(connection):
"""Disconnects from the league client"""
print('Harvesting is over!')
time.sleep(5)
# Begin

44
client/dataScraper.spec Normal file
View File

@ -0,0 +1,44 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['dataScraper.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='dataScraper',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)

View File

@ -158,6 +158,13 @@ async def register(ctx, *args):
print(name)
league_name = requests.get(f"{URL}/players/{name}").json()
print(league_name)
<<<<<<< HEAD
if league_name["discord_id"]:
return await ctx.send("Someone already claimed this account")
claim_account = requests.post(URL + "/", data = {
=======
try:
if not league_name["detail"] == "Not found.":
return await ctx.send("Someone already claimed this account")
@ -166,6 +173,7 @@ async def register(ctx, *args):
return await ctx.send(f"{league_name['discord']} has claimed this account.")
claim_account = requests.post(f"{URL}/players/", data={
>>>>>>> 52c85f0ed77f3f4a76ff7e09fd064955a419e023
"discord": ctx.author.name,
"discord_id": ctx.author.id,
"lol": name