29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
import discord
|
|
from discord import app_commands
|
|
from .database import add_project, add_task
|
|
|
|
class ProjectCommands(app_commands.Group):
|
|
def __init__(self):
|
|
super().__init__(name="project", description="Manage projects.")
|
|
|
|
@app_commands.command(name="create", description="Create a new project.")
|
|
async def create_project(self, interaction: discord.Interaction, name: str, description: str):
|
|
await add_project(name, description)
|
|
await interaction.response.send_message(f"Project '{name}' created successfully.")
|
|
|
|
class TaskCommands(app_commands.Group):
|
|
def __init__(self):
|
|
super().__init__(name="task", description="Manage tasks.")
|
|
|
|
@app_commands.command(name="add", description="Add a new task to a project.")
|
|
async def add_task(self, interaction: discord.Interaction, project_name: str, description: str, assignee: str, deadline: str, status: str, priority: str):
|
|
await add_task(project_name, description, assignee, deadline, status, priority)
|
|
await interaction.response.send_message(f"Task '{description}' added to project '{project_name}'.")
|
|
|
|
class DollyTracker(app_commands.Group, name="dolly", description="Dolly the Project Tracker."):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.add_command(ProjectCommands())
|
|
self.add_command(TaskCommands())
|
|
|