mirror of
https://github.com/Floriansylvain/Risitas_BOT.git
synced 2026-08-19 11:43:16 +02:00
🎨 - Massive code cleaning
This commit is contained in:
+15
-12
@@ -1,10 +1,11 @@
|
||||
from datetime import datetime, timedelta
|
||||
from riotwatcher import LolWatcher, ApiError
|
||||
from private import TOKEN_RIOT
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
WATCHER = LolWatcher(TOKEN_RIOT)
|
||||
REGION = 'EUW1'
|
||||
|
||||
|
||||
def what_player(name):
|
||||
try:
|
||||
return WATCHER.summoner.by_name(REGION, name)
|
||||
@@ -22,7 +23,8 @@ def rank_track(player):
|
||||
what_rank = 'Solo Queue'
|
||||
elif infos['queueType'] == 'RANKED_FLEX_SR':
|
||||
what_rank = 'Flexible'
|
||||
liste.append([what_rank, infos['tier'], infos['rank'], infos['leaguePoints'], infos['wins'], infos['losses']])
|
||||
liste.append([what_rank, infos['tier'], infos['rank'],
|
||||
infos['leaguePoints'], infos['wins'], infos['losses']])
|
||||
return liste
|
||||
|
||||
|
||||
@@ -30,13 +32,14 @@ def last_match(player):
|
||||
matches = WATCHER.match.matchlist_by_account('EUW1', player['accountId'])
|
||||
recent_match = matches['matches'][0]
|
||||
match_detail = WATCHER.match.by_id('EUW1', recent_match['gameId'])
|
||||
lst = [[],[[],[],[],[]]]
|
||||
for x, y in zip(match_detail['participants'], match_detail['participantIdentities']):
|
||||
lst[0].append([y['player']['summonerName'],
|
||||
x['stats']['totalDamageDealtToChampions'],
|
||||
x['stats']['kills'],
|
||||
x['stats']['deaths'],
|
||||
x['stats']['assists']])
|
||||
lst = [[], [[], [], [], []]]
|
||||
for participants, details in zip(match_detail['participants'],
|
||||
match_detail['participantIdentities']):
|
||||
lst[0].append([details['player']['summonerName'],
|
||||
participants['stats']['totalDamageDealtToChampions'],
|
||||
participants['stats']['kills'],
|
||||
participants['stats']['deaths'],
|
||||
participants['stats']['assists']])
|
||||
|
||||
for team in match_detail['teams']:
|
||||
lst[1][0].append(team['win'])
|
||||
@@ -44,10 +47,10 @@ def last_match(player):
|
||||
lst[1][2].append(team['firstTower'])
|
||||
lst[1][3].append(team['firstDragon'])
|
||||
|
||||
ts = str(match_detail['gameCreation'])[:-3]
|
||||
dt = datetime.fromtimestamp(int(ts)).date()
|
||||
time_stamp = str(match_detail['gameCreation'])[:-3]
|
||||
date_time = datetime.fromtimestamp(int(time_stamp)).date()
|
||||
|
||||
lst.append(str(dt))
|
||||
lst.append(str(date_time))
|
||||
lst.append(str(timedelta(seconds=match_detail['gameDuration'])))
|
||||
|
||||
return lst
|
||||
|
||||
Reference in New Issue
Block a user