Skip to content

Commit

Permalink
Format Python code with psf/black (#120)
Browse files Browse the repository at this point in the history
Co-authored-by: ltzmax <[email protected]>
  • Loading branch information
github-actions[bot] and ltzmax authored Nov 19, 2023
1 parent a2a2701 commit 479c6de
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions suggestion/suggestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,22 +258,28 @@ async def approve(self, ctx, message_id: int, *, reason: Optional[str] = None):
return await ctx.send("Something went wrong while approving the suggestion")
info.log(f"Some error occured while approving a suggestion: {e}")
if reason is not None and len(reason) > 1024:
return await ctx.send("Your reason must be between 0 and 1024 characters long")
return await ctx.send(
"Your reason must be between 0 and 1024 characters long"
)
if msg.embeds:
try:
embed = msg.embeds[0]
except IndexError:
return await ctx.send("Message not found")
info.log(f"{ctx.author} tried to approve a message that is not a suggestion")
if embed.title != 'New Suggestion':
info.log(
f"{ctx.author} tried to approve a message that is not a suggestion"
)
if embed.title != "New Suggestion":
return await ctx.send("This message is not a suggestion")
embed.color = 0x00FF00
if reason is not None:
embed.add_field(name="Reason:", value=f"> {reason}")
embed.set_footer(text="Approved by {author}".format(author=ctx.author))
await msg.edit(embed=embed)
await ctx.send(
"Approved suggestion #{id}".format(id=SUGGESTION_ID.search(msg.content).group(1)),
"Approved suggestion #{id}".format(
id=SUGGESTION_ID.search(msg.content).group(1)
),
allowed_mentions=discord.AllowedMentions(replied_user=False),
reference=ctx.message.to_reference(fail_if_not_exists=False),
)
Expand Down Expand Up @@ -309,22 +315,28 @@ async def reject(self, ctx, message_id: int, *, reason: Optional[str] = None):
return await ctx.send("Something went wrong while rejecting the suggestion")
info.log(f"Some error occured while rejecting a suggestion: {e}")
if reason is not None and len(reason) > 1024:
return await ctx.send("Your reason must be between 0 and 1024 characters long")
return await ctx.send(
"Your reason must be between 0 and 1024 characters long"
)
if msg.embeds:
try:
embed = msg.embeds[0]
except IndexError:
return await ctx.send("Message not found")
info.log(f"{ctx.author} tried to reject a message that is not a suggestion")
if embed.title != 'New Suggestion':
info.log(
f"{ctx.author} tried to reject a message that is not a suggestion"
)
if embed.title != "New Suggestion":
return await ctx.send("This message is not a suggestion")
embed.color = 0xFF0000
if reason is not None:
embed.add_field(name="Reason:", value=f"> {reason}")
embed.set_footer(text="Rejected by {author}".format(author=ctx.author))
await msg.edit(embed=embed)
await ctx.send(
"Rejected suggestion #{id}".format(id=SUGGESTION_ID.search(msg.content).group(1)),
"Rejected suggestion #{id}".format(
id=SUGGESTION_ID.search(msg.content).group(1)
),
allowed_mentions=discord.AllowedMentions(replied_user=False),
reference=ctx.message.to_reference(fail_if_not_exists=False),
)
Expand Down

0 comments on commit 479c6de

Please sign in to comment.