diff --git a/commands/core/todo.js b/commands/core/todo.js index d93d696..566d91d 100644 --- a/commands/core/todo.js +++ b/commands/core/todo.js @@ -23,7 +23,7 @@ module.exports = { remainingTodos.forEach(async reminder => { const delay = reminder.time - currentTime; if (delay < 0) { - setTimeout(() => { + setTimeout(async () => { const discordChannel = client.channels.resolve(reminder.channel); discordChannel.send( `La SNCF vous présente ses excuses pour le retard <@${reminder.author}> ! tu m'as demandé de te rappeler\n---------------------\n${reminder.message}` @@ -31,7 +31,7 @@ module.exports = { await TodoUtils.deleteOne(reminder.uuid); }, 1000); } else { - setTimeout(() => { + setTimeout(async () => { const discordChannel = client.channels.resolve(reminder.channel); discordChannel.send( `<@${reminder.author}>, tu m'as demandé de te rappeler\n---------------------\n${reminder.message}` @@ -58,7 +58,7 @@ module.exports = { }); await reminder.save(); - setTimeout(function () { + setTimeout(async function () { const discordChannel = client.channels.resolve(salon); discordChannel.send( `<@${message.author.id}>, tu m'as demandé de te rappeler\n---------------------\n${reason}` diff --git a/commands/core/todoMP.js b/commands/core/todoMP.js index b940b48..a68e73f 100644 --- a/commands/core/todoMP.js +++ b/commands/core/todoMP.js @@ -1,97 +1,80 @@ const ms = require("ms"); -const fs = require("fs"); -const path = require("path"); const uuid = require("uuid").v4; +const mongoose = require("mongoose"); -const dbFileName = path.resolve(".", "utils", "todoMP.json"); -let database = []; +const todoSchema = new mongoose.Schema({ + uuid: String, + author: String, + time: String, + user: String, + message: String, +}); +const TodoMP = mongoose.model("TodoMP", todoSchema); module.exports = { name: "todoMP", - aliases: ["todoMP"], - utilisation: "{prefix}todo