From 7f3b4129533bbb7fe1b93dddc79d7a27b1050a7b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 22 Aug 2021 16:46:49 +0200 Subject: [PATCH] create table in own cog --- src/cogs/reminder.py | 1 + src/cogs/todo.py | 3 +++ src/main.py | 4 ---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cogs/reminder.py b/src/cogs/reminder.py index cac8d57..41e0818 100644 --- a/src/cogs/reminder.py +++ b/src/cogs/reminder.py @@ -15,6 +15,7 @@ class ReminderDiscord(commands.Cog, name="Reminder"): def __init__(self, client): self.client = client self._reminderLoop.start() + Reminder().creationTable() @tasks.loop(minutes = 1) async def _reminderLoop(self): diff --git a/src/cogs/todo.py b/src/cogs/todo.py index 8f67603..1d89d66 100644 --- a/src/cogs/todo.py +++ b/src/cogs/todo.py @@ -13,6 +13,7 @@ class ToDoDiscord(commands.Cog, name="ToDo"): """Commandes relatives aux To Do.""" def __init__(self, client): self.client = client + ToDo().creationTable() @commands.command(name='todo') async def _todo(self, ctx, *todo): @@ -28,6 +29,8 @@ class ToDoDiscord(commands.Cog, name="ToDo"): else: now = int(nowUTC()) messageID = None + if len(todo) > 1024: + return await mySendHidden(ctx, fromSlash, "Message trop long (maximum de 1024 caractères).") if fromSlash != True: messageID = ctx.message.id todoID = ToDo().ajout(messageID, todo, now, ctx.author.id) diff --git a/src/main.py b/src/main.py index 584dd24..8543f9a 100644 --- a/src/main.py +++ b/src/main.py @@ -4,8 +4,6 @@ import discord from os import listdir, rename, getcwd from discord_slash import SlashCommand from discord.ext import commands -from utils.reminder import Reminder -from utils.todo import ToDo from utils.core import load, addReaction from utils.page import listReaction keys = load(["PREFIX", "TOKEN_DISCORD", "DEACTIVATE"]) @@ -49,8 +47,6 @@ async def on_resumed(): async def on_ready(): """Triggered when the bot is ready to operate""" await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = f"{customPrefix}help", type = discord.ActivityType.playing)) - Reminder().creationTable() - ToDo().creationTable() print("Bot prêt.") @client.event