create table in own cog

This commit is contained in:
Mylloon 2021-08-22 16:46:49 +02:00
parent 76962e6936
commit 7f3b412953
3 changed files with 4 additions and 4 deletions

View file

@ -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):

View file

@ -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)

View file

@ -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