force value instead of making them as default

This commit is contained in:
Mylloon 2021-07-29 01:52:21 +02:00
parent cdbdefb9fc
commit 56be762445

View file

@ -21,7 +21,7 @@ class Reminder(Database):
""" """
self.requete(requete) self.requete(requete)
def ajoutReminder(self, messageID = int, channelID = int, extrarg = int, reminder = str, creation = int, expiration = int, userID = int, guildID = int): def ajoutReminder(self, messageID: int, channelID: int, extrarg: int, reminder: str, creation: int, expiration: int, userID: int, guildID: int):
"""Ajoute un reminder.""" """Ajoute un reminder."""
requete = """ requete = """
INSERT INTO reminder ( INSERT INTO reminder (
@ -33,7 +33,7 @@ class Reminder(Database):
self.requete(requete, [messageID, channelID, extrarg, reminder, creation, expiration, userID, guildID]) self.requete(requete, [messageID, channelID, extrarg, reminder, creation, expiration, userID, guildID])
return self.affichageResultat(self.requete("SELECT last_insert_rowid();")) return self.affichageResultat(self.requete("SELECT last_insert_rowid();"))
def suppressionReminder(self, id = int): def suppressionReminder(self, id: int):
"""Supprime un reminder.""" """Supprime un reminder."""
requete = """ requete = """
DELETE FROM reminder DELETE FROM reminder
@ -41,7 +41,7 @@ class Reminder(Database):
""" """
self.requete(requete, id) self.requete(requete, id)
def listeReminder(self, userID = int, guildID = int): def listeReminder(self, userID: int, guildID: int):
"""Retourne la liste des reminders d'un utilisateur.""" """Retourne la liste des reminders d'un utilisateur."""
requete = """ requete = """
SELECT reminder_str, creation_int, expiration_int, id FROM reminder SELECT reminder_str, creation_int, expiration_int, id FROM reminder
@ -49,7 +49,7 @@ class Reminder(Database):
""" """
return self.affichageResultat(self.requete(requete, [userID, guildID])) return self.affichageResultat(self.requete(requete, [userID, guildID]))
def recuperationExpiration(self, time = int): def recuperationExpiration(self, time: int):
"""Récupère les reminders qui sont arrivés à expiration et ses infos.""" """Récupère les reminders qui sont arrivés à expiration et ses infos."""
requete = """ requete = """
SELECT channel_id, extrarg_id, reminder_str, creation_int, user_id, id, message_id FROM reminder SELECT channel_id, extrarg_id, reminder_str, creation_int, user_id, id, message_id FROM reminder
@ -57,7 +57,7 @@ class Reminder(Database):
""" """
return self.affichageResultat(self.requete(requete, time)) return self.affichageResultat(self.requete(requete, time))
def appartenanceReminder(self, user = int, id = int, guildID = int): def appartenanceReminder(self, userID: int, id: int, guildID: int):
"""Vérifie qu'un rappel appartiens à un utilisateur et que la guilde soit la bonne. Renvois False si le rappel n'existe pas.""" """Vérifie qu'un rappel appartiens à un utilisateur et que la guilde soit la bonne. Renvois False si le rappel n'existe pas."""
requete = """ requete = """
SELECT EXISTS ( SELECT EXISTS (
@ -65,4 +65,4 @@ class Reminder(Database):
WHERE id = ? AND user_id = ? AND (guild_id = ? OR guild_id = 0) WHERE id = ? AND user_id = ? AND (guild_id = ? OR guild_id = 0)
) )
""" """
return True if self.affichageResultat(self.requete(requete, [id, user, guildID]))[0][0] == 1 else False return True if self.affichageResultat(self.requete(requete, [id, userID, guildID]))[0][0] == 1 else False