23 lines
1.1 KiB
Python
23 lines
1.1 KiB
Python
import discord
|
|
from discord.ext import commands
|
|
from bot import Bot
|
|
|
|
# Manager controlled by
|
|
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):
|
|
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 !")
|