mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54:58 +05:00
Более подробные сообщения в remindme (v4.1.5)
This commit is contained in:
parent
96c2e770da
commit
7adaf42d47
6 changed files with 26 additions and 18 deletions
|
@ -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));
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
### JaBa v4.1.5
|
||||
* Изменения
|
||||
* Более подробные сообщения в *remindme*.
|
||||
|
||||
### JaBa v4.1.4
|
||||
* Исправления
|
||||
* Ошибки в clips, loop, nowplaying и play.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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}}**"
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jaba",
|
||||
"version": "4.1.4",
|
||||
"version": "4.1.5",
|
||||
"description": "My Discord Bot",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
|
|
Loading…
Reference in a new issue