mirror of
https://github.com/Floriansylvain/Risitas_BOT.git
synced 2026-08-19 19:53:19 +02:00
✨ - Introducing the new command $lol_lastgame !
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from riotwatcher import LolWatcher, ApiError
|
||||
from private import TOKEN_RIOT
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
WATCHER = LolWatcher(TOKEN_RIOT)
|
||||
REGION = 'EUW1'
|
||||
@@ -10,6 +11,7 @@ def what_player(name):
|
||||
except ApiError:
|
||||
return 0
|
||||
|
||||
|
||||
def rank_track(player):
|
||||
ranked_stats = WATCHER.league.by_summoner(REGION, player['id'])
|
||||
if not ranked_stats:
|
||||
@@ -22,3 +24,28 @@ def rank_track(player):
|
||||
what_rank = 'Flexible'
|
||||
liste.append([what_rank, infos['tier'], infos['rank'], infos['leaguePoints'], infos['wins'], infos['losses']])
|
||||
return liste
|
||||
|
||||
|
||||
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']])
|
||||
|
||||
for team in match_detail['teams']:
|
||||
lst[1][0].append(team['win'])
|
||||
lst[1][1].append(team['firstBlood'])
|
||||
|
||||
ts = str(match_detail['gameCreation'])[:-3]
|
||||
dt = datetime.fromtimestamp(int(ts)).date()
|
||||
|
||||
lst.append(str(dt))
|
||||
lst.append(str(timedelta(seconds=match_detail['gameDuration'])))
|
||||
|
||||
return lst
|
||||
|
||||
Reference in New Issue
Block a user