- $lol_lastgame improved

This commit is contained in:
Florian SYLVAIN
2021-03-09 17:35:58 +01:00
parent b0f4a8ba83
commit 334cfce8fb
2 changed files with 13 additions and 6 deletions
+3 -1
View File
@@ -30,7 +30,7 @@ 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 = [[],[[],[]]]
lst = [[],[[],[],[],[]]]
for x, y in zip(match_detail['participants'], match_detail['participantIdentities']):
lst[0].append([y['player']['summonerName'],
x['stats']['totalDamageDealtToChampions'],
@@ -41,6 +41,8 @@ def last_match(player):
for team in match_detail['teams']:
lst[1][0].append(team['win'])
lst[1][1].append(team['firstBlood'])
lst[1][2].append(team['firstTower'])
lst[1][3].append(team['firstDragon'])
ts = str(match_detail['gameCreation'])[:-3]
dt = datetime.fromtimestamp(int(ts)).date()
+10 -5
View File
@@ -66,11 +66,16 @@ class LolCmds(commands.Cog, name='League of Legend commands'):
await ctx.send(embed=embed)
for i in range(0, -2, -1):
embed = discord.Embed(title='Team 1' if not i else 'Team 2', colour=
discord.Colour.green() if lst[1][0][i] == 'Win' else discord.Colour.red(),
description=':drop_of_blood: First blood' if lst[1][1][i] else None)
embed.add_field(name='Players', value='```\n' + ''.join(players[:5] if not i else players[5:]) + '```')
embed.add_field(name='Total damage dealt to champions', value='```\n' + ''.join(tab[:5] if not i else tab[5:]) + '```')
embed.add_field(name='K / D / A', value='```\n' + ''.join(kda[:5] if not i else kda[5:]) + '```')
discord.Colour.green() if lst[1][0][i] == 'Win' else discord.Colour.red(), description=
(':drop_of_blood: First blood\n' if len(lst[1][1]) != 0 and lst[1][1][i] else '') +
(':tokyo_tower: First tower\n' if len(lst[1][2]) != 0 and lst[1][2][i] else '') +
(':dragon_face: First dragon\n' if len(lst[1][3]) != 0 and lst[1][3][i] else ''))
embed.add_field(name='Players',
value='```\n' + ''.join(players[:5] if not i else players[5:]) + '```')
embed.add_field(name='Total damage dealt to champions',
value='```\n' + ''.join(tab[:5] if not i else tab[5:]) + '```')
embed.add_field(name='K / D / A',
value='```\n' + ''.join(kda[:5] if not i else kda[5:]) + '```')
await ctx.send(embed=embed)
else:
await ctx.send('The username you entered is unknown.')