2022-01-13 00:56:24 +05:00
|
|
|
const Command = require("../../base/Command"),
|
2022-01-04 02:18:28 +05:00
|
|
|
ms = require("ms");
|
|
|
|
|
|
|
|
class Remindme extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "remindme",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: false,
|
|
|
|
aliases: ["reminder", "remind", "rem"],
|
|
|
|
memberPermissions: [],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 1000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run(message, args, data) {
|
|
|
|
const time = args[0];
|
|
|
|
if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME");
|
|
|
|
|
|
|
|
const msg = args.slice(1).join(" ");
|
|
|
|
if (!msg) return message.error("general/remindme:MISSING_MESSAGE");
|
|
|
|
|
|
|
|
const rData = {
|
|
|
|
message: msg,
|
|
|
|
createdAt: Date.now(),
|
|
|
|
sendAt: Date.now() + ms(time)
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!data.userData.reminds) data.userData.reminds = [];
|
|
|
|
|
|
|
|
|
|
|
|
data.userData.reminds.push(rData);
|
|
|
|
data.userData.markModified("reminds");
|
|
|
|
data.userData.save();
|
|
|
|
this.client.databaseCache.usersReminds.set(message.author.id, data.userData);
|
|
|
|
|
|
|
|
message.success("general/remindme:SAVED");
|
|
|
|
}
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
module.exports = Remindme;
|