import discord from discord.ext import commands from hrochobot.utils.ksp_utils import * class Ksp(commands.Cog): def __init__(self, bot): self.bot = bot @discord.slash_command(description="Generates urls for given task.") async def task(self, ctx, task_code: str): 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 ) @discord.slash_command(description="Shows deadlines of currently running series.") async def deadlines(self, ctx): a_deadlines = active_deadlines() if len(a_deadlines) == 0: return await ctx.respond("No running series.", ephemeral=True) msg = "" for series_id, deadline in a_deadlines: msg += f"Sérii **{series_id}** odevzdávejte do " + \ deadline.strftime('%-d. %-m. %Y %-H:%M') + '\n' return await ctx.respond(msg, ephemeral=True) def setup(bot): bot.add_cog(Ksp(bot))