galacticwarrior9 / IslamBot

A Discord bot that supports Qur'an, hadith, prayer times, tafsir and more.
GNU General Public License v3.0
88 stars 37 forks source link

Error getting hadith from Forty Hadith of an-Nawawi #27

Closed msabur closed 2 years ago

msabur commented 2 years ago

When I use the command -hadith nawawi 1, the bot says that the hadith can't be found. I looked into it a bit, and it seems that the API was giving a 404 response. A possible solution is using "forty" instead of "nawawi40" as the collection name when making the request. That solved the error for me. https://api.sunnah.com/v1/collections/nawawi40/hadiths/1 returned 404 https://api.sunnah.com/v1/collections/forty/hadiths/1 gave the hadith

May Allah reward you for your amazing work

galacticwarrior9 commented 2 years ago

This is strange as nawawi40 is still returned as a valid collection from the collections list endpoint. I'll give this a few days and implement the workaround you proposed if the problem has still not been rectified on the API side by then.

galacticwarrior9 commented 2 years ago

Fixed by https://github.com/galacticwarrior9/IslamBot/commit/af8283f6425b45fe53315d1dabf440a79c8a1b14