From e6c6456803ffbedf8173ed37748f2e51b532ac86 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 3 Jun 2021 14:24:36 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20des=20r=C3=A9cup=C3=A9rations=20des=20i?= =?UTF-8?q?nformations=20de=20la=20db?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/reminder.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/utils/reminder.py b/src/utils/reminder.py index 4e4bfd2..8cdc18d 100644 --- a/src/utils/reminder.py +++ b/src/utils/reminder.py @@ -6,7 +6,7 @@ class Reminder(Database): requete = """ CREATE TABLE IF NOT EXISTS reminder ( id INTEGER PRIMARY KEY, - guild_id INTEGER, + message_id INTEGER, channel_id INTEGER, mention_bool INTEGER, reminder_str TEXT, @@ -17,16 +17,16 @@ class Reminder(Database): """ 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""" requete = """ 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 ( ?, ?, ?, ?, ?, ?, ? ); """ - self.requete(requete, (guildID, channelID, mention, reminder, creation, expiration, userID)) + self.requete(requete, (messageID, channelID, mention, reminder, creation, expiration, userID)) def suppressionReminder(self, id): """Supprime un reminder""" @@ -34,12 +34,16 @@ class Reminder(Database): DELETE FROM reminder WHERE id = ? """ - self.requete(requete, 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 + def recuperationExpiration(self, time): + """Récupère les reminders qui sont arrivés à expiration et ses infos""" + 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]))