|
|
|
@ -14,8 +14,6 @@
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
from typing import Optional
|
|
|
|
|
|
|
|
|
|
import aiohttp
|
|
|
|
|
from decouple import config
|
|
|
|
|
from discord import Embed
|
|
|
|
@ -166,7 +164,7 @@ class Anime(Cog):
|
|
|
|
|
|
|
|
|
|
@group(name="waifu", invoke_without_command=True, case_insensitive=True)
|
|
|
|
|
@bot_has_permissions(embed_links=True, add_reactions=True)
|
|
|
|
|
async def waifu(self, ctx, *, waifu2: Optional[str] = None):
|
|
|
|
|
async def waifu(self, ctx, *, name: str):
|
|
|
|
|
"""
|
|
|
|
|
Shows a Waifu (UNDER CONSTRUCTION)
|
|
|
|
|
Waifu's are grabbed from mywaifulist.com
|
|
|
|
@ -175,12 +173,9 @@ class Anime(Cog):
|
|
|
|
|
# Local Variable i to allow the index of the pages[] to be modified
|
|
|
|
|
i = 0
|
|
|
|
|
|
|
|
|
|
# When a waifu has been specified, retrieve waifu(s) matching the user input
|
|
|
|
|
if waifu2:
|
|
|
|
|
|
|
|
|
|
waifus_dict = {}
|
|
|
|
|
url = "https://mywaifulist.moe/api/v1/search/"
|
|
|
|
|
data = {"term": waifu2,
|
|
|
|
|
data = {"term": name,
|
|
|
|
|
'content-type': "application/json"}
|
|
|
|
|
|
|
|
|
|
# Searching API for waifu(s)
|
|
|
|
@ -204,11 +199,13 @@ class Anime(Cog):
|
|
|
|
|
waifus_dict[waifu["name"]] = {}
|
|
|
|
|
for value in waifu:
|
|
|
|
|
store_waifus(waifus_dict, waifu, value)
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
# When no waifu has been retrieved, send error message to the user
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
await self.bot.generate_embed(ctx, desc="**Waifu Not Found!**")
|
|
|
|
|
|
|
|
|
|
# Get the instance of the bot
|
|
|
|
|