mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Inspire slash command, defer jpl table
This commit is contained in:
parent
9eb0eb5a61
commit
eaed08168c
5 changed files with 27 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
23
cogs/slash/other_slash.py
Normal 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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue