diff options
| -rw-r--r-- | bot/exts/fun/uwu.py | 26 | ||||
| -rw-r--r-- | bot/utils/messages.py | 8 | 
2 files changed, 11 insertions, 23 deletions
| diff --git a/bot/exts/fun/uwu.py b/bot/exts/fun/uwu.py index 60a5834d..83497893 100644 --- a/bot/exts/fun/uwu.py +++ b/bot/exts/fun/uwu.py @@ -11,9 +11,6 @@ from discord.ext.commands import Cog, Context, clean_content  from bot.bot import Bot  from bot.utils import helpers, messages -if t.TYPE_CHECKING: -    from bot.exts.fun.fun import Fun  # pragma: no cover -  WORD_REPLACE = {      "small": "smol",      "cute": "kawaii~", @@ -180,21 +177,16 @@ class Uwu(Cog):          await clean_content(fix_channel_mentions=True).convert(ctx, text) -        fun_cog: t.Optional[Fun] = ctx.bot.get_cog("Fun") - -        if fun_cog: -            # Grabs the text from the embed for uwuification -            if embeds: -                embed = messages.convert_embed(self._uwuify, embeds[0]) -            else: -                # Parse potential message links in text -                text, embed = await messages.get_text_and_embed(ctx, text) - -                # If an embed is found, grab and uwuify its text -                if embed: -                    embed = messages.convert_embed(self._uwuify, embed) +        # Grabs the text from the embed for uwuification +        if embeds: +            embed = messages.convert_embed(self._uwuify, embeds[0])          else: -            embed = None +            # Parse potential message links in text +            text, embed = await messages.get_text_and_embed(ctx, text) + +            # If an embed is found, grab and uwuify its text +            if embed: +                embed = messages.convert_embed(self._uwuify, embed)          # Adds the text harvested from an embed to be put into another quote block.          if text: diff --git a/bot/utils/messages.py b/bot/utils/messages.py index ccc8b61c..71b634e8 100644 --- a/bot/utils/messages.py +++ b/bot/utils/messages.py @@ -3,7 +3,6 @@ import re  from typing import Callable, Optional, Union  from discord import Embed, Message -from discord.ext import commands  from discord.ext.commands import Context, MessageConverter  log = logging.getLogger(__name__) @@ -33,10 +32,7 @@ async def get_discord_message(ctx: Context, text: str) -> Union[Message, str]:      Conversion will succeed if given a discord Message ID or link.      Returns `text` if the conversion fails.      """ -    try: -        text = await MessageConverter().convert(ctx, text) -    except commands.BadArgument: -        log.debug(f"Input '{text:.20}...' is not a valid Discord Message") +    text = await MessageConverter().convert(ctx, text)      return text @@ -64,7 +60,7 @@ async def get_text_and_embed(ctx: Context, text: str) -> tuple[str, Optional[Emb              if msg.embeds:                  embed = msg.embeds[0] -    return (text, embed) +    return text, embed  def convert_embed(func: Callable[[str, ], str], embed: Embed) -> Embed: | 
