diff --git a/base/JaBa.js b/base/JaBa.js index 97bcece4..dce40392 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -248,9 +248,9 @@ class JaBa extends Client { return language(key, args); } - printDate(date, format = false, locale = this.defaultLanguage) { - const languageData = this.languages.find((language) => language.name === locale || language.aliases.includes(locale)); - if (!format) format = languageData.defaultMomentFormat; + printDate(date, format = "", locale = this.defaultLanguage) { + const languageData = this.languages.find(language => language.name === locale || language.aliases.includes(locale)); + if (format === "" || format === null) format = languageData.defaultMomentFormat; return moment(new Date(date)) .locale(languageData.moment) @@ -258,7 +258,7 @@ class JaBa extends Client { } convertTime(time, type = false, noPrefix = false, locale = this.defaultLanguage) { - const languageData = this.languages.find((language) => language.name === locale || language.aliases.includes(locale)); + const languageData = this.languages.find(language => language.name === locale || language.aliases.includes(locale)); const m = moment(time).locale(languageData.moment); return (type ? m.toNow(noPrefix) : m.fromNow(noPrefix)); diff --git a/commands/General/remindme.js b/commands/General/remindme.js index 049c0479..f500e90e 100644 --- a/commands/General/remindme.js +++ b/commands/General/remindme.js @@ -1,6 +1,7 @@ const { SlashCommandBuilder } = require("discord.js"); const BaseCommand = require("../../base/BaseCommand"), - ms = require("ms"); + ms = require("ms"), + moment = require("moment"); class Remindme extends BaseCommand { /** @@ -20,7 +21,7 @@ class Remindme extends BaseCommand { .setRequired(true)), aliases: [], dirname: __dirname, - guildOnly: true, + guildOnly: false, ownerOnly: false }); } @@ -38,6 +39,8 @@ class Remindme extends BaseCommand { * @param {Object} data */ async execute(client, interaction, data) { + await interaction.deferReply({ ephemeral: true }); + const time = interaction.options.getString("time"); const message = interaction.options.getString("message"); const dateNow = Date.now(); @@ -54,7 +57,10 @@ class Remindme extends BaseCommand { data.userData.save(); client.databaseCache.usersReminds.set(interaction.member.id, data.userData); - interaction.success("general/remindme:SAVED"); + interaction.success("general/remindme:SAVED", { + message, + time: moment(rData.createdAt).locale(interaction.guild.data.language).format("dddd, Do MMMM YYYY, HH:mm:ss") + }, { edit: true }); } } diff --git a/dashboard/public/docs/updates.md b/dashboard/public/docs/updates.md index a2a55544..bc5e8c15 100644 --- a/dashboard/public/docs/updates.md +++ b/dashboard/public/docs/updates.md @@ -1,3 +1,7 @@ +### JaBa v4.1.5 +* Изменения + * Более подробные сообщения в *remindme*. + ### JaBa v4.1.4 * Исправления * Ошибки в clips, loop, nowplaying и play. diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js index 3dcdb2ed..391b3fc8 100644 --- a/helpers/checkReminds.js +++ b/helpers/checkReminds.js @@ -1,4 +1,5 @@ const { EmbedBuilder } = require("discord.js"); +const moment = require("moment"); /** * @@ -21,18 +22,15 @@ module.exports.init = function (client) { const reminds = user.reminds; const mustSent = reminds.filter((r) => r.sendAt < dateNow); if (mustSent.length > 0) { - mustSent.forEach((r) => { + mustSent.forEach(r => { const embed = new EmbedBuilder() .setAuthor({ name: client.translate("general/remindme:TITLE") }) + .setDescription(client.translate("general/remindme:CREATED", { + time: moment(r.createdAt).locale(client.defaultLanguage).format("dddd, Do MMMM YYYY, HH:mm:ss") + })) .addFields([ - { - name: client.translate("common:CREATION"), - value: client.translate("general/remindme:CREATED", { - time: client.convertTime(r.createdAt, "from") - }) - }, { name: client.translate("common:MESSAGE"), value: r.message @@ -46,7 +44,7 @@ module.exports.init = function (client) { embeds: [embed] }); }); - user.reminds = user.reminds.filter((r) => r.sendAt >= dateNow); + user.reminds = user.reminds.filter(r => r.sendAt >= dateNow); user.save(); if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id); } diff --git a/languages/ru-RU/general/remindme.json b/languages/ru-RU/general/remindme.json index 285e9b2e..b28ec46c 100644 --- a/languages/ru-RU/general/remindme.json +++ b/languages/ru-RU/general/remindme.json @@ -3,7 +3,7 @@ "USAGE": "[время] [сообщение]", "EXAMPLES": "remindme 12h Использовать команду work\nremindme 5m Достать курицу из морозилки!", "TIME": "Время (Например: 10s, 5m, 2h, 1d, 3w)", - "SAVED": "Напоминание сохранено!", + "SAVED": "Напоминание `{{message}}` сохранено **{{time}}**", "TITLE": "Напоминание от JaBa", - "CREATED": "Напоминание создано {{time}}" + "CREATED": "Напоминание создано: **{{time}}**" } \ No newline at end of file diff --git a/package.json b/package.json index 3e29f277..2d880c2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jaba", - "version": "4.1.4", + "version": "4.1.5", "description": "My Discord Bot", "main": "index.js", "private": true,