mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-29 00:24:58 +05:00
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
|
const { SlashCommandBuilder } = require("discord.js");
|
||
|
const BaseCommand = require("../../base/BaseCommand"),
|
||
|
ms = require("ms");
|
||
|
|
||
|
class Remindme extends BaseCommand {
|
||
|
/**
|
||
|
*
|
||
|
* @param {import("../base/JaBa")} client
|
||
|
*/
|
||
|
constructor(client) {
|
||
|
super({
|
||
|
command: new SlashCommandBuilder()
|
||
|
.setName("remindme")
|
||
|
.setDescription(client.translate("general/remindme:DESCRIPTION"))
|
||
|
.addStringOption(option => option.setName("time")
|
||
|
.setDescription(client.translate("owner/remindme:TIME"))
|
||
|
.setRequired(true))
|
||
|
.addStringOption(option => option.setName("message")
|
||
|
.setDescription(client.translate("common:MESSAGE"))
|
||
|
.setRequired(true)),
|
||
|
aliases: [],
|
||
|
dirname: __dirname,
|
||
|
guildOnly: true,
|
||
|
ownerOnly: false
|
||
|
});
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @param {import("../../base/JaBa")} client
|
||
|
*/
|
||
|
async onLoad() {
|
||
|
//...
|
||
|
}
|
||
|
/**
|
||
|
*
|
||
|
* @param {import("../../base/JaBa")} client
|
||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||
|
* @param {Array} data
|
||
|
*/
|
||
|
async execute(client, interaction, data) {
|
||
|
const time = interaction.options.getString("time");
|
||
|
const message = interaction.options.getString("message");
|
||
|
const dateNow = Date.now();
|
||
|
if (!data.userData.reminds) data.userData.reminds = [];
|
||
|
|
||
|
const rData = {
|
||
|
message: message,
|
||
|
createdAt: dateNow,
|
||
|
sendAt: dateNow + ms(time)
|
||
|
};
|
||
|
|
||
|
data.userData.reminds.push(rData);
|
||
|
data.userData.markModified("reminds");
|
||
|
data.userData.save();
|
||
|
client.databaseCache.usersReminds.set(message.author.id, data.userData);
|
||
|
|
||
|
interaction.success("general/remindme:SAVED");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = Remindme;
|