def matches(self, ctx, matchcount=10, player=None):
"""Gets a list of your recent matches
Specifiy a `matchcount` to get a specific number of matches. Default is 10
You can also mention a user to get their recent matches
**Example:**
`{cmdpfx}matches 5 @PlayerPerson`"""
steam32 = await get_check_steamid(player, ctx)
await ctx.channel.trigger_typing()
matches = await opendota_query(f"/players/{steam32}/recentmatches")
if matchcount < 1:
raise UserError("Gotta have a matchcount of 1 or more")
if matchcount > 20:
raise UserError("Sorries, 20 is the maximum number of matches for this command")
if not matches:
raise UserError("Looks like this player hasn't played any matches")
matches = matches[:matchcount]
embed = discord.Embed()
embed.title = "Recent Matches"
embed.url = f"https://www.opendota.com/players/{steam32}"
matches_image = await drawdota.draw_matches_table(matches, self.dota_game_strings)
matches_image = discord.File(matches_image, "matches.png")
embed.set_image(url=f"attachment://{matches_image.filename}")
await ctx.send(embed=embed, file=matches_image)
评论列表
文章目录