diff options
Diffstat (limited to 'bot/exts/fun/catify.py')
-rw-r--r-- | bot/exts/fun/catify.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/bot/exts/fun/catify.py b/bot/exts/fun/catify.py index 6e8c75ba..c1677cd8 100644 --- a/bot/exts/fun/catify.py +++ b/bot/exts/fun/catify.py @@ -1,21 +1,22 @@ import random from contextlib import suppress -from typing import Optional from discord import AllowedMentions, Embed, Forbidden from discord.ext import commands from bot.bot import Bot -from bot.constants import Cats, Colours, NEGATIVE_REPLIES +from bot.constants import Colours, NEGATIVE_REPLIES from bot.utils import helpers +CATS = ["ᓚᘏᗢ", "ᘡᘏᗢ", "🐈", "ᓕᘏᗢ", "ᓇᘏᗢ", "ᓂᘏᗢ", "ᘣᘏᗢ", "ᕦᘏᗢ", "ᕂᘏᗢ"] + class Catify(commands.Cog): """Cog for the catify command.""" @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 +37,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)}" - 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( @@ -58,21 +58,21 @@ class Catify(commands.Cog): name = name.lower() if "cat" in name: if random.randint(0, 5) == 5: - string_list[index] = name.replace("cat", f"**{random.choice(Cats.cats)}**") + string_list[index] = name.replace("cat", f"**{random.choice(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") + string_list[index] = name.replace("cat", random.choice(CATS)) + for cat in CATS: + if cat in name: + string_list[index] = name.replace(cat, "cat") string_len = len(string_list) // 3 or len(string_list) for _ in range(random.randint(1, string_len)): # insert cat at random index if random.randint(0, 5) == 5: - string_list.insert(random.randint(0, len(string_list)), f"**{random.choice(Cats.cats)}**") + string_list.insert(random.randint(0, len(string_list)), f"**{random.choice(CATS)}**") else: - string_list.insert(random.randint(0, len(string_list)), random.choice(Cats.cats)) + string_list.insert(random.randint(0, len(string_list)), random.choice(CATS)) text = helpers.suppress_links(" ".join(string_list)) await ctx.send( |