diff --git a/AnyConv.com__minecraft-2053886_960_7200.svg b/AnyConv.com__minecraft-2053886_960_7200.svg index d00e63a..a8ed112 100644 --- a/AnyConv.com__minecraft-2053886_960_7200.svg +++ b/AnyConv.com__minecraft-2053886_960_7200.svg @@ -9453,8 +9453,7 @@ Is The Photo Source!!! --> {userhtml} EXP: {exp} -Karma -{karma} +Karma: {karma} Friends: {friends} {onlinehtml} diff --git a/bot.py b/bot.py index 9c69fbc..1663099 100644 --- a/bot.py +++ b/bot.py @@ -44,7 +44,7 @@ async def ping(ctx): hi2 = time.time() await pong.edit(content=f':ping_pong: Pong! ({delta} ms)\n*Discord message edit latency: {hi2 - hi1}*') @bot.command(name="hypixel",aliases=("h","stats")) -async def hypixel(ctx,player,ConvertToUUID=True): +async def hypixel(ctx,player,ConvertToUUID=True, v2=True): """ Checks overall stats Change ConvertToUUID to False if you want to pass in the UUID, example: `$h False` instead of `$h `. @@ -97,17 +97,20 @@ async def hypixel(ctx,player,ConvertToUUID=True): em.add_field(name=_("Friends"),value=lenfriends,inline=True) em.add_field(name="\u200b",value="\u200b",inline=True)#newline; \u200b is a zero width space that is allowed by dcord em.add_field(name=_("Online?"),value=statusAPI_Message,inline=True) - em.add_field(name=_("Current Game"),value=currentStatus_Message,inline=True) + em.add_field(name=_("Current Game"), value=currentStatus_Message,inline=True) with open("AnyConv.com__minecraft-2053886_960_7200.svg") as file: - svg = file.read().format(uuid=getuuid(player), userhtml="""{rank} {displayname}""".format(rank=contents['rank'], displayname=contents['displayname']), exp=val, karma=contents['karma'], friends=lenfriends, + svg = file.read().format(uuid=getuuid(player), userhtml="""{rank} {displayname}""".format(rank=contents['rank'], displayname=contents['displayname']), exp=round(RawXPToLevel(contents['networkExp']),2), karma=contents['karma'], friends=lenfriends, onlinehtml=f'{currentStatus_Message}') with tempfile.TemporaryDirectory() as tmp: - path = os.path.join(tmp, 'png.pngpng.png') #https://stackoverflow.com/a/45803022/9654083 - svg2png(bytestring=svg, write_to=path) #https://stackoverflow.com/questions/6589358/convert-svg-to-png-in-python - with open(path, "rb") as file: #https://stackoverflow.com/questions/60913131/how-to-send-a-image-with-discord-py - file = discord.File(file, filename=path) - await ctx.send(file=file) - await thing.edit(embed=em, content="Player data down below.") + if v2: + path = os.path.join(tmp, 'png.pngpng.png') #https://stackoverflow.com/a/45803022/9654083 + svg2png(bytestring=svg, write_to=path) #https://stackoverflow.com/questions/6589358/convert-svg-to-png-in-python + with open(path, "rb") as file: #https://stackoverflow.com/questions/60913131/how-to-send-a-image-with-discord-py + file = discord.File(file, filename=path) + await ctx.send("Player data down below.", file=file) + await thing.delete() + if v2 is False: + await thing.edit(embed=em, content="Player data down below.") @bot.command() async def bedwars(ctx, player, ConvertToUUID=True): if checkapi(HYPIXEL_API_KEY) is False: #todo; use exceptions instead