aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/fun/catify.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/fun/catify.py')
-rw-r--r--bot/exts/fun/catify.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/bot/exts/fun/catify.py b/bot/exts/fun/catify.py
index 6e8c75ba..67d17292 100644
--- a/bot/exts/fun/catify.py
+++ b/bot/exts/fun/catify.py
@@ -1,6 +1,5 @@
import random
from contextlib import suppress
-from typing import Optional
from discord import AllowedMentions, Embed, Forbidden
from discord.ext import commands
@@ -15,7 +14,7 @@ class Catify(commands.Cog):
@commands.command(aliases=("ᓚᘏᗢify", "ᓚᘏᗢ"))
@commands.cooldown(1, 5, commands.BucketType.user)
- async def catify(self, ctx: commands.Context, *, text: Optional[str]) -> None:
+ async def catify(self, ctx: commands.Context, *, text: str | None) -> None:
"""
Convert the provided text into a cat themed sentence by interspercing cats throughout text.
@@ -36,13 +35,12 @@ class Catify(commands.Cog):
await ctx.send(embed=embed)
return
- else:
- display_name += f" | {random.choice(Cats.cats)}"
+ display_name += f" | {random.choice(Cats.cats)}"
- await ctx.send(f"Your catified nickname is: `{display_name}`", allowed_mentions=AllowedMentions.none())
+ await ctx.send(f"Your catified nickname is: `{display_name}`", allowed_mentions=AllowedMentions.none())
- with suppress(Forbidden):
- await ctx.author.edit(nick=display_name)
+ with suppress(Forbidden):
+ await ctx.author.edit(nick=display_name)
else:
if len(text) >= 1500:
embed = Embed(
@@ -61,9 +59,9 @@ class Catify(commands.Cog):
string_list[index] = name.replace("cat", f"**{random.choice(Cats.cats)}**")
else:
string_list[index] = name.replace("cat", random.choice(Cats.cats))
- for element in Cats.cats:
- if element in name:
- string_list[index] = name.replace(element, "cat")
+ for cat in Cats.cats:
+ if cat in name:
+ string_list[index] = name.replace(cat, "cat")
string_len = len(string_list) // 3 or len(string_list)