right import + good name of columns in table + commentary + 2 methods

This commit is contained in:
Mylloon 2021-06-03 12:23:32 +02:00
parent 99765c7b9e
commit c296bb35a9

View file

@ -1,7 +1,8 @@
from db import Database
from utils.db import Database
class Reminder(Database):
def creationTable(self):
"""Créer la table qui stocker les reminders"""
requete = """
CREATE TABLE IF NOT EXISTS reminder (
id INTEGER PRIMARY KEY,
@ -9,7 +10,7 @@ class Reminder(Database):
channel_id INTEGER,
mention_bool INTEGER,
reminder_str TEXT,
creation_str INTEGER,
creation_int INTEGER,
expiration_int INTEGER,
user_id INTEGER
);
@ -17,9 +18,10 @@ class Reminder(Database):
self.requete(requete)
def ajoutReminder(self, guildID, channelID, mention, reminder, creation, expiration, userID):
"""Ajoute un reminder"""
requete = """
INSERT INTO reminder (
guild_id, channel_id, mention_bool, reminder_str, creation_str, expiration_int, user_id
guild_id, channel_id, mention_bool, reminder_str, creation_int, expiration_int, user_id
) VALUES (
?, ?, ?, ?, ?, ?, ?
);
@ -27,8 +29,17 @@ class Reminder(Database):
self.requete(requete, (guildID, channelID, mention, reminder, creation, expiration, userID))
def suppressionReminder(self, id):
"""Supprime un reminder"""
requete = """
DELETE FROM reminder
WHERE id = ?
"""
self.requete(requete, id)
def listeReminder(self, userID = None):
"""Retourne la liste des reminders, si un userID est mentionné, retourne la liste de cet utilisateur"""
return
def recuperationReminder(self, id):
"""Récupère les informations d'un reminder"""
return