Wip bedwars!!!!!!
This commit is contained in:
parent
ab58d366ea
commit
d06f2b5536
4
bot.py
4
bot.py
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
word2number==1.1
|
Loading…
Reference in New Issue