From fe9a92106c353c72b0d52f80dd120bb39de2f0ff Mon Sep 17 00:00:00 2001 From: sgoudham Date: Wed, 12 Aug 2020 08:27:00 +0100 Subject: [PATCH] Removed lots of redundant code --- cogs/anime.py | 105 -------------------------------------------------- 1 file changed, 105 deletions(-) diff --git a/cogs/anime.py b/cogs/anime.py index 4e040327..64e2075e 100644 --- a/cogs/anime.py +++ b/cogs/anime.py @@ -1,5 +1,3 @@ -import datetime -import random from typing import Optional import aiohttp @@ -12,109 +10,6 @@ from settings import rndColour, enso_embedmod_colours my_waifu_list_auth = config('MYWAIFULIST_AUTH') -# Defining the full names of the waifu's/husbando's -anime = {"yumeko": "Jabami Yumeko", - "toga": "Himiko Toga", - "maki": "Maki Oze", - "kakashi": "Hatake Kakashi", - "tamaki": "Tamaki Suoh", - } - - -# Gets the member and user avatar -def getMember(msg): - # Set member as the author - member = msg.author - # Get the member avatar - userAvatar = member.avatar_url - - return member, userAvatar - - -# Function to turn the user inputted name into the full name -def Abbrev(anime_msg): - # Get the lowercase - split_anime = anime_msg.split() - new_msg = "" - - # For each word in split_anime - for word in split_anime: - # If the word exists in the anime array - if word in anime: - # Set a new string equal to the full name of the waifu/husbando - new_msg = anime[word] - - return new_msg - - -def randomWaifu(msg, waifu): - """Return Embed for Specific Waifu""" - - # Retrieve a random image of a waifu within the bot - with open(f'images/AnimeImages/Waifus/{random.choice(waifu)}.txt') as file: - array = file.readlines() - - # Get the member and the userAvatar - member, userAvatar = getMember(msg) - - # Set up the embed for a random waifu image - waifu_embed = Embed( - title=f"Oh Look! A Wonderful Waifu! ", - colour=rndColour(), - timestamp=datetime.datetime.utcnow()) - waifu_embed.set_image(url=random.choice(array)) - waifu_embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar)) - - return waifu_embed - - -def randomHusbando(msg, husbando): - """Display embed for Specific Husbando""" - - # Retrieve a random image of a husbando within the bot - with open(f'images/AnimeImages/Husbandos/{random.choice(husbando)}.txt') as file: - array = file.readlines() - - # Get the member and the userAvatar - member, userAvatar = getMember(msg) - - # Set up the embed for a random husbando image - husbando_embed = Embed( - title=f"Oh Look! A Handsome Husbando! ", - colour=rndColour(), - timestamp=datetime.datetime.utcnow()) - husbando_embed.set_image(url=random.choice(array)) - husbando_embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar)) - - return husbando_embed - - -def displayAnimeImage(array, msg, name): - """Setup Embed for Specific Waifu/Husbando""" - - # Get the member and the userAvatar - member, userAvatar = getMember(msg) - - # Set up embed for an image relating to a husbando or waifu - anime_embed = Embed( - title=f"**{name}**", - colour=rndColour(), - timestamp=datetime.datetime.utcnow()) - anime_embed.set_image(url=random.choice(array)) - anime_embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar)) - - return anime_embed - - -def waifus(): - """List of Waifu's""" - return ["toga", "yumeko", "maki"] - - -def husbandos(): - """List of Husbando's""" - return ["kakashi", "tamaki"] - def store_waifus(waifus_dict, waifu, value): """Method to store waifu's in the new dict"""