mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-25 06:34: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);
|
return language(key, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
printDate(date, format = false, locale = this.defaultLanguage) {
|
printDate(date, format = "", 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));
|
||||||
if (!format) format = languageData.defaultMomentFormat;
|
if (format === "" || format === null) format = languageData.defaultMomentFormat;
|
||||||
|
|
||||||
return moment(new Date(date))
|
return moment(new Date(date))
|
||||||
.locale(languageData.moment)
|
.locale(languageData.moment)
|
||||||
|
@ -258,7 +258,7 @@ class JaBa extends Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
convertTime(time, type = false, noPrefix = false, locale = this.defaultLanguage) {
|
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);
|
const m = moment(time).locale(languageData.moment);
|
||||||
|
|
||||||
return (type ? m.toNow(noPrefix) : m.fromNow(noPrefix));
|
return (type ? m.toNow(noPrefix) : m.fromNow(noPrefix));
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const { SlashCommandBuilder } = require("discord.js");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const BaseCommand = require("../../base/BaseCommand"),
|
const BaseCommand = require("../../base/BaseCommand"),
|
||||||
ms = require("ms");
|
ms = require("ms"),
|
||||||
|
moment = require("moment");
|
||||||
|
|
||||||
class Remindme extends BaseCommand {
|
class Remindme extends BaseCommand {
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +21,7 @@ class Remindme extends BaseCommand {
|
||||||
.setRequired(true)),
|
.setRequired(true)),
|
||||||
aliases: [],
|
aliases: [],
|
||||||
dirname: __dirname,
|
dirname: __dirname,
|
||||||
guildOnly: true,
|
guildOnly: false,
|
||||||
ownerOnly: false
|
ownerOnly: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -38,6 +39,8 @@ class Remindme extends BaseCommand {
|
||||||
* @param {Object} data
|
* @param {Object} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction, data) {
|
async execute(client, interaction, data) {
|
||||||
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
const time = interaction.options.getString("time");
|
const time = interaction.options.getString("time");
|
||||||
const message = interaction.options.getString("message");
|
const message = interaction.options.getString("message");
|
||||||
const dateNow = Date.now();
|
const dateNow = Date.now();
|
||||||
|
@ -54,7 +57,10 @@ class Remindme extends BaseCommand {
|
||||||
data.userData.save();
|
data.userData.save();
|
||||||
client.databaseCache.usersReminds.set(interaction.member.id, data.userData);
|
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
|
### JaBa v4.1.4
|
||||||
* Исправления
|
* Исправления
|
||||||
* Ошибки в clips, loop, nowplaying и play.
|
* Ошибки в clips, loop, nowplaying и play.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const { EmbedBuilder } = require("discord.js");
|
const { EmbedBuilder } = require("discord.js");
|
||||||
|
const moment = require("moment");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -21,18 +22,15 @@ module.exports.init = function (client) {
|
||||||
const reminds = user.reminds;
|
const reminds = user.reminds;
|
||||||
const mustSent = reminds.filter((r) => r.sendAt < dateNow);
|
const mustSent = reminds.filter((r) => r.sendAt < dateNow);
|
||||||
if (mustSent.length > 0) {
|
if (mustSent.length > 0) {
|
||||||
mustSent.forEach((r) => {
|
mustSent.forEach(r => {
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: client.translate("general/remindme:TITLE")
|
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([
|
.addFields([
|
||||||
{
|
|
||||||
name: client.translate("common:CREATION"),
|
|
||||||
value: client.translate("general/remindme:CREATED", {
|
|
||||||
time: client.convertTime(r.createdAt, "from")
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: client.translate("common:MESSAGE"),
|
name: client.translate("common:MESSAGE"),
|
||||||
value: r.message
|
value: r.message
|
||||||
|
@ -46,7 +44,7 @@ module.exports.init = function (client) {
|
||||||
embeds: [embed]
|
embeds: [embed]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
user.reminds = user.reminds.filter((r) => r.sendAt >= dateNow);
|
user.reminds = user.reminds.filter(r => r.sendAt >= dateNow);
|
||||||
user.save();
|
user.save();
|
||||||
if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id);
|
if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"USAGE": "[время] [сообщение]",
|
"USAGE": "[время] [сообщение]",
|
||||||
"EXAMPLES": "remindme 12h Использовать команду work\nremindme 5m Достать курицу из морозилки!",
|
"EXAMPLES": "remindme 12h Использовать команду work\nremindme 5m Достать курицу из морозилки!",
|
||||||
"TIME": "Время (Например: 10s, 5m, 2h, 1d, 3w)",
|
"TIME": "Время (Например: 10s, 5m, 2h, 1d, 3w)",
|
||||||
"SAVED": "Напоминание сохранено!",
|
"SAVED": "Напоминание `{{message}}` сохранено **{{time}}**",
|
||||||
"TITLE": "Напоминание от JaBa",
|
"TITLE": "Напоминание от JaBa",
|
||||||
"CREATED": "Напоминание создано {{time}}"
|
"CREATED": "Напоминание создано: **{{time}}**"
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jaba",
|
"name": "jaba",
|
||||||
"version": "4.1.4",
|
"version": "4.1.5",
|
||||||
"description": "My Discord Bot",
|
"description": "My Discord Bot",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|
Loading…
Reference in a new issue