fix(bible): don't use fums on an api route that doesn't support it

This commit is contained in:
Seaswimmer 2024-02-02 01:48:58 -05:00
parent 7597dcf5f7
commit 83edd36d6b
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -107,16 +107,12 @@ class Bible(commands.Cog):
"""Get the books of the Bible from the API.bible API."""
url = f"https://api.scripture.api.bible/v1/bibles/{bible_id}/books"
headers = await self.bot.get_shared_api_tokens("api.bible")
params = {
"fums-version": "3",
}
async with self.session.get(url, headers=headers, params=params) as response:
async with self.session.get(url, headers=headers) as response:
data = await response.json()
self.logger.debug(
"_get_books executed with a response code of: %s\nURL: %s\n%s",
"_get_books executed with a response code of: %s\n%s",
response.status,
response.url,
json.dumps(data),
)
if response.status == 401:
@ -125,23 +121,7 @@ class Bible(commands.Cog):
raise bible.errors.BibleAccessError()
if response.status == 503:
raise bible.errors.ServiceUnavailable()
fums_url = "https://fums.api.bible/f3"
fums_params = {
"t": data["meta"]["fumsToken"],
"dId": "discord-" + str(self.bot.user.id),
"sId": "discord-" + str(ctx.message.created_at.timestamp()),
"uId": ctx.author.id,
}
async with self.session.get(fums_url, params=fums_params) as response:
fums_data = await response.json()
self.logger.debug(
"_get_books FUMS executed with a response code of: %s\n%s",
response.status,
json.dumps(fums_data),
)
return data["data"]
return data["data"]
async def _get_chapters(
self, ctx: commands.Context, bible_id: str, book_id: str