Skip to content

Commit

Permalink
Format Python code with psf/black push
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and github-actions committed Nov 11, 2023
1 parent 1f0ab52 commit c0222b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
16 changes: 13 additions & 3 deletions cogs/image_service_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ async def draw_command(
except Exception as e:
print(e)
traceback.print_exc()
await safe_ctx_respond(ctx=ctx, content="Something went wrong. Please try again later.", ephemeral=from_action)
await safe_ctx_respond(
ctx=ctx,
content="Something went wrong. Please try again later.",
ephemeral=from_action,
)
await ctx.send_followup(e, ephemeral=from_action)

async def draw_old_command(
Expand Down Expand Up @@ -123,7 +127,11 @@ async def draw_old_command(
except Exception as e:
print(e)
traceback.print_exc()
await safe_ctx_respond(ctx=ctx, content="Something went wrong. Please try again later.", ephemeral=from_action)
await safe_ctx_respond(
ctx=ctx,
content="Something went wrong. Please try again later.",
ephemeral=from_action,
)

await ctx.send_followup(e, ephemeral=from_action)

Expand Down Expand Up @@ -151,7 +159,9 @@ async def local_size_command(self, ctx: discord.ApplicationContext):

# Format the size to be in MB and send.
total_size = total_size / 1000000
await safe_ctx_respond(ctx=ctx, content=f"The size of the local images folder is {total_size} MB.")
await safe_ctx_respond(
ctx=ctx, content=f"The size of the local images folder is {total_size} MB."
)

async def clear_local_command(self, ctx):
"""Delete all local images"""
Expand Down
2 changes: 1 addition & 1 deletion utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .safe_ctx_respond import safe_ctx_respond
from .safe_ctx_respond import safe_ctx_respond
6 changes: 3 additions & 3 deletions utils/safe_ctx_respond.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def safe_ctx_respond(ctx: discord.ApplicationContext, content: str) -> Non
Raises:
ValueError: If `ctx` is not provided in the `kwargs`.
Examples:
```py
# Respond to an interaction
Expand All @@ -33,8 +33,8 @@ async def safe_ctx_respond(ctx: discord.ApplicationContext, content: str) -> Non
try:
await ctx.message.reply(content)
except (
discord.NotFound,
AttributeError,
discord.NotFound,
AttributeError,
): # AttributeError is raised when ctx.message is None, NotFound is raised when the message is not found
# If the message is not found, send a new message to the channel
content = f"**{ctx.message.author.mention}** \n{content}".strip(
Expand Down

0 comments on commit c0222b3

Please sign in to comment.