|
|
@ -17,6 +17,8 @@
|
|
|
|
import datetime
|
|
|
|
import datetime
|
|
|
|
import random
|
|
|
|
import random
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import aiohttp
|
|
|
|
|
|
|
|
from decouple import config
|
|
|
|
from discord import Embed, Member
|
|
|
|
from discord import Embed, Member
|
|
|
|
from discord.ext.commands import cooldown, command, BucketType, bot_has_permissions, Cog
|
|
|
|
from discord.ext.commands import cooldown, command, BucketType, bot_has_permissions, Cog
|
|
|
|
|
|
|
|
|
|
|
@ -43,8 +45,6 @@ class Interactive(Cog):
|
|
|
|
"""Printing out that Cog is ready on startup"""
|
|
|
|
"""Printing out that Cog is ready on startup"""
|
|
|
|
print(f"{self.__class__.__name__} Cog has been loaded\n-----")
|
|
|
|
print(f"{self.__class__.__name__} Cog has been loaded\n-----")
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: MAKE EVERYTHING IN HERE ASYNCHRONOUS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@command(name="kiss")
|
|
|
|
@command(name="kiss")
|
|
|
|
@bot_has_permissions(embed_links=True)
|
|
|
|
@bot_has_permissions(embed_links=True)
|
|
|
|
@cooldown(1, 3, BucketType.user)
|
|
|
|
@cooldown(1, 3, BucketType.user)
|
|
|
@ -74,28 +74,34 @@ class Interactive(Cog):
|
|
|
|
await self.bot.generate_embed(ctx, desc="Σ(‘◉⌓◉’) You can only kiss your partner! Baka!")
|
|
|
|
await self.bot.generate_embed(ctx, desc="Σ(‘◉⌓◉’) You can only kiss your partner! Baka!")
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
# Set details for search
|
|
|
|
# Open the file containing the kissing gifs
|
|
|
|
apikey = config("TENOR_AUTH") # test value
|
|
|
|
with open('images/FunCommands/kissing.txt') as file:
|
|
|
|
search_term = "anime-kiss"
|
|
|
|
# Store content of the file in kissing_array
|
|
|
|
url = f"https://api.tenor.com/v1/random?q={search_term}&key={apikey}&limit=1"
|
|
|
|
kissing_array = file.readlines()
|
|
|
|
|
|
|
|
|
|
|
|
# get random results using default locale of EN_US
|
|
|
|
# Get the member and the userAvatar
|
|
|
|
# Searching API for the current airing shows
|
|
|
|
member, userAvatar = getMember(ctx)
|
|
|
|
async with aiohttp.ClientSession() as session:
|
|
|
|
|
|
|
|
async with session.get(url) as resp:
|
|
|
|
# Set up the embed to display a random kissing gif
|
|
|
|
if resp.status == 200:
|
|
|
|
embed = Embed(
|
|
|
|
gifs = await resp.json()
|
|
|
|
title=title,
|
|
|
|
url = gifs["results"][0]["media"][0]["gif"]["url"]
|
|
|
|
colour=self.bot.random_colour(),
|
|
|
|
else:
|
|
|
|
timestamp=datetime.datetime.utcnow())
|
|
|
|
self.bot.generate_embed(ctx, desc="**Something Went Wrong With Tenor!**")
|
|
|
|
embed.set_image(url=random.choice(kissing_array))
|
|
|
|
|
|
|
|
embed.set_footer(text=f"Requested by {member}", icon_url=userAvatar)
|
|
|
|
# Get the member and the userAvatar
|
|
|
|
|
|
|
|
member, userAvatar = getMember(ctx)
|
|
|
|
# Send the embedded message to the user
|
|
|
|
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
# Set up the embed to display a random kissing gif
|
|
|
|
|
|
|
|
embed = Embed(
|
|
|
|
except FileNotFoundError as e:
|
|
|
|
title=title,
|
|
|
|
print(e)
|
|
|
|
colour=self.bot.random_colour(),
|
|
|
|
|
|
|
|
timestamp=datetime.datetime.utcnow())
|
|
|
|
|
|
|
|
embed.set_image(url=url)
|
|
|
|
|
|
|
|
embed.set_footer(text=f"Requested by {member}", icon_url=userAvatar)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Send the embedded message to the user
|
|
|
|
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
|
|
@command(name="cuddle")
|
|
|
|
@command(name="cuddle")
|
|
|
|
@bot_has_permissions(embed_links=True)
|
|
|
|
@bot_has_permissions(embed_links=True)
|
|
|
|