Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Jan 28, 2022
1 parent 0d15e7a commit ed3654c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions buttoninvite/button_invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def description(self, ctx, *, text: str = ""):
Use `{bot}` in your message to display bot name.
Enter `None` to disable the description.
"""
if text == "":
if not text:
await self.config.description.clear()
return await ctx.send("Embed description set to default.")
elif text == "None":
Expand All @@ -71,7 +71,7 @@ async def button(self, ctx, *, text: str = ""):
"""
Set the button description.
"""
if text == "":
if not text:
await self.config.invite_description.clear()
return await ctx.send("Button description set to default.")
await self.config.invite_description.set(text)
Expand Down Expand Up @@ -118,7 +118,7 @@ async def footer(self, ctx, *, text: str = ""):
Use `{bot}` in your message to display bot name.
Enter `None` to disable the description.
"""
if text == "":
if not text:
await self.config.footer.clear()
return await ctx.send("Embed footer set to default.")
elif text == "None":
Expand All @@ -135,7 +135,7 @@ async def author(self, ctx, *, text: str = ""):
Use `{bot}` in your message to display bot name.
Enter `None` to disable the author.
"""
if text == "":
if not text:
await self.config.author.clear()
return await ctx.send("Embed author set to default.")
elif text == "None":
Expand All @@ -152,7 +152,7 @@ async def text(self, ctx, *, text: str = ""):
Use `{bot}` in your message to display bot name.
Enter `None` to disable the link text.
"""
if text == "":
if not text:
await self.config.link_text.clear()
return await ctx.send("Embed link text set to default.")
elif text == "None":
Expand All @@ -167,7 +167,7 @@ async def thumbnail(self, ctx, *, link: str = ""):
"""
Set the embed thumbnail url. Leave blank for default thumbnail.
"""
if link == "":
if not link:
await self.config.thumbnail.clear()
return await ctx.send("Embed thumbnail set to default.")
regex = "^https?://(?:[a-z0-9\-]+\.)+[a-z]{2,6}(?:/[^/#?]+)+\.(?:jpg|gif|png)$"
Expand All @@ -184,7 +184,7 @@ async def icon(self, ctx, *, link: str = ""):
"""
Set the embed icon url. Leave blank for default icon.
"""
if link == "":
if not link:
await self.config.icon_url.clear()
return await ctx.send("Embed icon set to default.")
regex = "^https?://(?:[a-z0-9\-]+\.)+[a-z]{2,6}(?:/[^/#?]+)+\.(?:jpg|gif|png)$"
Expand Down Expand Up @@ -235,7 +235,6 @@ async def invite(self, ctx):

def setup(bot):
global old_invite
old_invite = bot.get_command("invite")
if old_invite:
if old_invite := bot.get_command("invite"):
bot.remove_command(old_invite.name)
bot.add_cog(ButtonInvite(bot))

0 comments on commit ed3654c

Please sign in to comment.