From ad32a0fa67b8f7c3b2c322eb9aa385beb33cce52 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Thu, 1 Feb 2024 17:59:19 -0500 Subject: [PATCH] fix(bible): return if error is encountered --- bible/bible.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/bible/bible.py b/bible/bible.py index 392a73d..3a08cf9 100644 --- a/bible/bible.py +++ b/bible/bible.py @@ -44,11 +44,6 @@ class Bible(commands.Cog): data = await response.json() return data["data"] - async def _get_verse(self, bible_id: str, book_id: str, chapter: int, verse: int) -> dict: - """Get a Bible verse from the API.bible API.""" - passage_id = f"{book_id}.{chapter}.{verse}" - return await self._get_passage(bible_id, passage_id) - async def _get_books(self, bible_id: str) -> dict: """Get the books of the Bible from the API.bible API.""" url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/books" @@ -57,22 +52,6 @@ class Bible(commands.Cog): data = await response.json() return data["data"] - async def _get_chapters(self, bible_id: str, book_id: str) -> dict: - """Get the chapters of a book of the Bible from the API.bible API.""" - url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/books/{book_id}/chapters" - headers = await self.bot.get_shared_api_tokens("api.bible") - async with self.session.get(url, headers=headers) as response: - data = await response.json() - return data["data"] - - async def _get_verses(self, bible_id: str, book_id: str, chapter: int) -> dict: - """Get the verses of a chapter of a book of the Bible from the API.bible API.""" - url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/books/{book_id}/chapters/{chapter}/verses" - headers = await self.bot.get_shared_api_tokens("api.bible") - async with self.session.get(url, headers=headers) as response: - data = await response.json() - return data["data"] - @commands.group(autohelp=True) async def bible(self, ctx: commands.Context): """Core command for the Bible cog.""" @@ -85,5 +64,6 @@ class Bible(commands.Cog): book_id = await self.translate_book_name(bible_id, book) except ValueError as e: await ctx.send(str(e)) + return passage = await self._get_verse(bible_id, book_id, chapter, verse) await ctx.send(passage["content"])