Fixed up the code. Now just need to fix the add_task command
This commit is contained in:
@@ -1,16 +1,28 @@
|
||||
# bot/commands.py
|
||||
import discord
|
||||
from discord import app_commands
|
||||
from .database import add_project, add_task
|
||||
|
||||
class DollyProjectTrackerCommands(app_commands.Group, name="Dolly", description="Commands for Dolly's project tracker."):
|
||||
|
||||
@app_commands.command(name="create-project", description="Create a new project in the database.")
|
||||
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.")
|
||||
|
||||
@app_commands.command(name="add-task", description="Add a new task to a project in the database.")
|
||||
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}` successfully.")
|
||||
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())
|
||||
|
||||
|
Reference in New Issue
Block a user