Wip bedwars!!!!!!

This commit is contained in:
TheTechRobo 2021-06-22 22:27:30 -04:00
parent ab58d366ea
commit d06f2b5536
3 changed files with 23 additions and 0 deletions

4
bot.py
View File

@ -96,6 +96,10 @@ async def hypixel(ctx,player,ConvertToUUID=True):
em.add_field(name=_("Online?"),value=statusAPI_Message,inline=True)
em.add_field(name=_("Current Game"),value=currentStatus_Message,inline=True)
await thing.edit(embed=em, content="Player data down below.")
@bot.command()
async def bedwars(ctx):
for i in ("eight_one","eight_two","three_three","two_four","four_four"):
await ctx.send(bedwarsToHuman(i))
# }}}
# Error handling {{{
@bot.event

View File

@ -1,5 +1,6 @@
import requests, json
from .errors import *
from word2number.w2n import word_to_num as w2n
def getuuid(username):
"""
Gets the UUID of a player from their username, using the Mojang API
@ -127,6 +128,23 @@ def RawXPToLevel(xp):
Kudos to https://hypixel.net/threads/convert-network-exp-to-network-level.1912930 for the formula :D
"""
return (_sqrt((2 * xp) + 30625) / 50) - 2.5
def bedwarsToHuman(name):
"""
Converts a bedwars name such as eight_one to a tuple containing the human-friendly name, and something such as 1v1v1v1v1v1v1v1
"""
thingy = str()
xvx = name.split("_")
# following adds the number of players per team the same amount of times as the team count
for j in range(0,w2n(xvx[0])): #num[0] is, for example, the eight in eight_one
thingy += f"{w2n(xvx[1])}" #this is the one in eight_one
if j != int(w2n(xvx[0])) - 1: thingy += "v"
if thingy == "1v1v1v1v1v1v1v1":
human = "Solo"
elif thingy == "2v2v2v2v2v2v2v2":
human = "Doubles"
else:
human = thingy
return human, thingy
def RestOfTheFunctions():
"""
The rest of the functions are still a work in progress.

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
word2number==1.1