fix(bible): handle if the bot is unable to post embeds

This commit is contained in:
Seaswimmer 2024-02-01 21:09:53 -05:00
parent 4dfbc91ced
commit 6f04290cba
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -175,6 +175,7 @@ class Bible(commands.Cog):
await ctx.send("The passage is too long to send.") await ctx.send("The passage is too long to send.")
return return
if await ctx.embed_requested():
embed = Embed( embed = Embed(
title=f"{passage['reference']}", title=f"{passage['reference']}",
description=passage["content"].replace("", ""), description=passage["content"].replace("", ""),
@ -182,6 +183,8 @@ class Bible(commands.Cog):
) )
embed.set_footer(text=f"{ctx.prefix}bible passage - Powered by API.Bible") embed.set_footer(text=f"{ctx.prefix}bible passage - Powered by API.Bible")
await ctx.send(embed=embed) await ctx.send(embed=embed)
else:
await ctx.send(f"## {passage['reference']}\n{passage['content']}")
@bible.command(name="random") @bible.command(name="random")
async def bible_random(self, ctx: commands.Context): async def bible_random(self, ctx: commands.Context):
@ -207,6 +210,7 @@ class Bible(commands.Cog):
await ctx.send(e.message) await ctx.send(e.message)
return return
if await ctx.embed_requested():
embed = Embed( embed = Embed(
title=f"{passage['reference']}", title=f"{passage['reference']}",
description=passage["content"].replace("", ""), description=passage["content"].replace("", ""),
@ -214,3 +218,5 @@ class Bible(commands.Cog):
) )
embed.set_footer(text=f"{ctx.prefix}bible random - Powered by API.Bible") embed.set_footer(text=f"{ctx.prefix}bible random - Powered by API.Bible")
await ctx.send(embed=embed) await ctx.send(embed=embed)
else:
await ctx.send(f"## {passage['reference']}\n{passage['content']}")