Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ jobs:
run: python main.py
- name: Run tests
run: pytest tests/

20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v6.0.0
hooks:
- id: check-executables-have-shebangs
- id: check-toml
Expand All @@ -11,39 +11,39 @@ repos:
- id: requirements-txt-fixer

- repo: https://github.com/MarcoGorelli/auto-walrus
rev: v0.2.2
rev: 0.4.1
hooks:
- id: auto-walrus

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.270
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.8
hooks:
- id: ruff

- repo: https://github.com/psf/black
rev: 23.3.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.3.1
hooks:
- id: black

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.4.2
hooks:
- id: codespell
additional_dependencies:
- tomli

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "0.11.2"
rev: "v2.20.0"
hooks:
- id: pyproject-fmt

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.13
rev: v0.25
hooks:
- id: validate-pyproject

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
rev: v1.19.1
hooks:
- id: mypy
args:
Expand Down
18 changes: 6 additions & 12 deletions cogs/crime.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ async def wanted_criminals(self, ctx: Context) -> None:
{"[hair_colow:] " + json['hair'] if json['hair'] else ''}
"""
data = re.sub("\n{2,}", "\n", data).strip()
await ctx.em(
"""```yaml
await ctx.em("""```yaml
++ -- wanted criminal {json['title']} -- ++

{data}

[real data curated from official FBI sources]```"""
)
[real data curated from official FBI sources]```""")

@commands.command(aliases=["jail"])
async def jailbase(
Expand Down Expand Up @@ -96,14 +94,12 @@ async def police(self, ctx: Context) -> None:
json = await resp.json()

", ".join(json[k]["name"] for k in range(0, len(json)))
await ctx.em(
"""```yaml
await ctx.em("""```yaml
++ -- All police forces in england -- ++

{police}

[Factual information curated from official police data]```"""
)
[Factual information curated from official police data]```""")

@commands.command()
async def coordinates(self, ctx: Context, *, poste_code=None) -> None:
Expand All @@ -115,16 +111,14 @@ async def coordinates(self, ctx: Context, *, poste_code=None) -> None:
if not json["data"][0]:
return await ctx.em("Invalid location!")

await ctx.em(
"""```yaml
await ctx.em("""```yaml
++ -- coordinates for {poste_code} -- ++

[Longitude:] {json['data'][0]['longitude']}
[Latitude:] {json['data'][0]['latitude']}
[Region:] {json['data'][0]['region']}
[Country:] {json['data'][0]['country']}```
"""
)
""")

@commands.command(aliases=["searches"])
async def stop_and_searches(self, ctx: Context, poste_code=None) -> None:
Expand Down
4 changes: 2 additions & 2 deletions cogs/docs/exts.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def parse_object_inv(self, stream, url):
if not match:
continue

(name, directive, prio, location, dispname) = match.groups()
(domain, _, subdirective) = directive.partition(":")
name, directive, prio, location, dispname = match.groups()
domain, _, subdirective = directive.partition(":")
if directive == "py:module" and name in result:
continue

Expand Down
2 changes: 1 addition & 1 deletion cogs/docs/fuzzy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def quick_ratio(a, b):


def partial_ratio(a, b):
(short, long) = (a, b) if len(a) <= len(b) else (b, a)
short, long = (a, b) if len(a) <= len(b) else (b, a)
m = SequenceMatcher(None, short, long)

blocks = m.get_matching_blocks()
Expand Down
4 changes: 2 additions & 2 deletions cogs/docs/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ async def _internal_loop(self):
)
),
]
(done, pending) = await asyncio.wait(
done, pending = await asyncio.wait(
tasks, timeout=self.timeout, return_when=asyncio.FIRST_COMPLETED
)
for task in pending:
Expand Down Expand Up @@ -1068,7 +1068,7 @@ def __init__(self, entries, *, per_page):
self.entries = entries
self.per_page = per_page

(pages, left_over) = divmod(len(entries), per_page)
pages, left_over = divmod(len(entries), per_page)
if left_over:
pages += 1

Expand Down
7 changes: 4 additions & 3 deletions cogs/docs/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ def fill_items(self) -> None:
self.add_item(self.numbered_page)
self.add_item(self.stop_pages)

async def _get_kwargs_from_page(
self, page: int
) -> Dict[str, Any,]:
async def _get_kwargs_from_page(self, page: int) -> Dict[
str,
Any,
]:
value = await disnake.utils.maybe_coroutine(self.source.format_page, self, page)
if isinstance(value, dict):
return value
Expand Down
4 changes: 2 additions & 2 deletions cogs/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def check(e, u):
return u == message.author and e.message.id == message.id

try:
(emoji, user) = await self.bot.wait_for(
emoji, user = await self.bot.wait_for(
"reaction_add", timeout=30.0, check=check
)
while emoji.emoji not in [THUMBS_DOWN]:
Expand All @@ -303,7 +303,7 @@ def check(e, u):
await message.remove_reaction(
member=message.author, emoji=THUMBS_UP
)
(emoji, user) = await self.bot.wait_for(
emoji, user = await self.bot.wait_for(
"reaction_add", timeout=30.0, check=check
)

Expand Down
108 changes: 61 additions & 47 deletions cogs/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,53 +38,67 @@ async def viewfeedback(
str,
] = None,
):
await send_embed(
ctx,
"",
"**Error: **distance must be an integer (an index placevalue) if no `author_from` is given!",
) if hasattr(distance, "upper") and author_from is None else await send_embed(
ctx,
"",
f'*`{distance}`*: "{data["feedback"]["message"][distance]}", submitted by **{data["feedback"]["author"][distance]}**'
if distance != 0
else f"**You can index off of the index on the left side. Type `{ctx.prefix}viewfeedback <index>`\n**\n"
+ "\n".join(
[
f"`{num}:` {data['feedback']['message'][k]}**, said by {data['feedback']['author'][k]}**"
for num, k in enumerate(range(len(data["feedback"]["message"])))
if num <= 9
]
),
a="Feedback",
i_u=ctx.author.display_avatar.url,
) if author_from is None else await send_embed(
ctx,
"",
"\n".join(
[
f"`{num}`: {data['feedback']['message'][num]}"
for num, k in enumerate(data["feedback"]["author"])
if k == author_from
]
),
a=f"Feedback from {author_from}",
i_u=ctx.author.display_avatar.url,
f=f"All these messges are from {author_from}",
) if hasattr(
author_from, "upper"
) else await send_embed(
ctx,
"",
"\n".join(
[
f"`{num}`: {data['feedback']['message'][num]}"
for num, k in enumerate(data["feedback"]["id"])
if k == author_from
]
),
a=f"Feedback from {await self.bot.fetch_user(author_from)}",
i_u=ctx.author.display_avatar.url,
f=f"All these messages are from {await self.bot.fetch_user(author_from)}",
(
await send_embed(
ctx,
"",
"**Error: **distance must be an integer (an index placevalue) if no `author_from` is given!",
)
if hasattr(distance, "upper") and author_from is None
else (
await send_embed(
ctx,
"",
(
f'*`{distance}`*: "{data["feedback"]["message"][distance]}", submitted by **{data["feedback"]["author"][distance]}**'
if distance != 0
else f"**You can index off of the index on the left side. Type `{ctx.prefix}viewfeedback <index>`\n**\n"
+ "\n".join(
[
f"`{num}:` {data['feedback']['message'][k]}**, said by {data['feedback']['author'][k]}**"
for num, k in enumerate(
range(len(data["feedback"]["message"]))
)
if num <= 9
]
)
),
a="Feedback",
i_u=ctx.author.display_avatar.url,
)
if author_from is None
else (
await send_embed(
ctx,
"",
"\n".join(
[
f"`{num}`: {data['feedback']['message'][num]}"
for num, k in enumerate(data["feedback"]["author"])
if k == author_from
]
),
a=f"Feedback from {author_from}",
i_u=ctx.author.display_avatar.url,
f=f"All these messges are from {author_from}",
)
if hasattr(author_from, "upper")
else await send_embed(
ctx,
"",
"\n".join(
[
f"`{num}`: {data['feedback']['message'][num]}"
for num, k in enumerate(data["feedback"]["id"])
if k == author_from
]
),
a=f"Feedback from {await self.bot.fetch_user(author_from)}",
i_u=ctx.author.display_avatar.url,
f=f"All these messages are from {await self.bot.fetch_user(author_from)}",
)
)
)
)

@commands.command(aliases=["dial", "call", "assistance"])
Expand Down
4 changes: 2 additions & 2 deletions cogs/fun/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ async def pickemoji(self, ctx: Context):
def check(e, u):
return u == ctx.author and e.message.id == msg.id

(emoji, user) = await self.bot.wait_for("reaction_add", check=check)
emoji, user = await self.bot.wait_for("reaction_add", check=check)
while emoji.emoji != "❌":
if emoji.emoji == "➡":
slide += 1
Expand Down Expand Up @@ -300,7 +300,7 @@ def check(e, u):

await ctx.reply(f"{y} has been added!")

(emoji, user) = await self.bot.wait_for("reaction_add", check=check)
emoji, user = await self.bot.wait_for("reaction_add", check=check)
else:
await msg.clear_reactions()

Expand Down
2 changes: 1 addition & 1 deletion cogs/games/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ async def rpsfail(self, ctx: Context):
def check(reaction, user):
return user == ctx.author

(reaction, user) = await self.bot.wait_for("reaction_add", check=check)
reaction, user = await self.bot.wait_for("reaction_add", check=check)

embed = Embed(title="Baited", colour=get_colour())
await msg.edit(embed=embed)
Expand Down
12 changes: 7 additions & 5 deletions cogs/games/views/blackjack.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ def visual_hand(self, cards: List[Card] = None, hide_card: bool = False) -> str:
player=player,
bar="".join("-" for _ in range(len(player))),
cards=visual_cards,
value=self.generate_card_values(
self.user_cards if not cards else self.bot_cards
)
if not hide_card
else f"{cards[0].value} + ?",
value=(
self.generate_card_values(
self.user_cards if not cards else self.bot_cards
)
if not hide_card
else f"{cards[0].value} + ?"
),
)

def generate_card_values(self, cards: List[Card]) -> int:
Expand Down
4 changes: 2 additions & 2 deletions cogs/games/views/casino.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def play(self, button: Button, interaction: MessageInteraction) -> None:
await interaction.response.edit_message(embed=intsthink, view=self)

r_ints = (random.randint(1, 9), random.randint(1, 9), random.randint(1, 9))
(result, ints) = ([], None)
result, ints = ([], None)

for i in r_ints:
result.append(str(i))
Expand Down Expand Up @@ -68,7 +68,7 @@ async def retry(self, button: Button, interaction: MessageInteraction) -> None:

r_ints = (random.randint(1, 9), random.randint(1, 9), random.randint(1, 9))

(result, ints) = ([], None)
result, ints = ([], None)
for i in r_ints:
result.append(str(i))
ints = Embed(
Expand Down
4 changes: 2 additions & 2 deletions cogs/games/views/minesweeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ async def dig_button(self, button: Button, interaction: MessageInteraction) -> N

try:
user_input = message.content.split()
(row, column) = int(user_input[0]), int(user_input[-1])
row, column = int(user_input[0]), int(user_input[-1])
except ValueError:
self.button_pressed = 0
return await message.add_reaction(CLOSE)
Expand Down Expand Up @@ -590,7 +590,7 @@ async def flag_button(

try:
user_input = message.content.split()
(row, column) = int(user_input[0]), int(user_input[-1])
row, column = int(user_input[0]), int(user_input[-1])
except ValueError:
self.button_pressed = 0
return await message.add_reaction(CLOSE)
Expand Down
Loading
Loading