Bot pro KSP Discord
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 lines
1.1 KiB

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))