Skip to content

Commit

Permalink
Brawlstats command displays clan name below stats, resolves #13
Browse files Browse the repository at this point in the history
  • Loading branch information
LevBernstein committed Nov 16, 2021
1 parent 5467e2f commit e9252ef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Bot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
""" Beardless Bot """
__version__ = "Full Release 1.6.9"
__version__ = "Full Release 1.6.10"

import asyncio
from random import choice, randint
Expand Down
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Beardless Bot

### Full Release 1.6.9
### Full Release 1.6.10

A Discord bot supporting gambling (coin flips and blackjack),
a currency system, fun facts, and more.
Expand Down
2 changes: 1 addition & 1 deletion bb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def test_getStats():
user.id = 196354892208537600
emb = brawl.getStats(user, brawlKey)
assert emb.footer.text == "Brawl ID 7032472"
assert len(emb.fields) == 3
assert len(emb.fields) in (3, 4)


def test_getClan():
Expand Down
28 changes: 12 additions & 16 deletions brawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ def getRank(target: discord.Member, brawlKey: str) -> discord.Embed:


def getStats(target: discord.Member, brawlKey: str) -> discord.Embed:
# TODO: add clan below name, make this look not terrible
brawlID = fetchBrawlID(target.id)
if not brawlID:
return bbEmbed(
Expand All @@ -298,9 +297,9 @@ def getStats(target: discord.Member, brawlKey: str) -> discord.Embed:
emb = (
bbEmbed("Brawlhalla Stats for " + r["name"])
.set_footer(text=f"Brawl ID {brawlID}")
.add_field(name="Name", value=r["name"])
.add_field(name="Overall W/L", value=embVal)
.set_author(name=str(target), icon_url=target.avatar_url)
.add_field(name="Name", value=r["name"])
)
if "legends" in r:
topUsed = topWinrate = topDPS = topTTK = None
Expand Down Expand Up @@ -335,21 +334,18 @@ def getStats(target: discord.Member, brawlKey: str) -> discord.Embed:
)
if all((topUsed, topWinrate, topDPS, topTTK)):
emb.add_field(
value=(
"**Most Played:** {}\n**Highest Winrate:** {}, {}%\n"
"**Highest Avg DPS:** {}, {}\n**Shortest Avg TTK:"
"** {}, {}s"
).format(
topUsed[0],
topWinrate[0],
topWinrate[1],
topDPS[0],
topDPS[1],
topTTK[0],
topTTK[1]
),
name="Legend Stats (20 game min)"
name="Legend Stats (20 game min)", value=(
f"**Most Played:** {topUsed[0]}\n**Highest Winrate:"
f"** {topWinrate[0]}, {topWinrate[1]}%\n**Highest Avg"
f" DPS:** {topDPS[0]}, {topDPS[1]}\n**Shortest Avg TTK:"
f"** {topTTK[0]}, {topTTK[1]}s"
)
)
if "clan" in r:
emb.add_field(
name="Clan",
value=f"{r['clan']['clan_name']}\nClan ID: {r['clan']['clan_id']}"
)
return emb


Expand Down

0 comments on commit e9252ef

Please sign in to comment.