ajout des récupérations des informations de la db

This commit is contained in:
Mylloon 2021-06-03 14:24:36 +02:00
parent 81f865b102
commit e6c6456803

View file

@ -6,7 +6,7 @@ class Reminder(Database):
requete = """ requete = """
CREATE TABLE IF NOT EXISTS reminder ( CREATE TABLE IF NOT EXISTS reminder (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
guild_id INTEGER, message_id INTEGER,
channel_id INTEGER, channel_id INTEGER,
mention_bool INTEGER, mention_bool INTEGER,
reminder_str TEXT, reminder_str TEXT,
@ -17,16 +17,16 @@ class Reminder(Database):
""" """
self.requete(requete) self.requete(requete)
def ajoutReminder(self, guildID, channelID, mention, reminder, creation, expiration, userID): def ajoutReminder(self, messageID, channelID, mention, reminder, creation, expiration, userID):
"""Ajoute un reminder""" """Ajoute un reminder"""
requete = """ requete = """
INSERT INTO reminder ( INSERT INTO reminder (
guild_id, channel_id, mention_bool, reminder_str, creation_int, expiration_int, user_id message_id, channel_id, mention_bool, reminder_str, creation_int, expiration_int, user_id
) VALUES ( ) VALUES (
?, ?, ?, ?, ?, ?, ? ?, ?, ?, ?, ?, ?, ?
); );
""" """
self.requete(requete, (guildID, channelID, mention, reminder, creation, expiration, userID)) self.requete(requete, (messageID, channelID, mention, reminder, creation, expiration, userID))
def suppressionReminder(self, id): def suppressionReminder(self, id):
"""Supprime un reminder""" """Supprime un reminder"""
@ -34,12 +34,16 @@ class Reminder(Database):
DELETE FROM reminder DELETE FROM reminder
WHERE id = ? WHERE id = ?
""" """
self.requete(requete, id) self.requete(requete, [id])
def listeReminder(self, userID = None): def listeReminder(self, userID = None):
"""Retourne la liste des reminders, si un userID est mentionné, retourne la liste de cet utilisateur""" """Retourne la liste des reminders, si un userID est mentionné, retourne la liste de cet utilisateur"""
return return
def recuperationReminder(self, id): def recuperationExpiration(self, time):
"""Récupère les informations d'un reminder""" """Récupère les reminders qui sont arrivés à expiration et ses infos"""
return requete = """
SELECT channel_id, mention_bool, reminder_str, creation_int, user_id, id, message_id FROM reminder
WHERE expiration_int < ?
"""
return self.affichageResultat(self.requete(requete, [time]))