Added 15k Waifus

Loaded Waifus into Mem
Testing embed display
pull/8/head
sgoudham 4 years ago
parent 862e6dbeca
commit ae487b4994

@ -6,7 +6,7 @@ from typing import Optional
from discord import Embed from discord import Embed
from discord.ext.commands import bot_has_permissions, Cog, group from discord.ext.commands import bot_has_permissions, Cog, group
from settings import rndColour, enso_embedmod_colours from settings import rndColour, enso_embedmod_colours, waifus_dict
# Defining the full names of the waifu's/husbando's # Defining the full names of the waifu's/husbando's
anime = {"yumeko": "Jabami Yumeko", anime = {"yumeko": "Jabami Yumeko",
@ -128,6 +128,29 @@ class Anime(Cog):
async def waifu(self, ctx, waifu: Optional[str] = None): async def waifu(self, ctx, waifu: Optional[str] = None):
"""Shows a Waifu""" """Shows a Waifu"""
name = None
desc = None
url = None
likes = None
trash = None
for key in waifus_dict:
if waifu.lower() in key["data"]["name"].lower():
name = key["data"]["name"]
desc = key["data"]["description"]
url = key["data"]["display_picture"]
likes = key["data"]["likes"]
trash = key["data"]["trash"]
break
embed = Embed(title=name, description=desc,
colour=rndColour(),
timestamp=datetime.datetime.utcnow())
embed.set_image(url=url)
embed.set_footer(text=f"<a:biglove:739563551987073047> {likes} 💔 {trash}")
await ctx.send(embed=embed)
if waifu: if waifu:
lcase_waifu = waifu.lower() lcase_waifu = waifu.lower()

@ -1,3 +1,4 @@
import json
import random import random
from discord import Colour from discord import Colour
@ -78,6 +79,16 @@ def del_cache(guildid):
# --------------------------------------------!End Cache Section!------------------------------------------------------- # --------------------------------------------!End Cache Section!-------------------------------------------------------
# --------------------------------------------!Waifu Cache Section!-----------------------------------------------------
# Opening JSON file
with open('waifusformatted.json') as json_file:
waifus_dict = json.load(json_file)
# --------------------------------------------!End Waifu Cache Section!-------------------------------------------------
# --------------------------------------------!ModLogs Section!--------------------------------------------------------- # --------------------------------------------!ModLogs Section!---------------------------------------------------------
# Updating the modlog within the dict and database when the method is called # Updating the modlog within the dict and database when the method is called
@ -169,8 +180,10 @@ def del_cache_prefix(guildid):
del enso_cache[guildid]["Prefix"] del enso_cache[guildid]["Prefix"]
# Get the prefix of the guild that the user is in #
def get_prefix_for_guild(guildid): def get_prefix_for_guild(guildid):
"""Get the prefix of the guild that the user is in"""
prefix = enso_cache[guildid]["Prefix"] prefix = enso_cache[guildid]["Prefix"]
if prefix is not None: if prefix is not None:
return prefix return prefix
@ -199,8 +212,9 @@ enso_newpeople_ID = 669771571337887765
enso_modmail_ID = 728083016290926623 enso_modmail_ID = 728083016290926623
# Returns a list of all the cogs
def extensions(): def extensions():
"""Returns a list of all the cogs"""
ext = ['cogs.interactive', 'cogs.anime', 'cogs.relationship', ext = ['cogs.interactive', 'cogs.anime', 'cogs.relationship',
'cogs.info', 'cogs.fun', 'cogs.enso', 'cogs.info', 'cogs.fun', 'cogs.enso',
'cogs.guild', 'cogs.moderation'] 'cogs.guild', 'cogs.moderation']
@ -210,6 +224,7 @@ def extensions():
async def storeRoles(pool, target, ctx, member): async def storeRoles(pool, target, ctx, member):
"""Storing User Roles within Database""" """Storing User Roles within Database"""
role_ids = ", ".join([str(r.id) for r in target.roles]) role_ids = ", ".join([str(r.id) for r in target.roles])
# Setup up pool connection and cursor # Setup up pool connection and cursor

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save