Browse Source

Added ksp commands

news
Daniel Skýpala 2 years ago
parent
commit
4fd525d912
  1. 19
      cogs/ksp.py
  2. 1
      main.py
  3. 4
      utils/ksp_utils.py

19
cogs/ksp.py

@ -0,0 +1,19 @@
import discord
from discord.ext import commands
from utils.ksp_utils import *
class Ksp(commands.Cog):
def __init__(self, bot):
self.bot = bot
@discord.slash_command()
async def task(self, ctx, task_code):
await ctx.respond(
f'**{task_code}**\n'
f'Task: {task_link(task_code, solution=False)}\n'
f'Solution: {task_link(task_code, solution=True)}',
ephemeral=True
)
def setup(bot):
bot.add_cog(Ksp(bot))

1
main.py

@ -8,6 +8,7 @@ bot = commands.Bot()
cogs_list = [ cogs_list = [
'basic', 'basic',
'roles', 'roles',
'ksp',
] ]
for cog in cogs_list: for cog in cogs_list:

4
utils/ksp_utils.py

@ -0,0 +1,4 @@
KSP_URL = "https://ksp.mff.cuni.cz"
def task_link(task_code: str, solution : bool = False):
return f"{KSP_URL}/viz/{task_code}/{'reseni' if solution else ''}"
Loading…
Cancel
Save