2020-01-08 02:26:36 +01:00
|
|
|
'''
|
|
|
|
This is the cog that allows users to
|
|
|
|
fetch an AI-generated inspirational quote
|
|
|
|
made by Inspirobot
|
|
|
|
'''
|
2020-01-07 04:07:39 +01:00
|
|
|
import discord
|
|
|
|
|
|
|
|
from discord.ext import commands
|
|
|
|
from api import inspirobot
|
2020-01-08 02:08:07 +01:00
|
|
|
from util import config
|
2020-01-07 04:07:39 +01:00
|
|
|
|
|
|
|
class Inspirobot(commands.Cog):
|
|
|
|
|
2020-01-08 02:26:36 +01:00
|
|
|
def __init__(self, client : discord.Client):
|
2020-01-07 04:07:39 +01:00
|
|
|
self.client = client
|
|
|
|
|
2020-01-11 21:43:38 +01:00
|
|
|
@commands.command(name="inspirobot", description="Sends a randomly generated inspirational quote", usage="inspirobot", aliases=["inspiration", "inspiro", "insp"])
|
2020-01-07 04:07:39 +01:00
|
|
|
@commands.cooldown(1, 5)
|
2020-01-08 02:26:36 +01:00
|
|
|
async def inspirobot(self, ctx : commands.Context):
|
2020-01-07 04:07:39 +01:00
|
|
|
image = inspirobot.get_inspirational_quote()
|
|
|
|
if image is None:
|
|
|
|
await ctx.message.add_reaction("⚠️")
|
|
|
|
else:
|
2020-01-08 02:08:07 +01:00
|
|
|
embed = discord.Embed(title="InspiroBot", color=int(config.settings["color"], 16))
|
2020-01-07 04:07:39 +01:00
|
|
|
embed.set_image(url=image)
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
|
2020-03-24 16:23:22 +01:00
|
|
|
@commands.command(name="test", dscription="Who cares tbh")
|
|
|
|
@commands.cooldown(1, 3)
|
|
|
|
async def test(self, ctx):
|
|
|
|
await self.client.get_channel(621378664977793024).send("Test")
|
|
|
|
await ctx.send(self.client.name)
|
|
|
|
|
2020-01-08 02:26:36 +01:00
|
|
|
def setup(client : discord.Client):
|
2020-01-11 21:43:38 +01:00
|
|
|
client.add_cog(Inspirobot(client))
|