alignment

This commit is contained in:
TheTechRobo 2021-06-29 21:25:52 -04:00
parent ab0bb7575b
commit 7419843d41
2 changed files with 13 additions and 11 deletions

View File

@ -9453,8 +9453,7 @@ Is The Photo Source!!! -->
{userhtml} <!--contains rank, user, etc-->
<!--<text x="25" y="100" style="font-size:40px;">UserHtml thing...</text>-->
<text x="20" y="150" style="fill:blue; font-size:30px;">EXP: {exp}</text>
<text x="451" y="100" style="font-size:25px;">Karma</text>
<text x="451" y="150" style="fill:teal; font-size:29px;">{karma}</text>
<text x="290" y="150" style="fill:teal; font-size:29px;">Karma: {karma}</text>
<text x="20" y="200" style="fill:darkgreen; font-size:31px;">Friends: {friends}</text> <!--things i don't have-->
{onlinehtml}
</svg>

Before

Width:  |  Height:  |  Size: 711 KiB

After

Width:  |  Height:  |  Size: 711 KiB

21
bot.py
View File

@ -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 <UUID> False` instead of `$h <PlayerName>`.
@ -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="""<text x="25" y="100" style="font-size:40px;">{rank}&#8194;{displayname}</text>""".format(rank=contents['rank'], displayname=contents['displayname']), exp=val, karma=contents['karma'], friends=lenfriends,
svg = file.read().format(uuid=getuuid(player), userhtml="""<text x="25" y="100" style="font-size:40px;">{rank}&#8194;{displayname}</text>""".format(rank=contents['rank'], displayname=contents['displayname']), exp=round(RawXPToLevel(contents['networkExp']),2), karma=contents['karma'], friends=lenfriends,
onlinehtml=f'<text x="20" y="250" style="fill:{onlinecolour}; font-size:31px;">{currentStatus_Message}</text>')
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