diff options
author | 2023-05-06 16:12:32 +0100 | |
---|---|---|
committer | 2023-05-09 15:41:50 +0100 | |
commit | 613840ebcf303e84048d48ace37fb001c1afe687 (patch) | |
tree | 9acaf0bae0527fe8389483a419b44e06997ca060 /bot/exts/fun/catify.py | |
parent | Migrate to ruff (diff) |
Apply fixes for ruff linting
Co-authored-by: wookie184 <[email protected]>
Co-authored-by: Amrou Bellalouna <[email protected]>
Diffstat (limited to 'bot/exts/fun/catify.py')
-rw-r--r-- | bot/exts/fun/catify.py | 18 |
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) |