Created
August 7, 2019 17:03
-
-
Save Malarne/4772772cdf055ef8678eea14bad81571 to your computer and use it in GitHub Desktop.
history bugged
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@commands.command() | |
@apikeyset() | |
async def history(self, ctx, region, summoner, count : int = 5): | |
"""Shows X last game of a summoner (default: 5). | |
NB: if your summoner name contains spaces, use "" (eg: "My summoner name")""" | |
msg = await ctx.send(f"Loading last {count} games of {summoner} ...") | |
async with ctx.typing(): | |
histo = await self.stats.get_history(count, region, summoner) | |
if not histo: | |
return await ctx.send("Unknown region or summoner.\nList of league of legends regions:" + '\n'.join(self.stats.regions.keys)) | |
emb = discord.Embed() | |
emblist = [] | |
for i in histo: | |
cur = histo[i] | |
champ = cur["champ"] | |
horo = cur["horo"] | |
role = cur["role"] | |
duree = cur["Durée"] | |
mode = cur["Gamemode"] | |
res = cur["resultat"] | |
kda = cur["kda"] | |
stats = cur["stats"] | |
golds = cur["golds"] | |
emb.add_field(name=champ, value=mode + " : " + res, inline=True) | |
emb.add_field(name=role, value=duree, inline=False) | |
emb.add_field(name=golds, value=horo, inline=False) | |
emb.add_field(name=kda, value=stats, inline=True) | |
emblist.append(emb) | |
emb = discord.Embed() | |
await msg.edit(content="") | |
await menu(ctx=ctx, pages=emblist, controls=DEFAULT_CONTROLS, message=msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment