add guildID
This commit is contained in:
parent
2af04ba300
commit
4d4574ae0d
2 changed files with 13 additions and 12 deletions
|
@ -509,7 +509,7 @@ class Utils(commands.Cog):
|
||||||
messageID = None
|
messageID = None
|
||||||
if fromSlash != True:
|
if fromSlash != True:
|
||||||
messageID = ctx.message.id
|
messageID = ctx.message.id
|
||||||
Reminder().ajoutReminder(messageID, ctx.channel.id, mention, reminder, now, now + seconds, ctx.author.id)
|
Reminder().ajoutReminder(messageID, ctx.channel.id, mention, reminder, now, now + seconds, ctx.author.id, ctx.guild.id)
|
||||||
return await ctx.send(f"Ok, je t'en parles dans {timedeltaToString(seconds)} avec 1m de retard maximum.")
|
return await ctx.send(f"Ok, je t'en parles dans {timedeltaToString(seconds)} avec 1m de retard maximum.")
|
||||||
await ctx.send(embed = embed)
|
await ctx.send(embed = embed)
|
||||||
@_reminder.error
|
@_reminder.error
|
||||||
|
@ -566,7 +566,7 @@ class Utils(commands.Cog):
|
||||||
else:
|
else:
|
||||||
utilisateur = ctx.author.id
|
utilisateur = ctx.author.id
|
||||||
|
|
||||||
reminders = Reminder().listeReminder(utilisateur)
|
reminders = Reminder().listeReminder(utilisateur, ctx.guild.id)
|
||||||
if fromSlash != True:
|
if fromSlash != True:
|
||||||
await ctx.message.add_reaction(emoji = '✅')
|
await ctx.message.add_reaction(emoji = '✅')
|
||||||
embed = discord.Embed(description = f"**Rappel{'s' if len(reminders) > 1 else ''} de <@{utilisateur}>**", color = discord.Colour.random())
|
embed = discord.Embed(description = f"**Rappel{'s' if len(reminders) > 1 else ''} de <@{utilisateur}>**", color = discord.Colour.random())
|
||||||
|
|
|
@ -15,21 +15,22 @@ class Reminder(Database):
|
||||||
reminder_str TEXT,
|
reminder_str TEXT,
|
||||||
creation_int INTEGER,
|
creation_int INTEGER,
|
||||||
expiration_int INTEGER,
|
expiration_int INTEGER,
|
||||||
user_id INTEGER
|
user_id INTEGER,
|
||||||
|
guild_id INTEGER
|
||||||
);
|
);
|
||||||
"""
|
"""
|
||||||
self.requete(requete)
|
self.requete(requete)
|
||||||
|
|
||||||
def ajoutReminder(self, messageID = int, channelID = int, mention = int, reminder = str, creation = int, expiration = int, userID = int):
|
def ajoutReminder(self, messageID = int, channelID = int, mention = 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 (
|
||||||
message_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, guild_id
|
||||||
) VALUES (
|
) VALUES (
|
||||||
?, ?, ?, ?, ?, ?, ?
|
?, ?, ?, ?, ?, ?, ?, ?
|
||||||
);
|
);
|
||||||
"""
|
"""
|
||||||
self.requete(requete, (messageID, channelID, mention, reminder, creation, expiration, userID))
|
self.requete(requete, [messageID, channelID, mention, reminder, creation, expiration, userID, guildID])
|
||||||
|
|
||||||
def suppressionReminder(self, id = int):
|
def suppressionReminder(self, id = int):
|
||||||
"""Supprime un reminder"""
|
"""Supprime un reminder"""
|
||||||
|
@ -37,15 +38,15 @@ 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 = 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 FROM reminder
|
SELECT reminder_str, creation_int, expiration_int FROM reminder
|
||||||
WHERE user_id = ?
|
WHERE user_id = ? AND guild_id = ?
|
||||||
"""
|
"""
|
||||||
return self.affichageResultat(self.requete(requete, [userID]))
|
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"""
|
||||||
|
@ -53,4 +54,4 @@ class Reminder(Database):
|
||||||
SELECT channel_id, mention_bool, reminder_str, creation_int, user_id, id, message_id FROM reminder
|
SELECT channel_id, mention_bool, reminder_str, creation_int, user_id, id, message_id FROM reminder
|
||||||
WHERE expiration_int < ?
|
WHERE expiration_int < ?
|
||||||
"""
|
"""
|
||||||
return self.affichageResultat(self.requete(requete, [time]))
|
return self.affichageResultat(self.requete(requete, time))
|
||||||
|
|
Reference in a new issue