Skip to content

Commit

Permalink
Merge sourcery-ai into here.
Browse files Browse the repository at this point in the history
  • Loading branch information
ltzmax committed Oct 26, 2023
1 parent 83d4902 commit cc8a1ef
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions captcha/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def _channel(
"""
if channel is None:
await self.config.guild(ctx.guild).channel.clear() # type: ignore
await ctx.send(f"Cleared the captcha verification channel.")
await ctx.send("Cleared the captcha verification channel.")
return
await self.config.guild(ctx.guild).channel.set(channel.id) # type: ignore
await ctx.send(
Expand All @@ -83,7 +83,7 @@ async def _role(self, ctx: commands.Context, *, role: Optional[discord.Role] = N
"""
if role is None:
await self.config.guild(ctx.guild).role_after_captcha.clear() # type: ignore
await ctx.send(f"Cleared the captcha verification role.")
await ctx.send("Cleared the captcha verification role.")
return
await self.config.guild(ctx.guild).role_after_captcha.set(role.id) # type: ignore
await ctx.send(
Expand Down Expand Up @@ -125,7 +125,7 @@ async def _before(
"""
if message is None:
await self.config.guild(ctx.guild).message_before_captcha.clear() # type: ignore
await ctx.send(f"Cleared the before captcha message.")
await ctx.send("Cleared the before captcha message.")
return
await self.config.guild(ctx.guild).message_before_captcha.set(message) # type: ignore
await ctx.send(f"Changed the before captcha message:\n{box(str(message), lang='json')}")
Expand Down Expand Up @@ -155,15 +155,9 @@ async def _settings(self, ctx: commands.Context):
"""
data: Dict[str, Any] = await self.config.guild(ctx.guild).all() # type: ignore
role = ctx.guild.get_role(data["role_after_captcha"])
if role is None:
role = "None"
else:
role = f"<@&{role.id}> ({role.id})"
role = "None" if role is None else f"<@&{role.id}> ({role.id})"
channel = ctx.guild.get_channel(data["channel"])
if channel is None:
channel = "None"
else:
channel = f"<#{channel.id}> ({channel.id})"
channel = "None" if channel is None else f"<#{channel.id}> ({channel.id})"
embed: discord.Embed = discord.Embed(
title="Captcha Settings",
description=(
Expand Down

0 comments on commit cc8a1ef

Please sign in to comment.