fix(bible): awaited a whole bunch of corotuines

This commit is contained in:
Seaswimmer 2024-02-01 17:52:45 -05:00
parent 3e824bca91
commit a14ec9bceb
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -38,7 +38,7 @@ class Bible(commands.Cog):
async def _get_passage(self, bible_id: str, passage_id: str) -> dict: async def _get_passage(self, bible_id: str, passage_id: str) -> dict:
"""Get a Bible passage from the API.bible API.""" """Get a Bible passage from the API.bible API."""
url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/passages/{passage_id}" url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/passages/{passage_id}"
headers = self.bot.get_shared_api_tokens("api.bible") headers = await self.bot.get_shared_api_tokens("api.bible")
async with self.session.get(url, headers=headers) as response: async with self.session.get(url, headers=headers) as response:
data = await response.json() data = await response.json()
return data["data"] return data["data"]
@ -51,7 +51,7 @@ class Bible(commands.Cog):
async def _get_books(self, bible_id: str) -> dict: async def _get_books(self, bible_id: str) -> dict:
"""Get the books of the Bible from the API.bible API.""" """Get the books of the Bible from the API.bible API."""
url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/books" url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/books"
headers = self.bot.get_shared_api_tokens("api.bible") headers = await self.bot.get_shared_api_tokens("api.bible")
async with self.session.get(url, headers=headers) as response: async with self.session.get(url, headers=headers) as response:
data = await response.json() data = await response.json()
return data["data"] return data["data"]
@ -59,7 +59,7 @@ class Bible(commands.Cog):
async def _get_chapters(self, bible_id: str, book_id: str) -> dict: 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.""" """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" url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/books/{book_id}/chapters"
headers = self.bot.get_shared_api_tokens("api.bible") headers = await self.bot.get_shared_api_tokens("api.bible")
async with self.session.get(url, headers=headers) as response: async with self.session.get(url, headers=headers) as response:
data = await response.json() data = await response.json()
return data["data"] return data["data"]
@ -67,7 +67,7 @@ class Bible(commands.Cog):
async def _get_verses(self, bible_id: str, book_id: str, chapter: int) -> dict: 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.""" """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" url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/books/{book_id}/chapters/{chapter}/verses"
headers = self.bot.get_shared_api_tokens("api.bible") headers = await self.bot.get_shared_api_tokens("api.bible")
async with self.session.get(url, headers=headers) as response: async with self.session.get(url, headers=headers) as response:
data = await response.json() data = await response.json()
return data["data"] return data["data"]