From efad3e79dcb26350cc399b44f88c17a4716262c3 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 3 May 2024 22:45:59 -0400 Subject: [PATCH] Fixed all of the whoops --- dolly/commands.py | 5 +++-- dolly/dolly.py | 5 +++-- main.py | 2 ++ requirements.txt | Bin 380 -> 222 bytes 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dolly/commands.py b/dolly/commands.py index 1500340..b0ae6e0 100644 --- a/dolly/commands.py +++ b/dolly/commands.py @@ -1,15 +1,16 @@ +# bot/commands.py import discord from discord import app_commands from .database import add_project, add_task class DollyProjectTrackerCommands(app_commands.Group): - @tree.command(name="create-project", description="Create a new project in the database.") + @app_commands.command(name="create-project", description="Create a new project in the database.") 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.") - @tree.command(name="add-task", description="Add a new task to a project in the database.") + @app_commands.command(name="add-task", description="Add a new task to a project in the database.") 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.") diff --git a/dolly/dolly.py b/dolly/dolly.py index 92cb4e5..995cff6 100644 --- a/dolly/dolly.py +++ b/dolly/dolly.py @@ -7,10 +7,11 @@ class Dolly(discord.Client): def __init__(self): super().__init__(intents=discord.Intents.default()) self.tree = app_commands.CommandTree(self) - self.tree.add_command(DollyProjectTrackerCommands()) async def setup_hook(self): + # Register the commands via a group to the command tree + self.tree.add_command(DollyProjectTrackerCommands()) await self.tree.sync() - + async def on_ready(self): print(f"Logged in as {self.user} (ID: {self.user.id})\n------") \ No newline at end of file diff --git a/main.py b/main.py index 634b76e..a87eba0 100644 --- a/main.py +++ b/main.py @@ -2,8 +2,10 @@ from dolly.dolly import Dolly from dolly.database import setup_db import asyncio from dotenv import load_dotenv +import os load_dotenv() + TOKEN = os.getenv('DISCORD_BOT_TOKEN') async def main(): diff --git a/requirements.txt b/requirements.txt index 36709eb0fa3540791d7290013d8c0c2fd7c5d4b7..e601fc8b8b21ea4c6a970b73213880621f421eb1 100644 GIT binary patch literal 222 zcmXwzOAf;z3`FXvmg!{QH!Utrqk=KjNv*V*Gsvd=@U3o zQ9uuq_K;`SM$G1TMj=nDzGh`lCRf=LcRoqrSM#?OQZw;(3vU$*CDwAqwDRiC-}*(P EU*>{Wet_Ak-)yz37^dQT^E;DB?=leOKMZg^s&jUxE zJ#rj)3v980<(ww#)S)tt fTqo`R