diff options
author | 2022-07-13 19:57:11 -0400 | |
---|---|---|
committer | 2022-07-13 19:57:11 -0400 | |
commit | 9d3ae7f11c86e918c7c5dcb25c3b12b68a0ab09a (patch) | |
tree | e1f0904c81d687a98e6bee6409e291cedd38f19b /bot/exts | |
parent | Bump lxml from 4.7.1 to 4.9.1 (#1068) (diff) |
Fix issue with .uwu failing to uwuify embeds in replies
Diffstat (limited to 'bot/exts')
-rw-r--r-- | bot/exts/fun/uwu.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/bot/exts/fun/uwu.py b/bot/exts/fun/uwu.py index e70d1c0f..d294dc6a 100644 --- a/bot/exts/fun/uwu.py +++ b/bot/exts/fun/uwu.py @@ -118,27 +118,39 @@ class Uwu(Cog): # If `text` isn't provided then we try to get message content of a replied message text = text or getattr(ctx.message.reference, "resolved", None) if isinstance(text, discord.Message): + embeds = text.embeds text = text.content + else: + embeds = None if text is None: # If we weren't able to get the content of a replied message raise commands.UserInputError("Your message must have content or you must reply to a message.") - + await clean_content(fix_channel_mentions=True).convert(ctx, text) - - if fun_cog := ctx.bot.get_cog("Fun"): + + fun_cog = ctx.bot.get_cog("Fun") + if fun_cog: text, embed = await fun_cog._get_text_and_embed(ctx, text) - - # Grabs the text from the embed for uwuification. + + # Grabs the text from the embed for uwuification if embed is not None: embed = fun_cog._convert_embed(self._uwuify, embed) + else: + # Only use the first embed since only a single one can be sent + embed = fun_cog._convert_embed(self._uwuify, embeds[0]) if embeds else None else: embed = None + converted_text = self._uwuify(text) converted_text = helpers.suppress_links(converted_text) # Adds the text harvested from an embed to be put into another quote block. - converted_text = f">>> {converted_text.lstrip('> ')}" + if text: + converted_text = f">>> {converted_text.lstrip('> ')}" + else: + converted_text = None + await ctx.send(content=converted_text, embed=embed) |