Daniel Skýpala
2 years ago
3 changed files with 24 additions and 0 deletions
@ -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)) |
@ -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…
Reference in new issue