feat(bible): added ability to fetch passages

This commit is contained in:
Seaswimmer 2024-02-01 18:14:42 -05:00
parent a432050056
commit 89bdf5583c
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -68,3 +68,19 @@ class Bible(commands.Cog):
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"]) await ctx.send(passage["content"])
@bible.command(name="passage")
async def bible_passage(self, ctx: commands.Context, book: str, passage: str):
"""Get a Bible passage.
Example usage:
`[p]bible passage John 3:16-3:17`"""
bible_id = await self.config.bible()
try:
book_id = await self.translate_book_name(bible_id, book)
except ValueError as e:
await ctx.send(str(e))
return
from_verse, to_verse = passage.replace(":", ".").split("-")
passage = await self._get_passage(bible_id, f"{book_id}.{from_verse}-{book_id}.{to_verse}")
await ctx.send(passage["content"])