|
|
@ -10,6 +10,23 @@ from discord.ext.commands import cooldown, BucketType
|
|
|
|
import settings
|
|
|
|
import settings
|
|
|
|
from cogs.Embeds import error_function
|
|
|
|
from cogs.Embeds import error_function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
anime = {"yumeko": "Jabami Yumeko",
|
|
|
|
|
|
|
|
"toga": "Himiko Toga",
|
|
|
|
|
|
|
|
"kakashi": "Hatake Kakashi",
|
|
|
|
|
|
|
|
"tamaki": "Tamaki Suoh"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def Abbrev(anime_msg):
|
|
|
|
|
|
|
|
lowercase_anime = anime_msg.lower()
|
|
|
|
|
|
|
|
split_anime = lowercase_anime.split()
|
|
|
|
|
|
|
|
new_msg = ""
|
|
|
|
|
|
|
|
for word in split_anime:
|
|
|
|
|
|
|
|
if word in anime:
|
|
|
|
|
|
|
|
new_msg = anime[word]
|
|
|
|
|
|
|
|
print(new_msg)
|
|
|
|
|
|
|
|
return new_msg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Waifus(commands.Cog):
|
|
|
|
class Waifus(commands.Cog):
|
|
|
|
def __init__(self, bot):
|
|
|
|
def __init__(self, bot):
|
|
|
@ -99,59 +116,63 @@ class Waifus(commands.Cog):
|
|
|
|
waifu_array = ["toga", "yumeko"]
|
|
|
|
waifu_array = ["toga", "yumeko"]
|
|
|
|
husbando_array = ["husk", "kakashi", "tamaki"]
|
|
|
|
husbando_array = ["husk", "kakashi", "tamaki"]
|
|
|
|
|
|
|
|
|
|
|
|
def randomWaifu(message, waifu_array):
|
|
|
|
# Function to return a random image of a waifu
|
|
|
|
with open(f'images/AnimeImages/Waifus/{random.choice(waifu_array)}.txt') as file:
|
|
|
|
def randomWaifu(msg, 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()
|
|
|
|
array = file.readlines()
|
|
|
|
|
|
|
|
|
|
|
|
# Set member as the author
|
|
|
|
# Set member as the author
|
|
|
|
member = message.author
|
|
|
|
member = msg.author
|
|
|
|
# Get the member's avatar
|
|
|
|
# Get the member's avatar
|
|
|
|
userAvatar = member.avatar_url
|
|
|
|
userAvatar = member.avatar_url
|
|
|
|
|
|
|
|
|
|
|
|
embed = discord.Embed(
|
|
|
|
# Set up the embed for a random waifu image
|
|
|
|
title=f"Oh Look! A Cute Waifu! <a:huh:676195228872474643> <a:huh:676195228872474643> ",
|
|
|
|
waifu_embed = discord.Embed(
|
|
|
|
|
|
|
|
title=f"Oh Look! A Wonderful Waifu! <a:huh:676195228872474643> <a:huh:676195228872474643> ",
|
|
|
|
colour=discord.Colour(random.choice(settings.colour_list)))
|
|
|
|
colour=discord.Colour(random.choice(settings.colour_list)))
|
|
|
|
embed.set_image(url=random.choice(array))
|
|
|
|
embed.set_image(url=random.choice(array))
|
|
|
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
|
|
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
|
|
|
embed.timestamp = datetime.datetime.utcnow()
|
|
|
|
embed.timestamp = datetime.datetime.utcnow()
|
|
|
|
|
|
|
|
|
|
|
|
return embed
|
|
|
|
return waifu_embed
|
|
|
|
|
|
|
|
|
|
|
|
def randomHusbando(message, husbando_array):
|
|
|
|
# Function to return a random image of a husbando
|
|
|
|
with open(f'images/AnimeImages/Husbandos/{random.choice(husbando_array)}.txt') as file:
|
|
|
|
def randomHusbando(msg, 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()
|
|
|
|
array = file.readlines()
|
|
|
|
|
|
|
|
|
|
|
|
# Set member as the author
|
|
|
|
# Set member as the author
|
|
|
|
member = message.author
|
|
|
|
member = msg.author
|
|
|
|
# Get the member's avatar
|
|
|
|
# Get the member's avatar
|
|
|
|
userAvatar = member.avatar_url
|
|
|
|
userAvatar = member.avatar_url
|
|
|
|
|
|
|
|
|
|
|
|
embed = discord.Embed(
|
|
|
|
# Set up the embed for a random husbando image
|
|
|
|
|
|
|
|
husbando_embed = discord.Embed(
|
|
|
|
title=f"Oh Look! A Handsome Husbando! <a:huh:676195228872474643> <a:huh:676195228872474643> ",
|
|
|
|
title=f"Oh Look! A Handsome Husbando! <a:huh:676195228872474643> <a:huh:676195228872474643> ",
|
|
|
|
colour=discord.Colour(random.choice(settings.colour_list)))
|
|
|
|
colour=discord.Colour(random.choice(settings.colour_list)))
|
|
|
|
embed.set_image(url=random.choice(array))
|
|
|
|
embed.set_image(url=random.choice(array))
|
|
|
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
|
|
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
|
|
|
embed.timestamp = datetime.datetime.utcnow()
|
|
|
|
embed.timestamp = datetime.datetime.utcnow()
|
|
|
|
|
|
|
|
|
|
|
|
return embed
|
|
|
|
return husbando_embed
|
|
|
|
|
|
|
|
|
|
|
|
# Function to allow modular code and sets up the embed for the
|
|
|
|
# Function to allow modular code and sets up the embed for the
|
|
|
|
def displayAnimeImage(array, message, name):
|
|
|
|
def displayAnimeImage(array, msg, name):
|
|
|
|
# If the channel that the command has been sent is in the list of accepted channels
|
|
|
|
# Set member as the author
|
|
|
|
if str(message.channel) in settings.channels:
|
|
|
|
member = msg.author
|
|
|
|
# Set member as the author
|
|
|
|
# Get the member's avatar
|
|
|
|
member = message.author
|
|
|
|
userAvatar = member.avatar_url
|
|
|
|
# Get the member's avatar
|
|
|
|
|
|
|
|
userAvatar = member.avatar_url
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
embed = discord.Embed(
|
|
|
|
anime_embed = discord.Embed(
|
|
|
|
title=f"**{name.capitalize()}**",
|
|
|
|
title=f"**{name}**",
|
|
|
|
colour=discord.Colour(random.choice(settings.colour_list)))
|
|
|
|
colour=discord.Colour(random.choice(settings.colour_list)))
|
|
|
|
embed.set_image(url=random.choice(array))
|
|
|
|
embed.set_image(url=random.choice(array))
|
|
|
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
|
|
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
|
|
|
embed.timestamp = datetime.datetime.utcnow()
|
|
|
|
embed.timestamp = datetime.datetime.utcnow()
|
|
|
|
|
|
|
|
|
|
|
|
return embed
|
|
|
|
return anime_embed
|
|
|
|
|
|
|
|
|
|
|
|
# If the channel that the command has been sent is in the list of accepted channels
|
|
|
|
# If the channel that the command has been sent is in the list of accepted channels
|
|
|
|
if str(channel) in settings.channels:
|
|
|
|
if str(channel) in settings.channels:
|
|
|
@ -170,7 +191,8 @@ class Waifus(commands.Cog):
|
|
|
|
with open(f'images/AnimeImages/Waifus/{w_array}.txt') as file:
|
|
|
|
with open(f'images/AnimeImages/Waifus/{w_array}.txt') as file:
|
|
|
|
images_array = file.readlines()
|
|
|
|
images_array = file.readlines()
|
|
|
|
|
|
|
|
|
|
|
|
embed = displayAnimeImage(images_array, message, w_array)
|
|
|
|
full_name = Abbrev(w_array)
|
|
|
|
|
|
|
|
embed = displayAnimeImage(images_array, message, full_name)
|
|
|
|
await channel.send(embed=embed)
|
|
|
|
await channel.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
|
|
except FileNotFoundError as e:
|
|
|
|
except FileNotFoundError as e:
|
|
|
@ -196,9 +218,9 @@ class Waifus(commands.Cog):
|
|
|
|
with open(f'images/AnimeImages/Husbandos/{h_array}.txt') as file:
|
|
|
|
with open(f'images/AnimeImages/Husbandos/{h_array}.txt') as file:
|
|
|
|
images_array = file.readlines()
|
|
|
|
images_array = file.readlines()
|
|
|
|
|
|
|
|
|
|
|
|
embed = displayAnimeImage(images_array, message, h_array)
|
|
|
|
full_name = Abbrev(h_array)
|
|
|
|
|
|
|
|
embed = displayAnimeImage(images_array, message, full_name)
|
|
|
|
await channel.send(embed=embed)
|
|
|
|
await channel.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
|
|
except FileNotFoundError as e:
|
|
|
|
except FileNotFoundError as e:
|
|
|
|
print(e)
|
|
|
|
print(e)
|
|
|
|