fix(bible): allow bible_passage to be used for single verses
This commit is contained in:
parent
5652e13ad7
commit
7f2555218c
1 changed files with 11 additions and 6 deletions
|
@ -69,7 +69,9 @@ class Bible(commands.Cog):
|
||||||
await ctx.send(str(e))
|
await ctx.send(str(e))
|
||||||
return
|
return
|
||||||
passage = await self._get_passage(bible_id, f"{book_id}.{chapter}.{verse}")
|
passage = await self._get_passage(bible_id, f"{book_id}.{chapter}.{verse}")
|
||||||
await ctx.send(passage["content"])
|
embed = Embed(title=f"{passage['reference']}", description=passage["content"].replace('¶ ', ''), color=await self.bot.get_embed_color(ctx.channel))
|
||||||
|
embed.footer = f"{ctx.prefix}bible verse - Powered by API.bible"
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
@bible.command(name="passage")
|
@bible.command(name="passage")
|
||||||
async def bible_passage(self, ctx: commands.Context, book: str, passage: str):
|
async def bible_passage(self, ctx: commands.Context, book: str, passage: str):
|
||||||
|
@ -85,11 +87,14 @@ class Bible(commands.Cog):
|
||||||
await ctx.send(str(e))
|
await ctx.send(str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
from_verse, to_verse = passage.replace(":", ".").split("-")
|
if len(passage.split('-')) == 2:
|
||||||
if '.' not in to_verse:
|
from_verse, to_verse = passage.replace(":", ".").split("-")
|
||||||
to_verse = f"{from_verse.split('.')[0]}.{to_verse}"
|
if '.' not in to_verse:
|
||||||
|
to_verse = f"{from_verse.split('.')[0]}.{to_verse}"
|
||||||
passage = await self._get_passage(bible_id, f"{book_id}.{from_verse}-{book_id}.{to_verse}")
|
passage = await self._get_passage(bible_id, f"{book_id}.{from_verse}-{book_id}.{to_verse}")
|
||||||
|
else:
|
||||||
|
passage = await self._get_passage(bible_id, f"{book_id}.{passage.replace(':', '.')}")
|
||||||
|
|
||||||
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.footer = f"{ctx.prefix}bible passage - Powered by API.bible"
|
||||||
await ctx.send(embed=embed)
|
await ctx.send(embed=embed)
|
||||||
|
|
Loading…
Reference in a new issue