fix(bible): added error message if a passage is too long

This commit is contained in:
Seaswimmer 2024-02-01 18:30:57 -05:00
parent bb53343ecc
commit b9fba23415
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -95,6 +95,10 @@ class Bible(commands.Cog):
else: else:
passage = await self._get_passage(bible_id, f"{book_id}.{passage.replace(':', '.')}") passage = await self._get_passage(bible_id, f"{book_id}.{passage.replace(':', '.')}")
if len(passage["content"]) > 4096:
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 = 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") embed.set_footer(text=f"{ctx.prefix}bible passage - Powered by API.bible")
await ctx.send(embed=embed) await ctx.send(embed=embed)