From 6f04290cba7a37e58f5824a7c342634b5d254a77 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 1 Feb 2024 21:09:53 -0500 Subject: [PATCH] fix(bible): handle if the bot is unable to post embeds --- bible/bible.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/bible/bible.py b/bible/bible.py index 4c05ed3..064c736 100644 --- a/bible/bible.py +++ b/bible/bible.py @@ -175,13 +175,16 @@ class Bible(commands.Cog): await ctx.send("The passage is too long to send.") return - embed = Embed( - title=f"{passage['reference']}", - description=passage["content"].replace("¶ ", ""), - color=await self.bot.get_embed_color(ctx.channel), - ) - embed.set_footer(text=f"{ctx.prefix}bible passage - Powered by API.Bible") - await ctx.send(embed=embed) + if await ctx.embed_requested(): + embed = Embed( + title=f"{passage['reference']}", + description=passage["content"].replace("¶ ", ""), + color=await self.bot.get_embed_color(ctx.channel), + ) + embed.set_footer(text=f"{ctx.prefix}bible passage - Powered by API.Bible") + await ctx.send(embed=embed) + else: + await ctx.send(f"## {passage['reference']}\n{passage['content']}") @bible.command(name="random") async def bible_random(self, ctx: commands.Context): @@ -207,10 +210,13 @@ class Bible(commands.Cog): await ctx.send(e.message) return - embed = Embed( - title=f"{passage['reference']}", - description=passage["content"].replace("¶ ", ""), - color=await self.bot.get_embed_color(ctx.channel), - ) - embed.set_footer(text=f"{ctx.prefix}bible random - Powered by API.Bible") - await ctx.send(embed=embed) + if await ctx.embed_requested(): + embed = Embed( + title=f"{passage['reference']}", + description=passage["content"].replace("¶ ", ""), + color=await self.bot.get_embed_color(ctx.channel), + ) + embed.set_footer(text=f"{ctx.prefix}bible random - Powered by API.Bible") + await ctx.send(embed=embed) + else: + await ctx.send(f"## {passage['reference']}\n{passage['content']}")