Added a Char Limit to the report function. Updated the tasks to now inlcude choices
This commit is contained in:
@ -24,7 +24,7 @@ class ProjectCommands(app_commands.Group):
|
||||
except Exception as e:
|
||||
await interaction.response.send_message("Whoops! Looks like we hit a snag! Try creating the project again! :)", ephemeral=True)
|
||||
logger.error(f"Error in create_project: {e}")
|
||||
|
||||
|
||||
@app_commands.command(name="list", description="List all projects.")
|
||||
async def list_projects(self, interaction: discord.Interaction):
|
||||
try:
|
||||
@ -48,12 +48,24 @@ class ProjectCommands(app_commands.Group):
|
||||
await interaction.response.send_message(f"Whoops! I failed to remove the project. Error: {e}", ephemeral=True)
|
||||
logger.error(f"Preparation error in remove_project_command for Project ID {project_id}: {e}")
|
||||
|
||||
|
||||
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.")
|
||||
@app_commands.choices(priority=[
|
||||
app_commands.Choice(name="Low", value="Low"),
|
||||
app_commands.Choice(name="Medium", value="Medium"),
|
||||
app_commands.Choice(name="High", value="High")
|
||||
app_commands.Choice(name="Critical", value="Critical")
|
||||
], status=[
|
||||
app_commands.Choice(name="Not Started", value="Not Started"),
|
||||
app_commands.Choice(name="In Progress", value="In Progress"),
|
||||
app_commands.Choice(name="Blocked", value="Blocked"),
|
||||
app_commands.Choice(name="In Testing", value="In Testing"),
|
||||
app_commands.Choice(name="Needs Review", value="Needs Review"),
|
||||
app_commands.Choice(name="Completed", value="Completed")
|
||||
])
|
||||
async def add_task(self, interaction: discord.Interaction, project_name: str, description: str, assignee: str, deadline: str, status: str, priority: str, reminder_time: str = None):
|
||||
try:
|
||||
datetime.strptime(deadline, "%m/%d/%Y") # Validate deadline date format
|
||||
@ -82,6 +94,19 @@ class TaskCommands(app_commands.Group):
|
||||
logger.error(f"Unexpected error in add_task: {e}")
|
||||
|
||||
@app_commands.command(name="update", description="Update an existing task.")
|
||||
@app_commands.choices(priority=[
|
||||
app_commands.Choice(name="Low", value="Low"),
|
||||
app_commands.Choice(name="Medium", value="Medium"),
|
||||
app_commands.Choice(name="High", value="High")
|
||||
app_commands.Choice(name="Critical", value="Critical")
|
||||
], status=[
|
||||
app_commands.Choice(name="Not Started", value="Not Started"),
|
||||
app_commands.Choice(name="In Progress", value="In Progress"),
|
||||
app_commands.Choice(name="Blocked", value="Blocked"),
|
||||
app_commands.Choice(name="In Testing", value="In Testing"),
|
||||
app_commands.Choice(name="Needs Review", value="Needs Review"),
|
||||
app_commands.Choice(name="Completed", value="Completed")
|
||||
])
|
||||
async def update_task_command(self, interaction: discord.Interaction, task_id: int, description: str, assignee: str, deadline: str, status: str, priority: str, reminder_time: str = None):
|
||||
try:
|
||||
datetime.strptime(deadline, "%m/%d/%Y") # Validate deadline date format
|
||||
|
@ -33,10 +33,15 @@ class Nessa(discord.Client):
|
||||
|
||||
@self.tree.command(name="report_issue", description="Send an anonymous issue report.")
|
||||
async def report_issue(interaction: discord.Interaction, message: str):
|
||||
# Check if the message exceeds 1000 characters
|
||||
if len(message) > 1000:
|
||||
await interaction.response.send_message("Wowie, that's a long message there. Chief asked for messages to be no longer than 1000 characters. Please shorten it and try again.", ephemeral=True)
|
||||
return
|
||||
|
||||
# Your Discord user ID
|
||||
your_user_id = OWNER_ID
|
||||
your_user_id = OWNER_ID # Make sure OWNER_ID is defined somewhere in your code
|
||||
# Fetch your user object using your ID
|
||||
owner = await bot.fetch_user(your_user_id)
|
||||
owner = await self.fetch_user(your_user_id)
|
||||
# Send the DM to you
|
||||
await owner.send(f"Hey Chief, I got a report for you: {message}")
|
||||
# Respond to the user to confirm the message has been sent
|
||||
|
Reference in New Issue
Block a user