diff --git a/src/commands_manager/commands_manager.py b/src/commands_manager/commands_manager.py index 4bd69b5..17d5c4d 100644 --- a/src/commands_manager/commands_manager.py +++ b/src/commands_manager/commands_manager.py @@ -1,5 +1,5 @@ import discord -from bot.bot import Bot +from bot import Bot # Import specifics commands from todos_manager.todos_commands import * diff --git a/src/todos_manager/todos_commands.py b/src/todos_manager/todos_commands.py index abcb0a7..046a68e 100644 --- a/src/todos_manager/todos_commands.py +++ b/src/todos_manager/todos_commands.py @@ -1,4 +1,5 @@ import discord +from discord.ext import commands from bot import Bot # Manager controlled by @@ -7,6 +8,15 @@ from todos_manager import * def setup_todos_manager_commands(bot: Bot): @bot.client.tree.command(name="create_todo", description="Create a new todo list") async def create_todo(interaction: discord.Interaction, todo_list_name: str): - bot.todos_manager.create_todo(interaction.user.id.__str__(), todo_list_name) + result = bot.todos_manager.create_todo(interaction.user.id.__str__(), todo_list_name) + if result: + await interaction.response.send_message(f"Todo list \"{todo_list_name}\" already exists") await interaction.response.send_message(f"Todo list \"{todo_list_name}\" successfully created !") + print(result) + @bot.client.tree.command(name="remove_todo", description="Remove an existing todo list") + async def remove_todo(interaction: discord.Interaction, todo_list_name: str): + result = bot.todos_manager.remove_todo(interaction.user.id.__str__(), todo_list_name) + if result: + await interaction.response.send_message(f"Todo list \"{todo_list_name}\" doesn't exists") + await interaction.response.send_message(f"Todo list \"{todo_list_name}\" successfully removed !")