Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 18, 2024
1 parent 2a781ce commit c1a2a4d
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 128 deletions.
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/

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
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
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
48 changes: 16 additions & 32 deletions cogs/games/views/snake.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,32 +182,25 @@ async def move_snake(self) -> None:
await self.edit_embed(self.board)

@_p1
async def _pl_1(self, _, __):
...
async def _pl_1(self, _, __): ...

@_p1
async def _pl_2(self, _, __):
...
async def _pl_2(self, _, __): ...

@_p1
async def _pl_3(self, _, __):
...
async def _pl_3(self, _, __): ...

@_p1
async def _pl_4(self, _, __):
...
async def _pl_4(self, _, __): ...

@_p1
async def _pl_5(self, _, __):
...
async def _pl_5(self, _, __): ...

@_p2
async def _pl_6(self, _, __):
...
async def _pl_6(self, _, __): ...

@_p2
async def _pl_7(self, _, __):
...
async def _pl_7(self, _, __): ...

@button(style=ButtonStyle.green, emoji=UP_ARROW, disabled=True)
async def up(self, button: Button, interaction: MessageInteraction) -> None:
Expand All @@ -219,16 +212,13 @@ async def up(self, button: Button, interaction: MessageInteraction) -> None:
await interaction.response.defer()

@_p2
async def _pl_8(self, _, __):
...
async def _pl_8(self, _, __): ...

@_p2
async def _pl_9(self, _, __):
...
async def _pl_9(self, _, __): ...

@_p3
async def _pl_10(self, _, __):
...
async def _pl_10(self, _, __): ...

@button(style=ButtonStyle.green, emoji=LEFT_ARROW, disabled=True, row=2)
async def left(self, button: Button, interaction: MessageInteraction) -> None:
Expand Down Expand Up @@ -258,28 +248,22 @@ async def right(self, button: Button, interaction: MessageInteraction) -> None:
await interaction.response.defer()

@_p3
async def _pl_11(self, _, __):
...
async def _pl_11(self, _, __): ...

@_p4
async def _pl_12(self, _, __):
...
async def _pl_12(self, _, __): ...

@_p4
async def _pl_13(self, _, __):
...
async def _pl_13(self, _, __): ...

@_p4
async def _pl_14(self, _, __):
...
async def _pl_14(self, _, __): ...

@_p4
async def _pl_15(self, _, __):
...
async def _pl_15(self, _, __): ...

@_p4
async def _pl_16(self, _, __):
...
async def _pl_16(self, _, __): ...

@button(label="Play", style=ButtonStyle.green, emoji=PLAY_BUTTON, row=4)
async def play(self, button: Button, interaction: MessageInteraction) -> None:
Expand Down
40 changes: 25 additions & 15 deletions cogs/help/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,29 @@ async def specific_command(
)
.add_field(
name=" ❯❯ Alias",
value=f"{', '.join(f'`{k}`' for k in command.aliases if command.aliases)} "
if command.aliases
else "`none`",
value=(
f"{', '.join(f'`{k}`' for k in command.aliases if command.aliases)} "
if command.aliases
else "`none`"
),
inline=False,
)
.add_field(
name=" ❯❯ Usage",
value=f"`j.{command.name} {command.signature}`"
if command.signature
else f"`j.{command.name}`",
value=(
f"`j.{command.name} {command.signature}`"
if command.signature
else f"`j.{command.name}`"
),
inline=False,
)
.add_field(
name=" ❯❯ Description",
value=f"{get_help(command.name)}"
if get_help(command.name)
else "Currently no help!",
value=(
f"{get_help(command.name)}"
if get_help(command.name)
else "Currently no help!"
),
inline=False,
)
.set_author(name="Help", icon_url=ctx.author.display_avatar.url)
Expand Down Expand Up @@ -152,15 +158,19 @@ async def no_command(self, ctx: Context) -> disnake.Embed:
)
.add_field(
name="\u200b",
value="\n".join(commands[i] for i in range(0, len(commands), 2))
if commands
else "-",
value=(
"\n".join(commands[i] for i in range(0, len(commands), 2))
if commands
else "-"
),
)
.add_field(
name="\u200b",
value="\n".join(commands[i] for i in range(1, len(commands), 2))
if commands
else "-",
value=(
"\n".join(commands[i] for i in range(1, len(commands), 2))
if commands
else "-"
),
)
)

Expand Down
14 changes: 8 additions & 6 deletions cogs/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def ban(
try:
await member.send("You have been banned: " + reason)
except HTTPException:
await ctx.send("Could message user")
await ctx.send("Could message user")
await member.ban(reason=reason)
embed = disnake.Embed(
title="Banned",
Expand All @@ -137,7 +137,7 @@ async def unban(self, ctx: Context, user_id: int, *, reason="No reason provided"
try:
await user.send(f"You have been unbanned from {ctx.guild.name}")
except HTTPException:
await ctx.send("Could message user")
await ctx.send("Could message user")

@has_permissions(manage_roles=True)
@commands.command(aliases=["add", "+role", "add_role"])
Expand Down Expand Up @@ -301,9 +301,11 @@ async def permmute(self, ctx: Context, member: disnake.Member, *, reason=None):
await ctx.reply(embed=embed)
await member.add_roles(mutedRole, reason=reason)
try:
await member.send(f" you have been muted from: {guild.name} Reason: {reason}")
await member.send(
f" you have been muted from: {guild.name} Reason: {reason}"
)
except HTTPException:
await ctx.send("Could message user")
await ctx.send("Could message user")

@commands.command(
aliases=["unrmute", "runmute"], description="Unreactmutes `<member>`"
Expand Down Expand Up @@ -336,7 +338,7 @@ async def unreactmute(self, ctx: Context, member: disnake.Member, *, reason=None
f"You have been reaction muted from: {guild.name} Reason: {reason}"
)
except HTTPException:
await ctx.send("Could message user")
await ctx.send("Could message user")

@commands.command(aliases=["unmut"], description="Unmutes `<member>`")
@has_permissions(manage_messages=True)
Expand Down Expand Up @@ -366,7 +368,7 @@ async def unmute(self, ctx: Context, member: disnake.Member, *, reason=None):
f"You have been reaction muted from: {guild.name} Reason: {reason}"
)
except HTTPException:
await ctx.send("Could message user")
await ctx.send("Could message user")

@commands.command(
aliases=["tempmute"],
Expand Down
16 changes: 4 additions & 12 deletions cogs/music/dcutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,11 @@ def __init__(self, ctx, music, **kwargs):
if self.ctx.guild.id not in self.music.queue.keys():
self.music.queue[self.ctx.guild.id] = []
self.after_func = check_queue
self.on_play_func = (
self.on_queue_func
) = (
self.on_skip_func
) = (
self.on_play_func = self.on_queue_func = self.on_skip_func = (
self.on_stop_func
) = (
self.on_pause_func
) = (
self.on_resume_func
) = (
self.on_loop_toggle_func
) = self.on_volume_change_func = self.on_remove_from_queue_func = None
) = self.on_pause_func = self.on_resume_func = self.on_loop_toggle_func = (
self.on_volume_change_func
) = self.on_remove_from_queue_func = None
ffmpeg_error = kwargs.get(
"ffmpeg_error_betterfix", kwargs.get("ffmpeg_error_fix")
)
Expand Down
5 changes: 4 additions & 1 deletion cogs/utils/cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ async def charinfo(self, ctx: Context, *, characters: str):

def get_info(
char: str,
) -> Tuple[str, str,]:
) -> Tuple[
str,
str,
]:
digit = f"{ord(char):x}"
if len(digit) <= 4:
u_code = f"\\u{digit:>04}"
Expand Down
Loading

0 comments on commit c1a2a4d

Please sign in to comment.