Skip to content

Commit

Permalink
Bump required Python version to 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
LevBernstein committed Sep 29, 2024
1 parent cc915dd commit 047d25d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.12.3", "3.11.9", "3.10.4" ]
python-version: [ "3.12.0", "3.12.3", "3.12.6" ]
name: Beardless Bot Python ${{ matrix.python-version }} unit tests
steps:
- name: Enable Brawl tests on latest Python only
Expand Down
13 changes: 8 additions & 5 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Beardless Bot

### Full Release 2.4.5 ![Coverage badge](./resources/images/coverage.svg) ![Unit tests badge](./resources/images/tests.svg) ![Docstring coverage badge](./resources/images/docstr-coverage.svg) ![flake8 badge](./resources/images/flake8-badge.svg)
### Full Release 2.5.0 ![Coverage badge](./resources/images/coverage.svg) ![Unit tests badge](./resources/images/tests.svg) ![Docstring coverage badge](./resources/images/docstr-coverage.svg) ![flake8 badge](./resources/images/flake8-badge.svg)

A Discord bot supporting gambling (coin flips and blackjack),
a currency system, fun facts, and more.
Expand All @@ -20,10 +20,13 @@ follow the steps outlined directly below in [Installation](#installation).
1. Download the repository.

2. Download [Python 3](https://python.org/downloads), and then run
`pip3 install -r resources/requirements.txt`. Beardless Bot requires Python
3.10 or newer, and has been tested on 3.10.4, 3.11.9, and 3.12.3. If you are
using python virtualenv, name your virtualenv "venv" and run
`source venv/bin/activate` before running `pip3 install`.
`pip3 install -r resources/requirements.txt`. If you are using python
virtualenv, name your virtualenv "venv" and run `source venv/bin/activate`
before running `pip3 install`. Beardless Bot requires Python 3.12, and has
been tested on 3.12.0, 3.12.3, and 3.12.6. Older versions of Beardless
Bot--specifically those before 2.5.0--can run on 3.10 and 3.11 in addition
to 3.12. Support for 3.13.0 in future releases of Beardless Bot will depend
on nextcord.py removing the deprecated audioop library as a dependency.

3. Create a file named ".env" in the same directory as Bot.py. Insert
into it the line `DISCORDTOKEN=yourtoken`, where yourtoken is the Discord API
Expand Down
26 changes: 13 additions & 13 deletions brawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ def cleanQuote(quote: str, attrib: str) -> str:
.add_field(
name="Stats",
value=(
f"{r['strength']} Str, {r['dexterity']} Dex,"
f" {r['defense']} Def, {r['speed']} Spd"
f"{r["strength"]} Str, {r["dexterity"]} Dex,"
f" {r["defense"]} Def, {r["speed"]} Spd"
)
)
)
Expand Down Expand Up @@ -280,14 +280,14 @@ async def getRank(target: Member | User, brawlKey: str) -> Embed:
).set_footer(text=f"Brawl ID {brawlId}").set_author(
name=target, icon_url=fetchAvatar(target)
)
emb = bbEmbed(f"{r['name']}, {r['region']}").set_footer(
emb = bbEmbed(f"{r["name"]}, {r["region"]}").set_footer(
text=f"Brawl ID {brawlId}"
).set_author(name=target, icon_url=fetchAvatar(target))
if "games" in r and r["games"] != 0:
winRate = brawlWinRate(r)
embVal = (
f"**{r['tier']}** ({r['rating']}/{r['peak_rating']} Peak)\n"
f"{r['wins']} W / {r['games'] - r['wins']} L / {winRate}% winrate"
f"**{r["tier"]}** ({r["rating"]}/{r["peak_rating"]} Peak)\n"
f"{r["wins"]} W / {r["games"] - r["wins"]} L / {winRate}% winrate"
)
if (topLegend := getTopLegend(r["legends"])) is not None:
embVal += (
Expand All @@ -309,10 +309,10 @@ async def getRank(target: Member | User, brawlKey: str) -> Embed:
emb.add_field(
name="Ranked 2s",
value=(
f"**{twosTeam['teamname']}\n"
f"{twosTeam['tier']}** ({twosTeam['rating']} /"
f" {twosTeam['peak_rating']} Peak)\n{twosTeam['wins']}"
f" W / {twosTeam['games'] - twosTeam['wins']} L /"
f"**{twosTeam["teamname"]}\n"
f"{twosTeam["tier"]}** ({twosTeam["rating"]} /"
f" {twosTeam["peak_rating"]} Peak)\n{twosTeam["wins"]}"
f" W / {twosTeam["games"] - twosTeam["wins"]} L /"
f" {brawlWinRate(twosTeam)}% winrate"
)
)
Expand Down Expand Up @@ -365,8 +365,8 @@ async def getStats(target: Member | User, brawlKey: str) -> Embed:
return bbEmbed("Beardless Bot Brawlhalla Stats", noStats)
assert isinstance(r, dict)
winLoss = (
f"{r['wins']} Wins / {r['games'] - r['wins']} Losses"
f"\n{r['games']} Games\n{brawlWinRate(r)}% Winrate"
f"{r["wins"]} Wins / {r["games"] - r["wins"]} Losses"
f"\n{r["games"]} Games\n{brawlWinRate(r)}% Winrate"
)
emb = bbEmbed("Brawlhalla Stats for " + r["name"]).set_footer(
text=f"Brawl ID {brawlId}"
Expand Down Expand Up @@ -440,11 +440,11 @@ async def getClan(target: Member | User, brawlKey: str) -> Embed:
r["clan_xp"],
len(r["clan"])
)
).set_footer(text=f"Clan ID {r['clan_id']}")
).set_footer(text=f"Clan ID {r["clan_id"]}")
for i in range(min(len(r["clan"]), 9)):
member = r["clan"][i]
val = (
f"{member['rank']} ({member['xp']} xp)\nJoined "
f"{member["rank"]} ({member["xp"]} xp)\nJoined "
+ str(datetime.fromtimestamp(member["join_date"], TimeZone))[:-9]
)
emb.add_field(name=member["name"], value=val)
Expand Down
2 changes: 1 addition & 1 deletion bucks.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def leaderboard(
head, body = sortedDict.popitem()
lastEntry: bool = (i != min(len(sortedDict), 10) - 1)
emb.add_field(
name=f"{i + 1}. {head.split('#')[0]}", value=body, inline=lastEntry
name=f"{i + 1}. {head.split("#")[0]}", value=body, inline=lastEntry
)
if target and pos:
assert not isinstance(target, str)
Expand Down
4 changes: 2 additions & 2 deletions logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ def logClearReacts(

def logDeleteChannel(channel: nextcord.abc.GuildChannel) -> nextcord.Embed:
return bbEmbed(
"", f'Channel "{channel.name}" deleted.', 0xFF0000, showTime=True
"", f"Channel \"{channel.name}\" deleted.", 0xFF0000, showTime=True
).set_author(name="Channel deleted", icon_url=ProfUrl)


def logCreateChannel(channel: nextcord.abc.GuildChannel) -> nextcord.Embed:
return bbEmbed(
"", f'Channel "{channel.name}" created.', 0x00FF00, showTime=True
"", f"Channel \"{channel.name}\" created.", 0x00FF00, showTime=True
).set_author(name="Channel created", icon_url=ProfUrl)


Expand Down
2 changes: 1 addition & 1 deletion misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ async def define(word: str) -> nextcord.Embed:
j = r.json()
p = j[0]["phonetics"]
desc = (
f"Audio: {p[0]['audio']}"
f"Audio: {p[0]["audio"]}"
if p and "audio" in p[0] and p[0]["audio"]
else ""
)
Expand Down

0 comments on commit 047d25d

Please sign in to comment.