Skip to content

Commit

Permalink
2.2.0: upgrade dependencies, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LevBernstein committed Jul 14, 2024
1 parent 946cf81 commit b07cf35
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 16 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 2.1.8"
__version__ = "Full Release 2.2.0"

import asyncio
import logging
Expand Down
10 changes: 9 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Beardless Bot

### Full Release 2.1.8 ![Coverage badge](./resources/images/coverage.svg)
### Full Release 2.2.0 ![Coverage badge](./resources/images/coverage.svg)

A Discord bot supporting gambling (coin flips and blackjack),
a currency system, fun facts, and more.
Expand Down Expand Up @@ -58,6 +58,14 @@ could use someone tackling them. Please make sure your code is PEP8
compliant (except for tabs), with a column limit of 80.


## Testing

To run Beardless Bot's suite of unit tests, do `bash unitTests.sh`. This will
also generate a coverage badge.To run an individual test--for instance, the
PEP8 compliance test--use the pytest command, like so:
`pytest -v bb_test.py::test_pep8Compliance`.


## License

This program is free software: you can redistribute it and/or modify
Expand Down
5 changes: 2 additions & 3 deletions bb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,6 @@ async def test_on_message_edit() -> None:
assert emb.fields[1].value == (
f"{after.content}\n[Jump to Message]({after.jump_url})"
)
# testing for scamCheck == True
after.content = "http://dizcort.com free nitro!"
emb = await Bot.on_message_edit(before, after)
assert any(
Expand Down Expand Up @@ -1239,7 +1238,7 @@ def test_animal_with_goodUrl(animalName: str) -> None:

def test_animal_dog_breed() -> None:
breeds = misc.animal("dog", "breeds")[12:-1].split(", ")
assert len(breeds) == 98
assert len(breeds) == 107
assert goodURL(requests.get(misc.animal("dog", choice(breeds))))
assert misc.animal("dog", "invalidbreed").startswith("Breed not")
assert misc.animal("dog", "invalidbreed1234").startswith("Breed not")
Expand Down Expand Up @@ -1341,7 +1340,7 @@ def test_getRank() -> None:
"You haven't played ranked yet this season."
)
brawl.claimProfile(196354892208537600, 12502880)
assert brawl.getRank(user, brawlKey).color.value == 0x3D2399
assert brawl.getRank(user, brawlKey).color.value == 20916
brawl.claimProfile(196354892208537600, 7032472)


Expand Down
10 changes: 8 additions & 2 deletions bucks.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,10 @@ def balance(
" (or enter their username), or do !balance without a"
f" target to see your own balance, {msg.author.mention}."
)
if not isinstance(target, nextcord.User):
if not (
isinstance(target, nextcord.User)
or isinstance(target, nextcord.Member)
):
target = memSearch(msg, target)
if target:
result, bonus = writeMoney(target, 300, False, False)
Expand Down Expand Up @@ -393,7 +396,10 @@ def leaderboard(
"""
lbDict: Dict[str, int] = {}
emb = bbEmbed("BeardlessBucks Leaderboard")
if target and msg and not isinstance(target, nextcord.User):
if (target and msg and not (
isinstance(target, nextcord.User)
or isinstance(target, nextcord.Member)
)):
target = memSearch(msg, target)
if target:
writeMoney(target, 300, False, False)
Expand Down
2 changes: 1 addition & 1 deletion misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def animal(animalType: str, breed: Optional[str] = None) -> str:
return r.json()["url"]

elif animalType == "bear":
return f"https://placebear.com/{randint(200, 400)}/{randint(200,400)}"
return f"https://placebear.com/{randint(200, 400)}/{randint(200, 400)}"

elif animalType == "frog":
frog = choice(frogList)["name"]
Expand Down
16 changes: 8 additions & 8 deletions resources/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
bs4==0.0.1
coverage==6.4.3
flake8==4.0.1
beautifulsoup4==4.12.3
coverage==7.6.0
flake8==7.1.0
genbadge[all]==1.1.1
nextcord==2.6.0
pytest==8.2.0
pytest-asyncio==0.23.6
python-dotenv==0.19.2
requests==2.28.1
steam==1.2.0
pytest==8.2.2
pytest-asyncio==0.23.7
python-dotenv==1.0.1
requests==2.32.3
steam==1.4.4

0 comments on commit b07cf35

Please sign in to comment.