Added vibe lookup

This commit is contained in:
Kevin Rode 2021-01-03 22:49:46 -05:00
parent 19b6d0649e
commit 190790a1af

View File

@ -735,6 +735,23 @@ def build_team_embed(team):
embed.set_footer(text=team.slogan) embed.set_footer(text=team.slogan)
return embed return embed
def vibe_check(vibes):
if vibes < -0.8:
vibe_text = "Honestly Terrible"
if vibes < -0.4 and vibes > -0.8:
vibe_text = "Far Less Than Ideal"
if vibes < -0.1 and vibes > -0.4:
vibe_text = "Less Than Ideal"
elif vibes > -0.1 and vibes < 0.1:
vibe_text = "Neutral"
elif vibes > 0.1 and vibes < 0.4:
vibe_text = "Quality"
elif vibes > 0.4 and vibes < 0.8:
vibe_text = "Excellent"
elif vibes > 0.8:
vibe_text = "Most Excellent"
return vibe_text
def build_star_embed(player_json): def build_star_embed(player_json):
starkeys = {"batting_stars" : "Batting", "pitching_stars" : "Pitching", "baserunning_stars" : "Baserunning", "defense_stars" : "Defense"} starkeys = {"batting_stars" : "Batting", "pitching_stars" : "Pitching", "baserunning_stars" : "Baserunning", "defense_stars" : "Defense"}
embed = discord.Embed(color=discord.Color.purple(), title=player_json["name"]) embed = discord.Embed(color=discord.Color.purple(), title=player_json["name"])
@ -749,6 +766,9 @@ def build_star_embed(player_json):
elif starnum == 0: # why check addhalf twice, amirite elif starnum == 0: # why check addhalf twice, amirite
embedstring += "⚪️" embedstring += "⚪️"
embed.add_field(name=starkeys[key], value=embedstring, inline=False) embed.add_field(name=starkeys[key], value=embedstring, inline=False)
vibes = int(player_json["current_vibe"])
vibe = vibe_check(vibes)
embed.add_field(name="Vibe", value=vibe, inline=False)
return embed return embed
def team_from_collection(newteam_json): def team_from_collection(newteam_json):