Inspire slash command, defer jpl table

This commit is contained in:
Stijn De Clercq 2022-02-05 14:33:11 +01:00
parent 9eb0eb5a61
commit eaed08168c
5 changed files with 27 additions and 2 deletions

View file

@ -151,7 +151,7 @@ class Oneliners(commands.Cog):
@commands.command(name="Inspire")
@help.Category(Category.Other)
async def inspire(self, ctx):
image = get("http://inspirobot.me/api?generate=true")
image = get("https://inspirobot.me/api?generate=true")
if image.status_code == 200:
await ctx.send(image.text)

View file

@ -23,6 +23,7 @@ class FootballSlash(commands.Cog):
@_jpl_group.command(name="table", description="Huidige rangschikking")
async def _jpl_table_slash(self, ctx: ApplicationContext):
await ctx.response.defer()
await ctx.respond(get_table())
@_jpl_group.command(name="update", description="Update de code voor deze competitie (owner-only)", default_permission=False)

23
cogs/slash/other_slash.py Normal file
View file

@ -0,0 +1,23 @@
from discord.ext import commands
from discord.commands import slash_command, ApplicationContext
from requests import get
from startup.didier import Didier
class OtherSlash(commands.Cog):
def __init__(self, client: Didier):
self.client: Didier = client
@slash_command(name="inspire", description="Genereer quotes via Inspirobot.")
async def _inspire_slash(self, ctx: ApplicationContext):
image = get("https://inspirobot.me/api?generate=true")
if image.status_code == 200:
await ctx.respond(image.text)
else:
await ctx.respond("Uh oh API down.")
def setup(client: Didier):
client.add_cog(OtherSlash(client))