Fixed all of the whoops
This commit is contained in:
@ -1,15 +1,16 @@
|
|||||||
|
# bot/commands.py
|
||||||
import discord
|
import discord
|
||||||
from discord import app_commands
|
from discord import app_commands
|
||||||
from .database import add_project, add_task
|
from .database import add_project, add_task
|
||||||
|
|
||||||
class DollyProjectTrackerCommands(app_commands.Group):
|
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):
|
async def create_project(self, interaction: discord.Interaction, name: str, description: str):
|
||||||
await add_project(name, description)
|
await add_project(name, description)
|
||||||
await interaction.response.send_message(f"Project `{name}` created successfully.")
|
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):
|
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 add_task(project_name, description, assignee, deadline, status, priority)
|
||||||
await interaction.response.send_message(f"Task `{description}` added to project `{project_name}` successfully.")
|
await interaction.response.send_message(f"Task `{description}` added to project `{project_name}` successfully.")
|
||||||
|
@ -7,9 +7,10 @@ class Dolly(discord.Client):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(intents=discord.Intents.default())
|
super().__init__(intents=discord.Intents.default())
|
||||||
self.tree = app_commands.CommandTree(self)
|
self.tree = app_commands.CommandTree(self)
|
||||||
self.tree.add_command(DollyProjectTrackerCommands())
|
|
||||||
|
|
||||||
async def setup_hook(self):
|
async def setup_hook(self):
|
||||||
|
# Register the commands via a group to the command tree
|
||||||
|
self.tree.add_command(DollyProjectTrackerCommands())
|
||||||
await self.tree.sync()
|
await self.tree.sync()
|
||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
|
2
main.py
2
main.py
@ -2,8 +2,10 @@ from dolly.dolly import Dolly
|
|||||||
from dolly.database import setup_db
|
from dolly.database import setup_db
|
||||||
import asyncio
|
import asyncio
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
import os
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
TOKEN = os.getenv('DISCORD_BOT_TOKEN')
|
TOKEN = os.getenv('DISCORD_BOT_TOKEN')
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user