diff --git a/README.md b/README.md
index 1dcf7158..b9e52537 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
[![](https://img.shields.io/badge/discord.js-v14.13.0-blue.svg?logo=npm)](https://github.com/discordjs/discord.js)
[![](https://www.codefactor.io/repository/github/JonnyBro/JaBa/badge)](https://www.codefactor.io/repository/github/JonnyBro/JaBa)
[![](https://img.shields.io/github/license/JonnyBro/JaBa?label=%D0%9B%D0%B8%D1%86%D0%B5%D0%BD%D0%B7%D0%B8%D1%8F%20&style=flat-square)](https://github.com/JonnyBro/JaBa/blob/main/LICENSE)
-JaBa это *Discord* бот с открытым (теперь) исходным кодом, написанный [Jonny_Bro](https://github.com/JonnyBro) на JavaScript с помощью [discord.js](https://github.com/discordjs/discord.js) и [Mongoose](https://mongoosejs.com). Поставьте звёздочку если вам нравится что я делаю :3
+JaBa это *Discord* бот с открытым (теперь) исходным кодом, написанный [Jonny_Bro](https://github.com/JonnyBro) на JavaScript с помощью [discord.js](https://github.com/discordjs/discord.js) и [Mongoose](https://mongoosejs.com).
## Функционал
@@ -31,15 +31,12 @@ JaBa имеет множество функций, вот **8 основных
* 👑 **Команды владельца**: `eval`, `getinvite`, `servers-list` и ещё **2** команды!
> [!NOTE]
-> [Список изменений](/dashboard/docs/updates.md)\
-> [Полный список команд](http://jababot.ru:8080/commands)
+> [Список изменений](https://blog.jababot.ru)\
+> [Полный список команд](https://dash.jababot.ru/commands)
## *Относительно* мощная панель управления
У JaBa есть своя панель управления с доступом к настройке параметров сервера!
-
## Установка
@@ -57,11 +54,11 @@ JaBa имеет множество функций, вот **8 основных
## Ссылки
-* [Список команд](http://jababot.ru:8080/commands)
-* [Инструкция по установке](https://github.com/JonnyBro/JaBa/wiki/Установка-JaBa-на-своей-машине)
+* [Список команд](https://dash.jababot.ru/commands)
+* [Инструкция по установке](https://github.com/JonnyBro/JaBa/wiki/Self-Hosting)
* [Discord](https://discord.gg/Ptkj2n9nzZ)
* [Github](https://github.com/JonnyBro/JaBa/)
-* [Панель управления](http://jababot.ru)
+* [Панель управления](https://dash.jababot.ru)
## Поддержка
diff --git a/base/BaseCommand.js b/base/BaseCommand.js
index 0b271f77..7abc79a0 100644
--- a/base/BaseCommand.js
+++ b/base/BaseCommand.js
@@ -7,10 +7,6 @@ class BaseCommand {
* @type {import("discord.js").SlashCommandBuilder | import("discord.js").ContextMenuCommandBuilder | import("discord.js").ApplicationCommandData}
*/
this.command = options.command;
- /**
- * @type {Array}
- */
- this.aliases = options.aliases || [];
/**
* @type {Boolean}
*/
diff --git a/base/Client.js b/base/Client.js
index 7452baf3..093ba2ed 100644
--- a/base/Client.js
+++ b/base/Client.js
@@ -1,4 +1,4 @@
-const { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder } = require("discord.js"),
+const { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder, EmbedBuilder, PermissionsBitField, ChannelType } = require("discord.js"),
{ Player } = require("discord-player"),
{ GiveawaysManager } = require("discord-giveaways"),
{ REST } = require("@discordjs/rest"),
@@ -13,6 +13,7 @@ const BaseEvent = require("./BaseEvent.js"),
class JaBaClient extends Client {
constructor(options) {
super(options);
+
this.config = require("../config");
this.customEmojis = require("../emojis");
this.languages = require("../languages/language-meta");
@@ -38,9 +39,11 @@ class JaBaClient extends Client {
this.player.extractors.loadDefault();
this.player.events.on("playerStart", async (queue, track) => {
- const m = (await queue.metadata.channel.send({
- content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language),
- })).id;
+ const m = (
+ await queue.metadata.channel.send({
+ content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language),
+ })
+ ).id;
if (track.durationMS > 1)
setTimeout(() => {
@@ -53,7 +56,7 @@ class JaBaClient extends Client {
const message = queue.metadata.channel.messages.cache.get(m);
if (message && message.deletable) message.delete();
- }, 5 * 60 * 1000); // m * s * ms
+ }, 5 * 60 * 1000);
});
this.player.events.on("emptyQueue", queue => queue.metadata.channel.send(this.translate("music/play:QUEUE_ENDED", null, queue.metadata.channel.guild.data.language)));
this.player.events.on("emptyChannel", queue => queue.metadata.channel.send(this.translate("music/play:STOP_EMPTY", null, queue.metadata.channel.guild.data.language)));
@@ -78,7 +81,7 @@ class JaBaClient extends Client {
}
/**
- * Login into account and connect to DB
+ * Logins into the account and connects to the database
*/
async init() {
this.login(this.config.token);
@@ -86,22 +89,19 @@ class JaBaClient extends Client {
mongoose
.connect(this.config.mongoDB)
.then(() => {
- this.logger.log("Connected to the Mongodb database.", "log");
+ this.logger.log("Connected to the Mongodb database.");
})
.catch(err => {
- this.logger.log(`Unable to connect to the Mongodb database.\nError: ${err}`, "error");
+ this.logger.error(`Unable to connect to the Mongodb database.\nError: ${err}`);
});
- await this.player.extractors.loadDefault();
-
// const autoUpdateDocs = require("../helpers/autoUpdateDocs");
// autoUpdateDocs.update(this);
}
/**
- * Loads commands from directory
- * @param {String} dir Directory where's all commands located
- * @returns
+ * Loads all commands from directory
+ * @param {String} dir Directory where commands are located
*/
async loadCommands(dir) {
const rest = new REST().setToken(this.config.token),
@@ -121,21 +121,15 @@ class JaBaClient extends Client {
if (file.endsWith(".js")) {
const Command = require(path.join(folder, file));
+
if (Command.prototype instanceof BaseCommand) {
const command = new Command(this);
this.commands.set(command.command.name, command);
- const aliases = [];
- if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0)
- command.aliases.forEach(alias => {
- const command_alias = command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder ? { ...command.command.toJSON() } : { ...command.command };
- command_alias.name = alias;
- aliases.push(command_alias);
- this.commands.set(alias, command);
- });
- commands.push(command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder ? command.command.toJSON() : command.command, ...aliases);
+ if (command.onLoad && typeof command.onLoad === "function") await command.onLoad(this);
+
+ commands.push(command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder ? command.command.toJSON() : command.command);
- if (command.onLoad || typeof command.onLoad === "function") await command.onLoad(this);
this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`);
}
}
@@ -143,80 +137,12 @@ class JaBaClient extends Client {
}
try {
- if (this.config.production)
- await rest.put(Routes.applicationCommands(this.config.userId), {
- body: commands,
- });
- else
- await rest.put(Routes.applicationGuildCommands(this.config.userId, this.config.support.id), {
- body: commands,
- });
+ if (this.config.production) await rest.put(Routes.applicationCommands(this.config.userId), { body: commands });
+ else await rest.put(Routes.applicationGuildCommands(this.config.userId, this.config.support.id), { body: commands });
this.logger.log("Successfully registered application commands.");
} catch (err) {
- this.logger.log("Cannot load commands: " + err.message, "error");
- }
- }
-
- /**
- * Loads single command in directory
- * @param {String} dir Directory where command is
- * @param {String} file Filename of the command
- */
- async loadCommand(dir, file) {
- const Command = require(path.join(dir, `${file}.js`));
- if (Command.prototype instanceof BaseCommand) {
- const command = new Command(this);
- this.commands.set(command.command.name, command);
- const aliases = [];
- if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0)
- command.aliases.forEach(alias => {
- const command_alias = command.command instanceof SlashCommandBuilder ? { ...command.command.toJSON() } : { ...command.command };
- command_alias.name = alias;
- aliases.push(command_alias);
- this.commands.set(alias, command);
- });
-
- if (command.onLoad || typeof command.onLoad === "function") await command.onLoad(this);
- this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`);
-
- return;
- }
- }
-
- /**
- * Unloads command from cache
- * @param {String} dir Directory of the command
- * @param {String} name Name of the command
- */
- async unloadCommand(dir, name) {
- delete require.cache[require.resolve(`${dir}${path.sep}${name}.js`)];
-
- return;
- }
-
- /**
- * Loads events from directory
- * @param {String} dir Directory where's all events located
- * @returns
- */
- async loadEvents(dir) {
- const filePath = path.join(__dirname, dir);
- const files = await fs.readdir(filePath);
- for (let index = 0; index < files.length; index++) {
- const file = files[index];
- const stat = await fs.lstat(path.join(filePath, file));
- if (stat.isDirectory()) this.loadEvents(path.join(dir, file));
- if (file.endsWith(".js")) {
- const Event = require(path.join(filePath, file));
- if (Event.prototype instanceof BaseEvent) {
- const event = new Event();
- if (!event.name || !event.name.length) return console.error(`Cannot load "${file}" event file: Event name is not set!`);
- if (event.once) this.once(event.name, event.execute.bind(event, this));
- else this.on(event.name, event.execute.bind(event, this));
- this.logger.log(`Successfully loaded "${file}" event file. (Event: ${event.name})`);
- }
- }
+ this.logger.error(`Error during commands registration!\n${err.message}`);
}
}
@@ -240,35 +166,127 @@ class JaBaClient extends Client {
}
/**
- * Finds or creates user in DB
- * @param {String} userID User ID
- * @returns {import("./User")} Mongoose model
+ * Returns an embed created from given data
+ * @param {Object} data Data for embed
+ * @returns {import("discord.js").Embed}
*/
- async findOrCreateUser(userID) {
- if (this.databaseCache.users.get(userID)) return this.databaseCache.users.get(userID);
- else {
- let userData = await this.usersData.findOne({ id: userID });
+ embed(data) {
+ const embed = new EmbedBuilder()
+ .setTitle(data.title || null)
+ .setDescription(data.description || null)
+ .setThumbnail(data.thumbnail || null)
+ .addFields(data.fields || [])
+ .setImage(data.image || null)
+ .setURL(data.url || null)
+ .setColor(data.color || this.config.embed.color)
+ .setFooter(data.footer || this.config.embed.footer)
+ .setTimestamp(data.timestamp || null);
- if (userData) {
- this.databaseCache.users.set(userID, userData);
+ if (typeof data.author === "string") embed.setAuthor({ name: data.author, iconURL: this.user.avatarURL() });
+ else if (typeof data.author === "object" && (data.author.iconURL !== null || data.author.iconURL !== undefined)) embed.setAuthor({ name: data.author.name, iconURL: this.user.avatarURL() });
+ else if (!data.author) embed.setAuthor(null);
+ else embed.setAuthor(data.author);
- return userData;
- } else {
- userData = new this.usersData({ id: userID });
+ return embed;
+ }
- await userData.save();
+ /**
+ * Creates an invite link for guild
+ * @param {String} guildId Guild ID
+ * @returns {String} Invite link
+ */
+ async createInvite(guildId) {
+ const guild = this.guilds.cache.get(guildId),
+ member = guild.members.me,
+ channel = guild.channels.cache.find(ch => ch.permissionsFor(member.id).has(PermissionsBitField.FLAGS.CREATE_INSTANT_INVITE) && (ch.type === ChannelType.GuildText || ch.type === ChannelType.GuildVoice));
- this.databaseCache.users.set(userID, userData);
+ if (channel) return (await channel.createInvite()).url || "No channels found or missing permissions";
+ }
- return userData;
+ /**
+ * Loads a single command from directory
+ * @param {String} dir Directory where command is located
+ * @param {String} file Filename of the command
+ */
+ async loadCommand(dir, file) {
+ const Command = require(path.join(dir, `${file}.js`));
+ if (!(Command.prototype instanceof BaseCommand)) return this.logger.error("Tried to load a non-command file!");
+
+ const command = new Command(this);
+ this.commands.set(command.command.name, command);
+
+ if (command.onLoad && typeof command.onLoad === "function") await command.onLoad(this);
+
+ return this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`);
+ }
+
+ /**
+ * Unloads a command
+ * @param {String} dir Directory where command is located
+ * @param {String} name Command name
+ * @returns
+ */
+ async unloadCommand(dir, name) {
+ delete require.cache[require.resolve(`${dir}${path.sep}${name}.js`)];
+
+ return;
+ }
+
+ /**
+ * Loads all events from directory recursively
+ * @param {String} dir Directory where events are located
+ */
+ async loadEvents(dir) {
+ const filePath = path.join(__dirname, dir);
+ const files = await fs.readdir(filePath);
+
+ for (let index = 0; index < files.length; index++) {
+ const file = files[index];
+ const stat = await fs.lstat(path.join(filePath, file));
+ if (stat.isDirectory()) this.loadEvents(path.join(dir, file));
+
+ if (file.endsWith(".js")) {
+ const Event = require(path.join(filePath, file));
+
+ if (Event.prototype instanceof BaseEvent) {
+ const event = new Event();
+ if (!event.name || !event.name.length) return console.error(`Cannot load "${file}" event file: Event name is not set!`);
+ if (event.once) this.once(event.name, event.execute.bind(event, this));
+ else this.on(event.name, event.execute.bind(event, this));
+
+ this.logger.log(`Successfully loaded "${file}" event file. (Event: ${event.name})`);
+ }
}
}
}
/**
- * Finds or creates member in DB
+ * Finds or creates a user in the database
+ * @param {String} userID User ID
+ * @returns {Promise} Mongoose model
+ */
+ async findOrCreateUser(userID) {
+ let userData = await this.usersData.findOne({ id: userID });
+
+ if (userData) {
+ this.databaseCache.users.set(userID, userData);
+
+ return userData;
+ } else {
+ userData = new this.usersData({ id: userID });
+
+ await userData.save();
+
+ this.databaseCache.users.set(userID, userData);
+
+ return userData;
+ }
+ }
+
+ /**
+ * Finds or creates a guild's member in the database
* @param {Array} { id: Member ID, Guild ID }
- * @returns {import("./Member")} Mongoose model
+ * @returns {Promise} Mongoose model
*/
async findOrCreateMember({ id: memberID, guildId }) {
let memberData = await this.membersData.findOne({ guildID: guildId, id: memberID });
@@ -299,7 +317,7 @@ class JaBaClient extends Client {
/**
* Finds or creates guild in DB
* @param {String} guildId Guild ID
- * @returns {import("./Guild")} Mongoose model
+ * @returns {Promise} Mongoose model
*/
async findOrCreateGuild(guildId) {
let guildData = await this.guildsData.findOne({ id: guildId }).populate("members");
diff --git a/commands/!DISABLED/ban.js b/commands/!DISABLED/ban.js
index 5913c6ae..50b4ae44 100644
--- a/commands/!DISABLED/ban.js
+++ b/commands/!DISABLED/ban.js
@@ -37,19 +37,11 @@ class Ban extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/!DISABLED/importmee6.js b/commands/!DISABLED/importmee6.js
index 6c843c61..2d86bbfd 100644
--- a/commands/!DISABLED/importmee6.js
+++ b/commands/!DISABLED/importmee6.js
@@ -14,18 +14,11 @@ class ImportMee6 extends BaseCommand {
.setDescription(client.translate("economy/importmee6:DESCRIPTION"))
.setDescriptionLocalizations({ uk: client.translate("economy/importmee6:DESCRIPTION", null, "uk-UA"), ru: client.translate("economy/importmee6:DESCRIPTION", null, "ru-RU") })
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/!DISABLED/kick.js b/commands/!DISABLED/kick.js
index 1ac0f171..8731dd8e 100644
--- a/commands/!DISABLED/kick.js
+++ b/commands/!DISABLED/kick.js
@@ -37,19 +37,11 @@ class Kick extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/!DISABLED/memes.js b/commands/!DISABLED/memes.js
index 927ec28b..514f4fb3 100644
--- a/commands/!DISABLED/memes.js
+++ b/commands/!DISABLED/memes.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js");
+const { SlashCommandBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch");
@@ -17,11 +17,11 @@ class Memes extends BaseCommand {
ru: client.translate("fun/memes:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -36,13 +36,11 @@ class Memes extends BaseCommand {
const tag = interaction.values[0];
const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json());
- const embed = new EmbedBuilder()
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTitle(res.title)
- .setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`)
- .setImage(res.url)
- .setTimestamp();
+ const embed = client.embed({
+ title: res.title,
+ description: `${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`,
+ image: res.url,
+ });
await interaction.editReply({
embeds: [embed],
@@ -50,6 +48,7 @@ class Memes extends BaseCommand {
}
});
}
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/!DISABLED/staff.js b/commands/!DISABLED/staff.js
index edef0296..a3271d70 100644
--- a/commands/!DISABLED/staff.js
+++ b/commands/!DISABLED/staff.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField } = require("discord.js");
+const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Staff extends BaseCommand {
@@ -16,18 +16,11 @@ class Staff extends BaseCommand {
ru: client.translate("general/staff:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -39,13 +32,15 @@ class Staff extends BaseCommand {
const administrators = interaction.guild.members.cache.filter(m => m.permissions.has(PermissionsBitField.Flags.Administrator) && !m.user.bot);
const moderators = interaction.guild.members.cache.filter(m => !administrators.has(m.id) && m.permissions.has(PermissionsBitField.Flags.ManageMessages) && !m.user.bot);
- const embed = new EmbedBuilder()
- .setAuthor({
+
+ const embed = client.embed({
+ author: {
name: interaction.translate("general/staff:TITLE", {
guild: interaction.guild.name,
}),
- })
- .addFields([
+ iconURL: interaction.guild.iconURL(),
+ },
+ fields: [
{
name: interaction.translate("general/staff:ADMINS"),
value:
@@ -57,9 +52,8 @@ class Staff extends BaseCommand {
name: interaction.translate("general/staff:MODS"),
value: moderators.size > 0 ? moderators.map(m => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS"),
},
- ])
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ ],
+ });
interaction.reply({
embeds: [embed],
diff --git a/commands/Administration/automod.js b/commands/Administration/automod.js
index 1626bf6a..e7a22a31 100644
--- a/commands/Administration/automod.js
+++ b/commands/Administration/automod.js
@@ -56,18 +56,11 @@ class Automod extends BaseCommand {
.setRequired(true),
),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Administration/autorole.js b/commands/Administration/autorole.js
index 8bf69243..442fe7e8 100644
--- a/commands/Administration/autorole.js
+++ b/commands/Administration/autorole.js
@@ -36,18 +36,11 @@ class Autorole extends BaseCommand {
ru: client.translate("common:ROLE", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Administration/config.js b/commands/Administration/config.js
index 45a99696..14650b4e 100644
--- a/commands/Administration/config.js
+++ b/commands/Administration/config.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField, ChannelType } = require("discord.js");
+const { SlashCommandBuilder, PermissionsBitField, ChannelType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Config extends BaseCommand {
@@ -75,18 +75,11 @@ class Config extends BaseCommand {
}),
),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -99,14 +92,12 @@ class Config extends BaseCommand {
if (command === "list") {
const guildData = data.guildData;
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.guild.name,
iconURL: interaction.guild.iconURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .addFields([
+ },
+ fields: [
{
name: interaction.translate("administration/config:WELCOME_TITLE"),
value: guildData.plugins.welcome.enabled
@@ -170,7 +161,8 @@ class Config extends BaseCommand {
name: interaction.translate("administration/config:DASHBOARD_TITLE"),
value: `[${interaction.translate("administration/config:DASHBOARD_CONTENT")}](${client.config.dashboard.domain})`,
},
- ]);
+ ],
+ });
interaction.reply({
embeds: [embed],
diff --git a/commands/Administration/goodbye.js b/commands/Administration/goodbye.js
index 7b3d6882..41af0f14 100644
--- a/commands/Administration/goodbye.js
+++ b/commands/Administration/goodbye.js
@@ -72,18 +72,11 @@ class Goodbye extends BaseCommand {
}),
),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Administration/selectroles.js b/commands/Administration/selectroles.js
index 46034f88..89214751 100644
--- a/commands/Administration/selectroles.js
+++ b/commands/Administration/selectroles.js
@@ -75,11 +75,11 @@ class Selectroles extends BaseCommand {
.setRequired(true),
),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -108,6 +108,7 @@ class Selectroles extends BaseCommand {
}
});
}
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Administration/set.js b/commands/Administration/set.js
index 7ad80220..a2bf01f1 100644
--- a/commands/Administration/set.js
+++ b/commands/Administration/set.js
@@ -53,18 +53,11 @@ class Set extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Administration/setlang.js b/commands/Administration/setlang.js
index 62e6326c..126d662c 100644
--- a/commands/Administration/setlang.js
+++ b/commands/Administration/setlang.js
@@ -28,18 +28,11 @@ class Setlang extends BaseCommand {
.setRequired(true)
.setChoices({ name: "English", value: "en-US" }, { name: "Русский", value: "ru-RU" }, { name: "Українська", value: "uk-UA" }),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Administration/stealemoji.js b/commands/Administration/stealemoji.js
index 47fb6611..39326590 100644
--- a/commands/Administration/stealemoji.js
+++ b/commands/Administration/stealemoji.js
@@ -27,18 +27,11 @@ class Stealemoji extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Administration/welcome.js b/commands/Administration/welcome.js
index 06732d66..91a7cb6f 100644
--- a/commands/Administration/welcome.js
+++ b/commands/Administration/welcome.js
@@ -72,18 +72,11 @@ class Welcome extends BaseCommand {
}),
),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Economy/achievements.js b/commands/Economy/achievements.js
index bf551c6d..63c5f4dc 100644
--- a/commands/Economy/achievements.js
+++ b/commands/Economy/achievements.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Achievements extends BaseCommand {
@@ -25,18 +25,11 @@ class Achievements extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -49,71 +42,70 @@ class Achievements extends BaseCommand {
const userData = user.id === interaction.user.id ? data.userData : await client.findOrCreateUser(user.id);
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("economy/achievements:TITLE"),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
-
- embed.addFields([
- {
- name: interaction.translate("economy/achievements:SEND_CMD"),
- value: interaction.translate("economy/achievements:PROGRESS", {
- now: userData.achievements.firstCommand.progress.now,
- total: userData.achievements.firstCommand.progress.total,
- percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total)),
- }),
+ iconURL: user.displayAvatarURL(),
},
- {
- name: interaction.translate("economy/achievements:CLAIM_SALARY"),
- value: interaction.translate("economy/achievements:PROGRESS", {
- now: userData.achievements.work.progress.now,
- total: userData.achievements.work.progress.total,
- percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total)),
- }),
- },
- {
- name: interaction.translate("economy/achievements:MARRY"),
- value: interaction.translate("economy/achievements:PROGRESS", {
- now: userData.achievements.married.progress.now,
- total: userData.achievements.married.progress.total,
- percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total)),
- }),
- },
- {
- name: interaction.translate("economy/achievements:SLOTS"),
- value: interaction.translate("economy/achievements:PROGRESS", {
- now: userData.achievements.slots.progress.now,
- total: userData.achievements.slots.progress.total,
- percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total)),
- }),
- },
- {
- name: interaction.translate("economy/achievements:TIP"),
- value: interaction.translate("economy/achievements:PROGRESS", {
- now: userData.achievements.tip.progress.now,
- total: userData.achievements.tip.progress.total,
- percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total)),
- }),
- },
- {
- name: interaction.translate("economy/achievements:REP"),
- value: interaction.translate("economy/achievements:PROGRESS", {
- now: userData.achievements.rep.progress.now,
- total: userData.achievements.rep.progress.total,
- percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total)),
- }),
- },
- {
- name: interaction.translate("economy/achievements:INVITE"),
- value: interaction.translate("economy/achievements:PROGRESS", {
- now: userData.achievements.invite.progress.now,
- total: userData.achievements.invite.progress.total,
- percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total)),
- }),
- },
- ]);
+ fields: [
+ {
+ name: interaction.translate("economy/achievements:SEND_CMD"),
+ value: interaction.translate("economy/achievements:PROGRESS", {
+ now: userData.achievements.firstCommand.progress.now,
+ total: userData.achievements.firstCommand.progress.total,
+ percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total)),
+ }),
+ },
+ {
+ name: interaction.translate("economy/achievements:CLAIM_SALARY"),
+ value: interaction.translate("economy/achievements:PROGRESS", {
+ now: userData.achievements.work.progress.now,
+ total: userData.achievements.work.progress.total,
+ percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total)),
+ }),
+ },
+ {
+ name: interaction.translate("economy/achievements:MARRY"),
+ value: interaction.translate("economy/achievements:PROGRESS", {
+ now: userData.achievements.married.progress.now,
+ total: userData.achievements.married.progress.total,
+ percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total)),
+ }),
+ },
+ {
+ name: interaction.translate("economy/achievements:SLOTS"),
+ value: interaction.translate("economy/achievements:PROGRESS", {
+ now: userData.achievements.slots.progress.now,
+ total: userData.achievements.slots.progress.total,
+ percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total)),
+ }),
+ },
+ {
+ name: interaction.translate("economy/achievements:TIP"),
+ value: interaction.translate("economy/achievements:PROGRESS", {
+ now: userData.achievements.tip.progress.now,
+ total: userData.achievements.tip.progress.total,
+ percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total)),
+ }),
+ },
+ {
+ name: interaction.translate("economy/achievements:REP"),
+ value: interaction.translate("economy/achievements:PROGRESS", {
+ now: userData.achievements.rep.progress.now,
+ total: userData.achievements.rep.progress.total,
+ percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total)),
+ }),
+ },
+ {
+ name: interaction.translate("economy/achievements:INVITE"),
+ value: interaction.translate("economy/achievements:PROGRESS", {
+ now: userData.achievements.invite.progress.now,
+ total: userData.achievements.invite.progress.total,
+ percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total)),
+ }),
+ },
+ ],
+ });
interaction.reply({
embeds: [embed],
diff --git a/commands/Economy/bank.js b/commands/Economy/bank.js
index 7ca9db5a..3b89c06e 100644
--- a/commands/Economy/bank.js
+++ b/commands/Economy/bank.js
@@ -37,18 +37,11 @@ class Bank extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Economy/birthdate.js b/commands/Economy/birthdate.js
index d128ac16..cea21894 100644
--- a/commands/Economy/birthdate.js
+++ b/commands/Economy/birthdate.js
@@ -60,18 +60,11 @@ class Birthdate extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -82,11 +75,12 @@ class Birthdate extends BaseCommand {
const day = interaction.options.getInteger("day"),
month = interaction.options.getInteger("month"),
year = interaction.options.getInteger("year"),
- d = new Date(year, month - 1, day);
+ date = new Date(year, month - 1, day),
+ d = Math.floor(date.getTime() / 1000);
- if (!(day == d.getDate() && month - 1 == d.getMonth() && year == d.getFullYear())) return interaction.error("economy/birthdate:INVALID_DATE");
- if (d.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH");
- if (d.getTime() < Date.now() - 2.523e12) return interaction.error("economy/birthdate:DATE_TOO_LOW");
+ if (!(day == date.getDate() && month - 1 == date.getMonth() && year == date.getFullYear())) return interaction.error("economy/birthdate:INVALID_DATE");
+ if (date.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH");
+ if (date.getTime() < Date.now() - 2.523e12) return interaction.error("economy/birthdate:DATE_TOO_LOW");
data.userData.birthdate = d;
@@ -94,7 +88,7 @@ class Birthdate extends BaseCommand {
await data.userData.save();
interaction.success("economy/birthdate:SUCCESS", {
- date: client.functions.printDate(client, d, "Do MMMM YYYY", interaction.getLocale()),
+ date: ``,
});
}
}
diff --git a/commands/Economy/divorce.js b/commands/Economy/divorce.js
index a225d170..40e57699 100644
--- a/commands/Economy/divorce.js
+++ b/commands/Economy/divorce.js
@@ -16,18 +16,11 @@ class Divorce extends BaseCommand {
ru: client.translate("economy/divorce:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Economy/leaderboard.js b/commands/Economy/leaderboard.js
index 9e7fa4cf..450be9ce 100644
--- a/commands/Economy/leaderboard.js
+++ b/commands/Economy/leaderboard.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Leaderboard extends BaseCommand {
@@ -27,18 +27,11 @@ class Leaderboard extends BaseCommand {
.setRequired(true)
.setChoices({ name: client.translate("common:LEVEL"), value: "level" }, { name: client.translate("common:MONEY"), value: "money" }, { name: client.translate("common:REP"), value: "rep" }),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -56,6 +49,15 @@ class Leaderboard extends BaseCommand {
ephemeral: true,
});
+ const embed = client.embed({
+ author: {
+ name: interaction.translate("economy/leaderboard:TABLE", {
+ name: interaction.guild.name,
+ }),
+ iconURL: interaction.guild.iconURL(),
+ },
+ });
+
if (type === "money") {
const membersLeaderboard = [],
membersData = await client.membersData.find({ guildID: interaction.guildId }).lean();
@@ -78,28 +80,18 @@ class Leaderboard extends BaseCommand {
money += `${data.money}\n`;
}
- const embed = new EmbedBuilder()
- .setAuthor({
- name: interaction.translate("economy/leaderboard:TABLE", {
- name: interaction.guild.name,
- }),
- iconURL: interaction.guild.iconURL(),
- })
- .setColor(client.config.embed.color)
- .addFields(
- {
- name: interaction.translate("common:USER"),
- value: userNames,
- inline: true,
- },
- {
- name: interaction.translate("common:CREDITS"),
- value: money,
- inline: true,
- },
- )
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ embed.fields = [
+ {
+ name: interaction.translate("common:USER"),
+ value: userNames,
+ inline: true,
+ },
+ {
+ name: interaction.translate("common:CREDITS"),
+ value: money,
+ inline: true,
+ },
+ ];
interaction.editReply({
embeds: [embed],
@@ -129,33 +121,23 @@ class Leaderboard extends BaseCommand {
xp.push(`${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}`);
}
- const embed = new EmbedBuilder()
- .setAuthor({
- name: interaction.translate("economy/leaderboard:TABLE", {
- name: interaction.guild.name,
- }),
- iconURL: interaction.guild.iconURL(),
- })
- .setColor(client.config.embed.color)
- .addFields([
- {
- name: interaction.translate("common:USER"),
- value: userNames.join("\n"),
- inline: true,
- },
- {
- name: interaction.translate("common:LEVEL"),
- value: level.join("\n"),
- inline: true,
- },
- {
- name: interaction.translate("common:XP"),
- value: xp.join("\n"),
- inline: true,
- },
- ])
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ embed.fields = [
+ {
+ name: interaction.translate("common:USER"),
+ value: userNames.join("\n"),
+ inline: true,
+ },
+ {
+ name: interaction.translate("common:LEVEL"),
+ value: level.join("\n"),
+ inline: true,
+ },
+ {
+ name: interaction.translate("common:XP"),
+ value: xp.join("\n"),
+ inline: true,
+ },
+ ];
interaction.editReply({
embeds: [embed],
@@ -182,28 +164,18 @@ class Leaderboard extends BaseCommand {
rep += `${data.rep}\n`;
}
- const embed = new EmbedBuilder()
- .setAuthor({
- name: interaction.translate("economy/leaderboard:TABLE", {
- name: interaction.guild.name,
- }),
- iconURL: interaction.guild.iconURL(),
- })
- .setColor(client.config.embed.color)
- .addFields(
- {
- name: interaction.translate("common:USER"),
- value: userNames,
- inline: true,
- },
- {
- name: interaction.translate("common:REP"),
- value: rep,
- inline: true,
- },
- )
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ embed.fields = [
+ {
+ name: interaction.translate("common:USER"),
+ value: userNames,
+ inline: true,
+ },
+ {
+ name: interaction.translate("common:REP"),
+ value: rep,
+ inline: true,
+ },
+ ];
interaction.editReply({
embeds: [embed],
diff --git a/commands/Economy/marry.js b/commands/Economy/marry.js
index 40b09bd2..7eccdb22 100644
--- a/commands/Economy/marry.js
+++ b/commands/Economy/marry.js
@@ -27,18 +27,11 @@ class Marry extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Economy/money.js b/commands/Economy/money.js
index f7724a6b..594a9ac5 100644
--- a/commands/Economy/money.js
+++ b/commands/Economy/money.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Money extends BaseCommand {
@@ -25,18 +25,11 @@ class Money extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -61,14 +54,14 @@ class Money extends BaseCommand {
globalMoney += data.money + data.bankSold;
});
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("economy/money:TITLE", {
user: member.user.getUsername(),
}),
iconURL: member.user.displayAvatarURL(),
- })
- .addFields([
+ },
+ fields: [
{
name: interaction.translate("economy/profile:CASH"),
value: `**${memberData.money}** ${client.functions.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
@@ -84,9 +77,9 @@ class Money extends BaseCommand {
value: `**${globalMoney}** ${client.functions.getNoun(globalMoney, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true,
},
- ])
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ ],
+ });
+
interaction.editReply({
embeds: [embed],
});
diff --git a/commands/Economy/pay.js b/commands/Economy/pay.js
index 7ad885f9..545abae3 100644
--- a/commands/Economy/pay.js
+++ b/commands/Economy/pay.js
@@ -36,18 +36,11 @@ class Pay extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js
index 9e6156ad..d6197e14 100644
--- a/commands/Economy/profile.js
+++ b/commands/Economy/profile.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Profile extends BaseCommand {
@@ -25,18 +25,11 @@ class Profile extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -65,19 +58,15 @@ class Profile extends BaseCommand {
const lover = client.users.cache.get(userData.lover);
- const profileEmbed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("economy/profile:TITLE", {
user: member.user.getUsername(),
}),
iconURL: member.displayAvatarURL(),
- })
- .setImage("attachment://achievements.png")
- .addFields([
- // {
- // name: client.customEmojis.link + " " + interaction.translate("economy/profile:LINK"),
- // value: `[${interaction.translate("economy/profile:LINK_TEXT")}](${client.config.dashboard.domain}/user/${member.user.id}/${interaction.guild.id})`,
- // },
+ },
+ image: "attachment://achievements.png",
+ fields: [
{
name: interaction.translate("economy/profile:BIO"),
value: userData.bio ? userData.bio : interaction.translate("common:UNKNOWN"),
@@ -114,12 +103,12 @@ class Profile extends BaseCommand {
},
{
name: interaction.translate("economy/profile:REGISTERED"),
- value: client.functions.printDate(client, new Date(memberData.registeredAt), null, interaction.getLocale()),
+ value: ``,
inline: true,
},
{
name: interaction.translate("economy/profile:BIRTHDATE"),
- value: !userData.birthdate ? interaction.translate("common:NOT_DEFINED") : client.functions.printDate(client, new Date(userData.birthdate), "Do MMMM YYYY", interaction.getLocale()),
+ value: !userData.birthdate ? interaction.translate("common:NOT_DEFINED") : ``,
inline: true,
},
{
@@ -131,15 +120,13 @@ class Profile extends BaseCommand {
name: interaction.translate("economy/profile:ACHIEVEMENTS"),
value: interaction.translate("economy/profile:ACHIEVEMENTS_CONTENT"),
},
- ])
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ ],
+ });
const buffer = await userData.getAchievements();
interaction.editReply({
- embeds: [profileEmbed],
+ embeds: [embed],
files: [
{
name: "achievements.png",
diff --git a/commands/Economy/rep.js b/commands/Economy/rep.js
index f62f6d3c..ac01f5ed 100644
--- a/commands/Economy/rep.js
+++ b/commands/Economy/rep.js
@@ -26,18 +26,11 @@ class Rep extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -46,10 +39,11 @@ class Rep extends BaseCommand {
*/
async execute(client, interaction, data) {
const isInCooldown = data.userData.cooldowns?.rep;
+
if (isInCooldown) {
if (isInCooldown > Date.now())
return interaction.error("economy/rep:COOLDOWN", {
- time: client.functions.convertTime(client, isInCooldown, true, false, interaction.getLocale()),
+ time: ``,
});
}
@@ -57,7 +51,7 @@ class Rep extends BaseCommand {
if (user.bot) return interaction.error("economy/rep:BOT_USER");
if (user.id === interaction.user.id) return interaction.error("economy/rep:YOURSELF");
- const toWait = Date.now() + 21600000; // 12 hours
+ const toWait = Math.floor((Date.now() + 12 * 60 * 60 * 1000) / 1000); // 12 hours
if (!data.userData.cooldowns) data.userData.cooldowns = {};
data.userData.cooldowns.rep = toWait;
diff --git a/commands/Economy/rob.js b/commands/Economy/rob.js
index e17a5e1b..cacfcc61 100644
--- a/commands/Economy/rob.js
+++ b/commands/Economy/rob.js
@@ -36,18 +36,11 @@ class Rob extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Economy/setbio.js b/commands/Economy/setbio.js
index 72588c0a..e9315fd2 100644
--- a/commands/Economy/setbio.js
+++ b/commands/Economy/setbio.js
@@ -26,18 +26,11 @@ class Setbio extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Economy/slots.js b/commands/Economy/slots.js
index c996fb09..d935d4c7 100644
--- a/commands/Economy/slots.js
+++ b/commands/Economy/slots.js
@@ -26,18 +26,11 @@ class Slots extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Economy/transactions.js b/commands/Economy/transactions.js
index a0668e0f..b62b66ce 100644
--- a/commands/Economy/transactions.js
+++ b/commands/Economy/transactions.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Transactions extends BaseCommand {
@@ -25,18 +25,11 @@ class Transactions extends BaseCommand {
ru: client.translate("economy/transactions:CLEAR", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -53,14 +46,12 @@ class Transactions extends BaseCommand {
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });
}
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("economy/transactions:EMBED_TRANSACTIONS"),
iconURL: interaction.member.displayAvatarURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
-
+ },
+ });
const transactions = data.memberData.transactions,
sortedTransactions = [[], []];
@@ -69,15 +60,15 @@ class Transactions extends BaseCommand {
array.push(
`${interaction.translate("economy/transactions:T_USER_" + t.type.toUpperCase())}: ${t.user}\n${interaction.translate("economy/transactions:T_AMOUNT")}: ${t.amount}\n${interaction.translate(
"economy/transactions:T_DATE",
- )}: ${client.functions.printDate(client, t.date, "Do MMMM YYYY, HH:mm", interaction.getLocale())}\n`,
+ )}: \n`,
);
});
if (transactions.length < 1) {
- embed.setDescription(interaction.translate("economy/transactions:NO_TRANSACTIONS"));
+ embed.data.description = interaction.translate("economy/transactions:NO_TRANSACTIONS");
} else {
if (sortedTransactions[0].length > 0)
- embed.addFields([
+ embed.data.fields.push([
{
name: interaction.translate("economy/transactions:T_GOT"),
value: sortedTransactions[0].join("\n"),
@@ -85,7 +76,7 @@ class Transactions extends BaseCommand {
},
]);
if (sortedTransactions[1].length > 0)
- embed.addFields([
+ embed.data.fields.push([
{
name: interaction.translate("economy/transactions:T_SEND"),
value: sortedTransactions[1].join("\n"),
diff --git a/commands/Economy/work.js b/commands/Economy/work.js
index 86350bd2..6eae04fb 100644
--- a/commands/Economy/work.js
+++ b/commands/Economy/work.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js");
+const { SlashCommandBuilder, parseEmoji } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Work extends BaseCommand {
@@ -16,18 +16,11 @@ class Work extends BaseCommand {
ru: client.translate("economy/work:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -36,15 +29,17 @@ class Work extends BaseCommand {
*/
async execute(client, interaction, data) {
const isInCooldown = data.memberData.cooldowns?.work;
+
if (isInCooldown) {
if (isInCooldown > Date.now())
return interaction.error("economy/work:COOLDOWN", {
- time: client.functions.convertTime(client, isInCooldown, true, false, interaction.getLocale()),
+ time: ``,
});
}
+
if (Date.now() > data.memberData.cooldowns.work + 24 * 60 * 60 * 1000) data.memberData.workStreak = 0;
- const toWait = Date.now() + 24 * 60 * 60 * 1000; // 24 hours
+ const toWait = Math.floor((Date.now() + 24 * 60 * 60 * 1000) / 1000); // 24 hours
data.memberData.cooldowns.work = toWait;
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
@@ -52,19 +47,19 @@ class Work extends BaseCommand {
data.memberData.markModified("workStreak");
await data.memberData.save();
- const embed = new EmbedBuilder()
- .setFooter({
+ const embed = client.embed({
+ footer: {
text: interaction.translate("economy/work:AWARD"),
iconURL: interaction.member.displayAvatarURL(),
- })
- .setColor(client.config.embed.color);
+ },
+ });
const award = [client.customEmojis.letters.a, client.customEmojis.letters.w, client.customEmojis.letters.a, client.customEmojis.letters.r, client.customEmojis.letters.d];
let won = 200;
if (data.memberData.workStreak >= 5) {
won += 200;
- embed.addFields([
+ embed.fields = [
{
name: interaction.translate("economy/work:SALARY"),
value: interaction.translate("economy/work:SALARY_CONTENT", {
@@ -75,7 +70,7 @@ class Work extends BaseCommand {
name: interaction.translate("economy/work:STREAK"),
value: interaction.translate("economy/work:STREAK_CONTENT"),
},
- ]);
+ ];
data.memberData.workStreak = 0;
} else {
for (let i = 0; i < award.length; i++) {
@@ -84,7 +79,7 @@ class Work extends BaseCommand {
award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
}
}
- embed.addFields([
+ embed.fields = [
{
name: interaction.translate("economy/work:SALARY"),
value: interaction.translate("economy/work:SALARY_CONTENT", {
@@ -95,7 +90,7 @@ class Work extends BaseCommand {
name: interaction.translate("economy/work:STREAK"),
value: award.join(""),
},
- ]);
+ ];
}
data.memberData.money += won;
diff --git a/commands/Fun/8ball.js b/commands/Fun/8ball.js
index 770b08bc..d03c794e 100644
--- a/commands/Fun/8ball.js
+++ b/commands/Fun/8ball.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Eightball extends BaseCommand {
@@ -26,18 +26,11 @@ class Eightball extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -48,8 +41,8 @@ class Eightball extends BaseCommand {
await interaction.deferReply();
const question = interaction.options.getString("question");
- const embed = new EmbedBuilder()
- .setFields(
+ const embed = client.embed({
+ fields: [
{
name: interaction.translate("fun/8ball:QUESTION"),
value: question,
@@ -58,10 +51,8 @@ class Eightball extends BaseCommand {
name: interaction.translate("fun/8ball:ANSWER"),
value: interaction.translate(`fun/8ball:RESPONSE_${client.functions.randomNum(1, 20)}`),
},
- )
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ ],
+ });
await client.wait(5000);
diff --git a/commands/Fun/cat.js b/commands/Fun/cat.js
index 349b484e..935d4779 100644
--- a/commands/Fun/cat.js
+++ b/commands/Fun/cat.js
@@ -17,18 +17,11 @@ class Cat extends BaseCommand {
ru: client.translate("fun/cat:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -41,7 +34,11 @@ class Cat extends BaseCommand {
const res = await fetch("https://api.thecatapi.com/v1/images/search").then(r => r.json());
const cat = res[0].url;
- await interaction.editReply({ content: cat });
+ const embed = client.embed({
+ image: cat,
+ });
+
+ await interaction.editReply({ embeds: [embed] });
}
}
diff --git a/commands/Fun/dog.js b/commands/Fun/dog.js
index 1a7700e7..3125cc32 100644
--- a/commands/Fun/dog.js
+++ b/commands/Fun/dog.js
@@ -17,18 +17,11 @@ class Dog extends BaseCommand {
ru: client.translate("fun/dog:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -41,7 +34,11 @@ class Dog extends BaseCommand {
const res = await fetch("https://dog.ceo/api/breeds/image/random").then(r => r.json());
const dog = res.message;
- await interaction.editReply({ content: dog });
+ const embed = client.embed({
+ image: dog,
+ });
+
+ await interaction.editReply({ embeds: [embed] });
}
}
diff --git a/commands/Fun/lmgtfy.js b/commands/Fun/lmgtfy.js
index a8d7b581..ac3ae493 100644
--- a/commands/Fun/lmgtfy.js
+++ b/commands/Fun/lmgtfy.js
@@ -37,18 +37,11 @@ class LMGTFY extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Fun/lovecalc.js b/commands/Fun/lovecalc.js
index b1ed612a..65699ba7 100644
--- a/commands/Fun/lovecalc.js
+++ b/commands/Fun/lovecalc.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"),
md5 = require("md5");
@@ -36,18 +36,11 @@ class Lovecalc extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -67,19 +60,16 @@ class Lovecalc extends BaseCommand {
.join("");
const percent = parseInt(string.slice(0, 2), 10);
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}`,
- })
- .setDescription(
- interaction.translate("fun/lovecalc:CONTENT", {
- percent,
- firstMember: firstMember.user.toString(),
- secondMember: secondMember.user.toString(),
- }),
- )
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ },
+ description: interaction.translate("fun/lovecalc:CONTENT", {
+ percent,
+ firstMember: firstMember.user.toString(),
+ secondMember: secondMember.user.toString(),
+ }),
+ });
interaction.reply({
embeds: [embed],
diff --git a/commands/Fun/number.js b/commands/Fun/number.js
index d0e51139..ee782044 100644
--- a/commands/Fun/number.js
+++ b/commands/Fun/number.js
@@ -17,18 +17,11 @@ class Number extends BaseCommand {
ru: client.translate("fun/number:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -60,12 +53,11 @@ class Number extends BaseCommand {
const parsedNumber = parseInt(msg.content, 10);
if (parsedNumber === number) {
- const time = client.functions.convertTime(client, gameCreatedAt, false, true, interaction.getLocale());
interaction.channel.send({
content: interaction.translate("fun/number:GAME_STATS", {
winner: msg.author.toString(),
number,
- time,
+ time: ``,
participantCount: participants.length,
participants: participants.map(p => `<@${p}>`).join(", "),
}),
diff --git a/commands/Fun/tictactoe.js b/commands/Fun/tictactoe.js
index 9a75d583..c6a4a21c 100644
--- a/commands/Fun/tictactoe.js
+++ b/commands/Fun/tictactoe.js
@@ -27,18 +27,11 @@ class TicTacToe extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/General/afk.js b/commands/General/afk.js
index 62f47e17..05d48e73 100644
--- a/commands/General/afk.js
+++ b/commands/General/afk.js
@@ -26,18 +26,11 @@ class Afk extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/General/avatar.c.js b/commands/General/avatar.c.js
index 00764a56..1b4feb12 100644
--- a/commands/General/avatar.c.js
+++ b/commands/General/avatar.c.js
@@ -12,18 +12,11 @@ class AvatarContext extends BaseCommand {
.setName("Get Avatar")
.setType(ApplicationCommandType.User)
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -31,14 +24,11 @@ class AvatarContext extends BaseCommand {
* @param {Object} data
*/
async execute(client, interaction) {
- const avatar = interaction.targetUser.avatarURL({ size: 2048 });
+ const avatarURL = interaction.targetUser.avatarURL({ size: 2048 });
+ const embed = client.embed({ image: avatarURL });
interaction.reply({
- files: [
- {
- attachment: avatar,
- },
- ],
+ embeds: [embed],
});
}
}
diff --git a/commands/General/avatar.js b/commands/General/avatar.js
index faae3ccc..449d6fea 100644
--- a/commands/General/avatar.js
+++ b/commands/General/avatar.js
@@ -34,18 +34,11 @@ class Avatar extends BaseCommand {
ru: client.translate("general/avatar:SERVER", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -54,14 +47,11 @@ class Avatar extends BaseCommand {
*/
async execute(client, interaction) {
const member = interaction.options.getMember("user") || interaction.member;
- const avatarURL = interaction.options.getBoolean("server") ? member.avatarURL({ size: 512 }) : member.user.avatarURL({ size: 512 });
+ const avatarURL = interaction.options.getBoolean("server") ? member.avatarURL({ size: 2048 }) : member.user.avatarURL({ size: 2048 });
+ const embed = client.embed({ image: avatarURL });
interaction.reply({
- files: [
- {
- attachment: avatarURL,
- },
- ],
+ embeds: [embed],
});
}
}
diff --git a/commands/General/boosters.js b/commands/General/boosters.js
index 32fe205b..4f388e2c 100644
--- a/commands/General/boosters.js
+++ b/commands/General/boosters.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
+const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Boosters extends BaseCommand {
@@ -16,11 +16,11 @@ class Boosters extends BaseCommand {
ru: client.translate("general/boosters:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -110,6 +110,7 @@ class Boosters extends BaseCommand {
}
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -158,14 +159,13 @@ function generateBoostersEmbeds(client, interaction, boosters) {
let j = i;
k += 10;
- const info = current.map(member => `${++j}. ${member.toString()} | ${interaction.translate("general/boosters:BOOSTER_SINCE")}: **${client.functions.printDate(client, member.premiumSince, null, interaction.getLocale())}**`).join("\n");
+ const info = current.map(member => `${++j}. ${member.toString()} | ${interaction.translate("general/boosters:BOOSTER_SINCE")}: **${Math.floor(new Date(member.premiumSince).getTime() / 1000)}**`).join("\n");
+
+ const embed = client.embed({
+ title: interaction.translate("general/boosters:BOOSTERS_LIST"),
+ description: info,
+ });
- const embed = new EmbedBuilder()
- .setTitle(interaction.translate("general/boosters:BOOSTERS_LIST"))
- .setDescription(info)
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
embeds.push(embed);
}
diff --git a/commands/General/emoji.js b/commands/General/emoji.js
index 9b70bd18..9b287658 100644
--- a/commands/General/emoji.js
+++ b/commands/General/emoji.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js");
+const { SlashCommandBuilder, parseEmoji } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Emoji extends BaseCommand {
@@ -26,18 +26,11 @@ class Emoji extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -48,15 +41,13 @@ class Emoji extends BaseCommand {
const rawEmoji = interaction.options.getString("emoji");
const parsedEmoji = parseEmoji(rawEmoji);
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("general/emoji:TITLE", {
emoji: parsedEmoji.name,
}),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .addFields([
+ },
+ fields: [
{
name: interaction.translate("common:NAME"),
value: parsedEmoji.name,
@@ -73,7 +64,8 @@ class Emoji extends BaseCommand {
name: interaction.translate("general/emoji:LINK"),
value: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${parsedEmoji.animated ? "gif" : "png"}`,
},
- ]);
+ ],
+ });
interaction.reply({
embeds: [embed],
diff --git a/commands/General/help.js b/commands/General/help.js
index e73e264d..3288c1ea 100644
--- a/commands/General/help.js
+++ b/commands/General/help.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, PermissionsBitField } = require("discord.js");
+const { SlashCommandBuilder, ActionRowBuilder, StringSelectMenuBuilder, PermissionsBitField } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Help extends BaseCommand {
@@ -26,11 +26,11 @@ class Help extends BaseCommand {
})
.setAutocomplete(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -52,19 +52,15 @@ class Help extends BaseCommand {
};
});
- const embed = new EmbedBuilder()
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("general/help:COMMANDS_IN", { category: arg }),
- })
- .addFields(categoryCommands)
- .addFields([
- {
- name: "\u200B",
- value: interaction.translate("general/help:INFO"),
- },
- ]);
+ },
+ fields: categoryCommands.concat({
+ name: "\u200B",
+ value: interaction.translate("general/help:INFO"),
+ }),
+ });
return interaction.editReply({
content: null,
@@ -73,6 +69,7 @@ class Help extends BaseCommand {
}
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -83,24 +80,15 @@ class Help extends BaseCommand {
await interaction.deferReply();
const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()];
- const categories = [];
+ const categories = [... new Set(commands.map(c => c.category))];
const command = interaction.options.getString("command");
if (command) {
- if (commands.find(c => c.command.name === command).category === "Owner" && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { edit: true, ephemeral: true });
-
- return interaction.editReply({ embeds: [generateCommandHelp(interaction, command)] });
+ if (commands.find(c => c.command.name === command).category === "Owner" && interaction.user.id !== client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { edit: true });
+ else if (commands.find(c => c.command.name === command).category === "IAT" && interaction.guildId !== "1039187019957555252") return interaction.error("misc:OWNER_ONLY", null, { edit: true });
+ else return interaction.editReply({ embeds: [generateCommandHelp(interaction, command)] });
}
- commands.forEach(c => {
- if (!categories.includes(c.category)) {
- if (c.category === "Owner" && interaction.user.id !== client.config.owner.id) return;
- if (c.category === "IAT" && interaction.guildId !== "1039187019957555252") return;
-
- categories.push(c.category);
- }
- });
-
const categoriesRows = categories.sort().map(c => {
return {
label: `${c} (${commands.filter(cmd => cmd.category === c).length})`,
@@ -145,38 +133,36 @@ function generateCommandHelp(interaction, command) {
const cmd = interaction.client.commands.get(command);
if (!cmd) return interaction.error("general/help:NOT_FOUND", { command }, { edit: true });
- const usage = interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`) === "" ? interaction.translate("misc:NO_ARGS") : interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`);
+ if (cmd.category === "Owner" && interaction.user.id !== interaction.client.config.owner.id) return interaction.error("misc:OWNER_ONLY", null, { edit: true });
+ else if (cmd.category === "IAT" && interaction.guildId !== "1039187019957555252") return interaction.error("misc:OWNER_ONLY", null, { edit: true });
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = interaction.client.embed({
+ author: {
name: interaction.translate("general/help:CMD_TITLE", {
cmd: cmd.command.name,
}),
- })
- .addFields([
+ },
+ fields: [
{
name: interaction.translate("general/help:FIELD_DESCRIPTION"),
value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`),
},
{
name: interaction.translate("general/help:FIELD_USAGE"),
- value: `*${cmd.command.dm_permission === false ? interaction.translate("general/help:GUILD_ONLY") : interaction.translate("general/help:NOT_GUILD_ONLY")}*\n\n` + usage,
+ value: `*${cmd.command.dm_permission === false ? interaction.translate("general/help:GUILD_ONLY") : interaction.translate("general/help:NOT_GUILD_ONLY")}*\n\n${
+ interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`) === "" ? interaction.translate("misc:NO_ARGS") : interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`)
+ }`,
},
{
name: interaction.translate("general/help:FIELD_EXAMPLES"),
value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:EXAMPLES`),
},
- // {
- // name: interaction.translate("general/help:FIELD_ALIASES"),
- // value: cmd.aliases.length > 0 ? cmd.aliases.map(a => `${a}`).join("\n") : interaction.translate("general/help:NO_ALIAS")
- // },
{
name: interaction.translate("general/help:FIELD_PERMISSIONS"),
value: cmd.command.default_member_permissions > 0 ? interaction.translate(`misc:PERMISSIONS:${getPermName(cmd.command.default_member_permissions)}`) : interaction.translate("general/help:NO_REQUIRED_PERMISSION"),
},
- ])
- .setColor(interaction.client.config.embed.color)
- .setFooter(interaction.client.config.embed.footer);
+ ],
+ });
return embed;
}
diff --git a/commands/General/minecraft.js b/commands/General/minecraft.js
index edef6a10..6251bab6 100644
--- a/commands/General/minecraft.js
+++ b/commands/General/minecraft.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"),
gamedig = require("gamedig");
@@ -27,18 +27,11 @@ class Minecraft extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -69,11 +62,10 @@ class Minecraft extends BaseCommand {
if (!res) return interaction.error("general/minecraft:FAILED", null, { edit: true });
- const embed = new EmbedBuilder()
- .setAuthor({
- name: res.name || "Unknown",
- })
- .addFields([
+ const embed = client.embed({
+ author: { name: res.name || "Unknown" },
+ thumbnail: `https://eu.mc-api.net/v3/server/favicon/${ip}`,
+ fields: [
{
name: interaction.translate("general/minecraft:FIELD_STATUS"),
value: interaction.translate("general/minecraft:ONLINE"),
@@ -106,10 +98,8 @@ class Minecraft extends BaseCommand {
name: interaction.translate("general/minecraft:FIELD_PING"),
value: res.raw.vanilla.ping.toString(),
},
- ])
- .setColor(client.config.embed.color)
- .setThumbnail(`https://eu.mc-api.net/v3/server/favicon/${ip}`)
- .setFooter(client.config.embed.footer);
+ ],
+ });
interaction.editReply({
embeds: [embed],
diff --git a/commands/General/ping.js b/commands/General/ping.js
index 3521f6d1..4244ed82 100644
--- a/commands/General/ping.js
+++ b/commands/General/ping.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Ping extends BaseCommand {
@@ -16,18 +16,11 @@ class Ping extends BaseCommand {
ru: client.translate("general/ping:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -35,18 +28,14 @@ class Ping extends BaseCommand {
* @param {Object} data
*/
async execute(client, interaction) {
- const embed = new EmbedBuilder()
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("general/ping:PONG"),
- iconURL: client.user.avatarURL(),
- })
- .setDescription(
- interaction.translate("general/ping:PING", {
- ping: Math.round(client.ws.ping),
- }),
- );
+ },
+ description: interaction.translate("general/ping:PING", {
+ ping: Math.round(client.ws.ping),
+ }),
+ });
interaction.reply({
embeds: [embed],
diff --git a/commands/General/remindme.js b/commands/General/remindme.js
index 4973f6c0..8d81d654 100644
--- a/commands/General/remindme.js
+++ b/commands/General/remindme.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"),
ms = require("ms"),
moment = require("moment");
@@ -38,18 +38,11 @@ class Remindme extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -76,11 +69,9 @@ class Remindme extends BaseCommand {
client.databaseCache.usersReminds.set(interaction.user.id, data.userData);
- const embed = new EmbedBuilder()
- .setAuthor({
- name: interaction.translate("general/remindme:EMBED_SAVED"),
- })
- .addFields([
+ const embed = client.embed({
+ author: interaction.translate("general/remindme:EMBED_SAVED"),
+ fields: [
{
name: interaction.translate("general/remindme:EMBED_TIME"),
value: moment(reminderData.sendAt).locale(interaction.getLocale()).format("Do MMMM YYYY, HH:mm:ss"),
@@ -89,9 +80,8 @@ class Remindme extends BaseCommand {
name: interaction.translate("common:MESSAGE"),
value: reminderData.message,
},
- ])
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ ],
+ });
interaction.editReply({
embeds: [embed],
diff --git a/commands/General/report.js b/commands/General/report.js
index 13173976..98095052 100644
--- a/commands/General/report.js
+++ b/commands/General/report.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js");
+const { SlashCommandBuilder, parseEmoji } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Report extends BaseCommand {
@@ -36,18 +36,11 @@ class Report extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -63,20 +56,17 @@ class Report extends BaseCommand {
const rep = interaction.options.getString("message");
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("general/report:TITLE", {
user: member.user.getUsername(),
}),
- iconURL: interaction.user.displayAvatarURL({
- extension: "png",
- size: 512,
- }),
- })
- .addFields([
+ iconURL: interaction.user.displayAvatarURL(),
+ },
+ fields: [
{
name: interaction.translate("common:DATE"),
- value: client.functions.printDate(client, new Date(Date.now()), null, interaction.getLocale()),
+ value: ``,
},
{
name: interaction.translate("common:AUTHOR"),
@@ -93,9 +83,8 @@ class Report extends BaseCommand {
value: rep,
inline: true,
},
- ])
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ ],
+ });
const success = parseEmoji(client.customEmojis.cool).id;
const error = parseEmoji(client.customEmojis.notcool).id;
diff --git a/commands/General/serverinfo.js b/commands/General/serverinfo.js
index 548e49df..11a335d6 100644
--- a/commands/General/serverinfo.js
+++ b/commands/General/serverinfo.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, ChannelType } = require("discord.js");
+const { SlashCommandBuilder, ChannelType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Serverinfo extends BaseCommand {
@@ -16,18 +16,11 @@ class Serverinfo extends BaseCommand {
ru: client.translate("general/serverinfo:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -40,17 +33,10 @@ class Serverinfo extends BaseCommand {
await guild.members.fetch();
const owner = await guild.fetchOwner();
- const embed = new EmbedBuilder()
- .setAuthor({
- name: guild.name,
- iconURL: guild.iconURL(),
- })
- .setThumbnail(guild.iconURL())
- .addFields([
- // {
- // name: client.customEmojis.link + " " + interaction.translate("general/serverinfo:LINK"),
- // value: `[${interaction.translate("general/serverinfo:LINK_TEXT")}](${client.config.dashboard.domain}/stats/${guild.id})`,
- // },
+ const embed = client.embed({
+ author: guild.name,
+ thumbnail: guild.iconURL(),
+ fields: [
{
name: client.customEmojis.title + interaction.translate("common:NAME"),
value: guild.name,
@@ -58,7 +44,7 @@ class Serverinfo extends BaseCommand {
},
{
name: client.customEmojis.calendar + interaction.translate("common:CREATION"),
- value: client.functions.printDate(client, guild.createdAt, null, interaction.getLocale()),
+ value: ``,
inline: true,
},
{
@@ -124,10 +110,8 @@ class Serverinfo extends BaseCommand {
)}`,
inline: true,
},
- ])
-
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ ],
+ });
interaction.reply({
embeds: [embed],
diff --git a/commands/General/shorturl.js b/commands/General/shorturl.js
index a000611c..2a15135d 100644
--- a/commands/General/shorturl.js
+++ b/commands/General/shorturl.js
@@ -27,18 +27,11 @@ class Shorturl extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/General/stats.js b/commands/General/stats.js
index 44bc34da..2a766074 100644
--- a/commands/General/stats.js
+++ b/commands/General/stats.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField, version } = require("discord.js");
+const { SlashCommandBuilder, PermissionsBitField, version: djsVersion } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Stats extends BaseCommand {
@@ -16,18 +16,11 @@ class Stats extends BaseCommand {
ru: client.translate("general/stats:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -43,14 +36,10 @@ class Stats extends BaseCommand {
});
users = users - hiddenGuildMembersCount;
- const statsEmbed = new EmbedBuilder()
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setAuthor({
- name: interaction.translate("common:STATS"),
- })
- .setDescription(interaction.translate("general/stats:MADE"))
- .addFields([
+ const embed = client.embed({
+ author: interaction.translate("common:STATS"),
+ descirption: interaction.translate("general/stats:MADE"),
+ fields: [
{
name: client.customEmojis.stats + " " + interaction.translate("general/stats:COUNTS_TITLE"),
value: interaction.translate("general/stats:COUNTS_CONTENT", {
@@ -61,7 +50,7 @@ class Stats extends BaseCommand {
},
{
name: client.customEmojis.version + " " + interaction.translate("general/stats:VERSIONS_TITLE"),
- value: `\`Discord.js: v${version}\`\n\`Nodejs: v${process.versions.node}\``,
+ value: `\`Discord.js: v${djsVersion}\`\n\`Nodejs: v${process.versions.node}\``,
inline: true,
},
{
@@ -72,7 +61,7 @@ class Stats extends BaseCommand {
{
name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"),
value: interaction.translate("general/stats:ONLINE_CONTENT", {
- time: client.functions.convertTime(client, Date.now() + client.uptime, true, false, interaction.getLocale()),
+ time: ``,
}),
},
{
@@ -100,10 +89,11 @@ class Stats extends BaseCommand {
owner: client.config.owner.id,
}),
},
- ]);
+ ],
+ });
interaction.reply({
- embeds: [statsEmbed],
+ embeds: [embed],
});
}
}
diff --git a/commands/General/suggest.js b/commands/General/suggest.js
index d3844b0b..d7fd40f2 100644
--- a/commands/General/suggest.js
+++ b/commands/General/suggest.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js");
+const { SlashCommandBuilder, parseEmoji } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Suggest extends BaseCommand {
@@ -26,18 +26,11 @@ class Suggest extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -45,22 +38,22 @@ class Suggest extends BaseCommand {
* @param {Object} data
*/
async execute(client, interaction, data) {
- const suggChannel = interaction.guild.channels.cache.get(data.guildData.plugins.suggestions);
- if (!suggChannel) return interaction.error("general/suggest:MISSING_CHANNEL");
+ const channel = interaction.guild.channels.cache.get(data.guildData.plugins.suggestions);
+ if (!channel) return interaction.error("general/suggest:MISSING_CHANNEL");
const suggestion = interaction.options.getString("message");
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("general/suggest:TITLE", {
user: interaction.user.getUsername(),
}),
iconURL: interaction.member.displayAvatarURL(),
- })
- .addFields([
+ },
+ fields: [
{
name: interaction.translate("common:DATE"),
- value: client.functions.printDate(client, new Date(Date.now()), null, interaction.getLocale()),
+ value: ``,
},
{
name: interaction.translate("common:AUTHOR"),
@@ -72,14 +65,13 @@ class Suggest extends BaseCommand {
value: suggestion,
inline: true,
},
- ])
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ ],
+ });
const success = parseEmoji(client.customEmojis.cool).id;
const error = parseEmoji(client.customEmojis.notcool).id;
- suggChannel.send({
+ channel.send({
embeds: [embed],
}).then(async m => {
await m.react(success);
@@ -87,7 +79,7 @@ class Suggest extends BaseCommand {
});
interaction.success("general/suggest:SUCCESS", {
- channel: suggChannel.toString(),
+ channel: channel.toString(),
}, { ephemeral: true });
}
}
diff --git a/commands/General/userinfo.js b/commands/General/userinfo.js
index 399c6be5..f467146b 100644
--- a/commands/General/userinfo.js
+++ b/commands/General/userinfo.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Userinfo extends BaseCommand {
@@ -25,18 +25,11 @@ class Userinfo extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -45,17 +38,14 @@ class Userinfo extends BaseCommand {
*/
async execute(client, interaction) {
const member = interaction.options.getMember("user") || interaction.member;
- const embed = new EmbedBuilder()
- .setAuthor({
+
+ const embed = client.embed({
+ author: {
name: `${member.user.getUsername()} (${member.id})`,
iconURL: member.displayAvatarURL(),
- })
- .setThumbnail(
- member.displayAvatarURL({
- size: 512,
- }),
- )
- .addFields([
+ },
+ thumbnail: member.displayAvatarURL(),
+ fields: [
{
name: ":man: " + interaction.translate("common:USERNAME"),
value: member.user.getUsername(),
@@ -66,11 +56,6 @@ class Userinfo extends BaseCommand {
value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"),
inline: true,
},
- // {
- // name: client.customEmojis.status[member.presence.status] + " " + interaction.translate("common:STATUS"),
- // value: interaction.translate(`common:STATUS_${member.presence.status.toUpperCase()}`),
- // inline: true,
- // },
{
name: client.customEmojis.bot + " " + interaction.translate("common:ROBOT"),
value: member.user.bot ? interaction.translate("common:YES") : interaction.translate("common:NO"),
@@ -78,12 +63,12 @@ class Userinfo extends BaseCommand {
},
{
name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"),
- value: client.functions.printDate(client, member.user.createdAt, null, interaction.getLocale()),
+ value: ``,
inline: true,
},
{
name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"),
- value: client.functions.printDate(client, member.joinedAt, null, interaction.getLocale()),
+ value: ``,
inline: true,
},
{
@@ -102,28 +87,8 @@ class Userinfo extends BaseCommand {
: member.roles.cache.size < 1 ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map(r => r).filter(r => r.id !== interaction.guild.roles.everyone.id).slice(0, 10).join(", "),
inline: true,
},
- ])
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
-
- /*
- if (member.presence.activities[0]?.name === "Custom Status") {
- embed.addFields([
- {
- name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"),
- value: member.presence.activities[0] ? `${interaction.translate("general/userinfo:CUSTOM")}\n${member.presence.activities[0].state || interaction.translate("common:NOT_DEFINED")}` : interaction.translate("general/userinfo:NO_ACTIVITY"),
- inline: true,
- },
- ]);
- } else {
- embed.addFields([
- {
- name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"),
- value: member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : interaction.translate("general/userinfo:NO_ACTIVITY"),
- inline: true,
- },
- ]);
- } */
+ ],
+ });
interaction.reply({
embeds: [embed],
diff --git a/commands/General/whois.js b/commands/General/whois.js
index 94dd76a3..25b7ee05 100644
--- a/commands/General/whois.js
+++ b/commands/General/whois.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch");
@@ -27,18 +27,11 @@ class Whois extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -53,15 +46,11 @@ class Whois extends BaseCommand {
if (whois.status === "fail") return interaction.editReply({ content: interaction.translate("general/whois:ERROR", { ip }) });
- const embed = new EmbedBuilder()
- .setTitle(
- interaction.translate("general/whois:INFO_ABOUT", {
- ip,
- }),
- )
- .setFooter(client.config.embed.footer)
- .setColor(client.config.embed.color)
- .addFields(
+ const embed = client.embed({
+ title: interaction.translate("general/whois:INFO_ABOUT", {
+ ip,
+ }),
+ fields: [
{ name: interaction.translate("common:IP"), value: whois.query, inline: true },
{ name: interaction.translate("general/whois:COUNTRY"), value: `${whois.country || interaction.translate("common:UNKNOWN")} (${whois.countryCode || interaction.translate("common:UNKNOWN")})`, inline: true },
{ name: interaction.translate("general/whois:REGION"), value: `${whois.regionName || interaction.translate("common:UNKNOWN")} (${whois.region || interaction.translate("common:UNKNOWN")})`, inline: true },
@@ -71,12 +60,12 @@ class Whois extends BaseCommand {
{ name: interaction.translate("general/whois:CONTINENT"), value: `${whois.continent || interaction.translate("common:UNKNOWN")} (${whois.continentCode || interaction.translate("common:UNKNOWN")})`, inline: true },
{ name: interaction.translate("general/whois:CURRENCY"), value: `${whois.currency || interaction.translate("common:UNKNOWN")}`, inline: true },
{ name: interaction.translate("general/whois:ISP"), value: `${whois.isp || interaction.translate("common:UNKNOWN")}`, inline: true },
- )
- .setTimestamp();
+ ],
+ });
- if (whois.proxy) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:PROXY") });
- if (whois.mobile) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:MOBILE") });
- if (whois.hosting) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:HOSTING") });
+ if (whois.proxy) embed.data.fields.push({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:PROXY") });
+ if (whois.mobile) embed.data.fields.push({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:MOBILE") });
+ if (whois.hosting) embed.data.fields.push({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:HOSTING") });
interaction.editReply({
embeds: [embed],
diff --git a/commands/IAT/checkjar.js b/commands/IAT/checkjar.js
index 50593a62..ec9c79ec 100644
--- a/commands/IAT/checkjar.js
+++ b/commands/IAT/checkjar.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch"),
moment = require("moment");
@@ -18,18 +18,11 @@ class Checkjar extends BaseCommand {
ru: client.translate("iat/checkjar:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -55,18 +48,16 @@ class Checkjar extends BaseCommand {
},
}).then(res => res.json());
- const embed = new EmbedBuilder()
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp()
- .setDescription(`Текущий баланс: **${jar.balance / Math.pow(10, 2)}** грн\nТребуется на след. месяц: **379,18** грн (по курсу евро на 02.07.2023).\nЗдесь указаны последние 10 транзакций.`);
+ const embed = client.embed({
+ description: `Текущий баланс: **${jar.balance / Math.pow(10, 2)}** грн\nТребуется на след. месяц: **379,18** грн (по курсу евро на 02.07.2023).\nЗдесь указаны последние 10 транзакций.`,
+ });
jarTransactions.length = 10;
jarTransactions.forEach(t => {
const time = moment.unix(t.time);
- embed.addFields([
+ embed.data.fields.push([
{
name: `${t.description}`,
value: `Дата: ${time.locale("uk-UA").format("DD MMMM YYYY, HH:mm")}\nСумма: ${t.amount / Math.pow(10, 2)} грн`,
diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js
index ee55d9d0..c1f2c7a7 100644
--- a/commands/Moderation/clear.js
+++ b/commands/Moderation/clear.js
@@ -45,18 +45,11 @@ class Clear extends BaseCommand {
ru: client.translate("common:USER_ID", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Moderation/clearwarns.js b/commands/Moderation/clearwarns.js
index 4f3bd91e..fbf09f97 100644
--- a/commands/Moderation/clearwarns.js
+++ b/commands/Moderation/clearwarns.js
@@ -27,18 +27,11 @@ class Clearwarns extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Moderation/giveaway.js b/commands/Moderation/giveaway.js
index 37565ed3..ad08246d 100644
--- a/commands/Moderation/giveaway.js
+++ b/commands/Moderation/giveaway.js
@@ -124,18 +124,11 @@ class Giveaway extends BaseCommand {
.setRequired(true),
),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Moderation/poll.js b/commands/Moderation/poll.js
index 1ed768f0..4e210d4a 100644
--- a/commands/Moderation/poll.js
+++ b/commands/Moderation/poll.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, PermissionsBitField } = require("discord.js");
+const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, PermissionsBitField } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Poll extends BaseCommand {
@@ -27,18 +27,11 @@ class Poll extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -95,12 +88,9 @@ class Poll extends BaseCommand {
const cool = client.emojis.cache.find(e => e.name === client.customEmojis.cool.split(":")[1]);
const notcool = client.emojis.cache.find(e => e.name === client.customEmojis.notcool.split(":")[1]);
- const embed = new EmbedBuilder()
- .setAuthor({
- name: interaction.translate("moderation/poll:TITLE"),
- })
- .setColor(client.config.embed.color)
- .addFields([
+ const embed = client.embed({
+ author: interaction.translate("moderation/poll:TITLE"),
+ fields: [
{
name: "\u200b",
value: question,
@@ -112,7 +102,8 @@ class Poll extends BaseCommand {
error: notcool.toString(),
}),
},
- ]);
+ ],
+ });
return interaction.channel.send({
content: mention,
diff --git a/commands/Moderation/unban.js b/commands/Moderation/unban.js
index 19f8128d..510e9514 100644
--- a/commands/Moderation/unban.js
+++ b/commands/Moderation/unban.js
@@ -27,18 +27,11 @@ class Unban extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Moderation/untimeout.js b/commands/Moderation/untimeout.js
index 2ecd855e..edf14a40 100644
--- a/commands/Moderation/untimeout.js
+++ b/commands/Moderation/untimeout.js
@@ -27,19 +27,11 @@ class Ban extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Moderation/warn.c.js b/commands/Moderation/warn.c.js
index 30680c83..ecd8d6e0 100644
--- a/commands/Moderation/warn.c.js
+++ b/commands/Moderation/warn.c.js
@@ -1,4 +1,4 @@
-const { ContextMenuCommandBuilder, ModalBuilder, EmbedBuilder, ActionRowBuilder, TextInputBuilder, ApplicationCommandType, PermissionsBitField, TextInputStyle } = require("discord.js");
+const { ContextMenuCommandBuilder, ModalBuilder, ActionRowBuilder, TextInputBuilder, ApplicationCommandType, PermissionsBitField, TextInputStyle } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class WarnContext extends BaseCommand {
@@ -13,18 +13,11 @@ class WarnContext extends BaseCommand {
.setType(ApplicationCommandType.User)
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -89,21 +82,25 @@ class WarnContext extends BaseCommand {
reason,
};
- const embed = new EmbedBuilder().addFields([
- {
- name: interaction.translate("common:USER"),
- value: `\`${member.user.getUsername()}\` (${member.user.toString()})`,
- },
- {
- name: interaction.translate("common:MODERATOR"),
- value: `\`${interaction.user.getUsername()}\` (${interaction.user.toString()})`,
- },
- {
- name: interaction.translate("common:REASON"),
- value: reason,
- inline: true,
- },
- ]);
+ const embed = client.embed({
+ author: interaction.translate("moderation/warn:WARN"),
+ fields: [
+ {
+ name: interaction.translate("common:USER"),
+ value: `\`${member.user.getUsername()}\` (${member.user.toString()})`,
+ },
+ {
+ name: interaction.translate("common:MODERATOR"),
+ value: `\`${interaction.user.getUsername()}\` (${interaction.user.toString()})`,
+ },
+ {
+ name: interaction.translate("common:REASON"),
+ value: reason,
+ inline: true,
+ },
+ ],
+ });
+
/*
if (banCount) {
if (sanctions >= banCount) {
@@ -163,22 +160,20 @@ class WarnContext extends BaseCommand {
}),
});
}
- }
- */
- member.send({
- content: interaction.translate("moderation/warn:WARNED_DM", {
- user: member.user.getUsername(),
- server: interaction.guild.name,
- moderator: interaction.user.getUsername(),
- reason,
- }),
- });
+ } */
- embed
- .setAuthor({
- name: interaction.translate("moderation/warn:WARN"),
- })
- .setColor(client.config.embed.color);
+ try {
+ await member.send({
+ content: interaction.translate("moderation/warn:WARNED_DM", {
+ user: member.user.getUsername(),
+ server: interaction.guild.name,
+ moderator: interaction.user.getUsername(),
+ reason,
+ }),
+ });
+ } catch (e) {
+ interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
+ }
memberData.sanctions.push(caseInfo);
diff --git a/commands/Moderation/warns.js b/commands/Moderation/warns.js
index 4274c846..75bb539d 100644
--- a/commands/Moderation/warns.js
+++ b/commands/Moderation/warns.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, PermissionsBitField, EmbedBuilder } = require("discord.js");
+const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Warns extends BaseCommand {
@@ -27,18 +27,11 @@ class Warns extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -54,34 +47,30 @@ class Warns extends BaseCommand {
guildId: interaction.guildId,
});
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: interaction.translate("moderation/warns:SANCTIONS_OF", {
member: member.user.getUsername(),
}),
iconURL: member.displayAvatarURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ },
+ });
if (memberData.sanctions.length === 0) {
- embed.setDescription(
- interaction.translate("moderation/warns:NO_SANCTIONS", {
- member: member.user.getUsername(),
- }),
- );
+ embed.data.description = interaction.translate("moderation/warns:NO_SANCTIONS", {
+ member: member.user.getUsername(),
+ });
+
return interaction.reply({
embeds: [embed],
});
} else {
memberData.sanctions.forEach(sanction => {
- embed.addFields([
- {
- name: sanction.type,
- value: `${interaction.translate("common:MODERATOR")}: <@${sanction.moderator}>\n${interaction.translate("common:REASON")}: ${sanction.reason}`,
- inline: true,
- },
- ]);
+ embed.data.fields.push({
+ name: sanction.type,
+ value: `${interaction.translate("common:MODERATOR")}: <@${sanction.moderator}>\n${interaction.translate("common:REASON")}: ${sanction.reason}`,
+ inline: true,
+ });
});
}
diff --git a/commands/Music/back.js b/commands/Music/back.js
index 57613179..87fa1eb0 100644
--- a/commands/Music/back.js
+++ b/commands/Music/back.js
@@ -16,18 +16,11 @@ class Back extends BaseCommand {
ru: client.translate("music/back:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Music/clips.js b/commands/Music/clips.js
index 55d8f9e9..32d391d1 100644
--- a/commands/Music/clips.js
+++ b/commands/Music/clips.js
@@ -29,18 +29,11 @@ class Clips extends BaseCommand {
.setRequired(true)
.setAutocomplete(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Music/loop.js b/commands/Music/loop.js
index b697cde1..f4ff743e 100644
--- a/commands/Music/loop.js
+++ b/commands/Music/loop.js
@@ -33,18 +33,11 @@ class Loop extends BaseCommand {
{ name: client.translate("music/loop:DISABLE"), value: "0" },
),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Music/nowplaying.js b/commands/Music/nowplaying.js
index fbe4856d..c43223cd 100644
--- a/commands/Music/nowplaying.js
+++ b/commands/Music/nowplaying.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, StringSelectMenuOptionBuilder } = require("discord.js"),
+const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, StringSelectMenuOptionBuilder } = require("discord.js"),
{ QueueRepeatMode } = require("discord-player");
const BaseCommand = require("../../base/BaseCommand");
@@ -17,11 +17,11 @@ class Nowplaying extends BaseCommand {
ru: client.translate("music/nowplaying:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -119,7 +119,7 @@ class Nowplaying extends BaseCommand {
ephemeral: true,
});
- // TODO: Fix collected if user doesnt send anything
+ // TODO Fix error in collected if user doesnt send anything
const filter = m => m.author.id === interaction.user.id && m.content.startsWith("http"),
collected = (await interaction.channel.awaitMessages({ filter, time: 10 * 1000, max: 1 })).first(),
query = collected.content.match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/g)[0],
@@ -180,6 +180,7 @@ class Nowplaying extends BaseCommand {
}
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -242,13 +243,10 @@ async function updateEmbed(interaction, queue) {
"0": interaction.translate("common:DISABLED"),
};
-
- const embed = new EmbedBuilder()
- .setAuthor({
- name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
- })
- .setThumbnail(track.thumbnail)
- .addFields([
+ const embed = interaction.client.embed({
+ author: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
+ thumbnail: track.thumbnail || null,
+ fields: [
{
name: interaction.translate("music/nowplaying:T_TITLE"),
value: `[${track.title}](${track.url})`,
@@ -278,10 +276,8 @@ async function updateEmbed(interaction, queue) {
name: "\u200b",
value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[mode]}\``,
},
- ])
- .setColor(interaction.client.config.embed.color)
- .setFooter(interaction.client.config.embed.footer)
- .setTimestamp();
+ ],
+ });
return embed;
}
diff --git a/commands/Music/play.c.js b/commands/Music/play.c.js
index d9832b76..4869abae 100644
--- a/commands/Music/play.c.js
+++ b/commands/Music/play.c.js
@@ -12,18 +12,11 @@ class PlayContext extends BaseCommand {
.setName("Add to Queue")
.setType(ApplicationCommandType.Message)
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Music/play.js b/commands/Music/play.js
index b040c6b2..6d29d9ab 100644
--- a/commands/Music/play.js
+++ b/commands/Music/play.js
@@ -1,4 +1,5 @@
-const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
+const { SlashCommandBuilder, PermissionsBitField } = require("discord.js"),
+ { QueryType } = require("discord-player");
const BaseCommand = require("../../base/BaseCommand");
class Play extends BaseCommand {
@@ -27,18 +28,11 @@ class Play extends BaseCommand {
.setRequired(true)
.setAutocomplete(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -61,7 +55,7 @@ class Play extends BaseCommand {
if (!searchResult.hasTracks()) return interaction.error("music/play:NO_RESULT", { query }, { edit: true });
else {
- const { queue } = await client.player.play(interaction.member.voice.channel, searchResult, {
+ await client.player.play(interaction.member.voice.channel, searchResult, {
nodeOptions: {
metadata: interaction,
},
@@ -78,13 +72,6 @@ class Play extends BaseCommand {
songName: searchResult.hasPlaylist() ? searchResult.playlist.title : searchResult.tracks[0].title,
}),
});
-
- // TODO: Seeks currently playing D:
- if (query.match(/&t=[[0-9]+/g) !== null) {
- const time = query.match(/&t=[[0-9]+/g)[0].split("=")[1];
-
- queue.node.seek(time * 1000);
- }
}
}
@@ -98,26 +85,35 @@ class Play extends BaseCommand {
const query = interaction.options.getString("query");
if (query === "") return;
- if (query.startsWith("http")) return interaction.respond([
- {
- name: "Current link",
- value: query,
- },
- ]);
+ if (query.startsWith("http"))
+ return interaction.respond([
+ {
+ name: "Current link",
+ value: query,
+ },
+ ]);
- const results = await client.player.search(query);
+ const youtubeResults = await client.player.search(query, { searchEngine: QueryType.YOUTUBE });
+ const spotifyResults = await client.player.search(query, { searchEngine: QueryType.SPOTIFY_SEARCH });
+ const tracks = [];
- return results.tracks.length > 0 ? await interaction.respond(
- results.tracks.slice(0, 10).map(track => ({
- name: (`${track.author} - ${track.title}`.length >= 100) & (`${track.author} - ${track.title}`.slice(0, 80) + "...") || `${track.author} - ${track.title}`,
- value: track.url,
- })),
- ) : await interaction.respond([
- {
- name: "Nothing",
- value: "Nothing",
- },
- ]);
+ youtubeResults.tracks
+ .slice(0, 5)
+ .map(t => ({
+ name: `YouTube: ${`${t.title} - ${t.author} (${t.duration})`.length > 75 ? `${`${t.title} - ${t.author}`.substring(0, 75)}... (${t.duration})` : `${t.title} - ${t.author} (${t.duration})`}`,
+ value: t.url,
+ }))
+ .forEach(t => tracks.push({ name: t.name, value: t.value }));
+
+ spotifyResults.tracks
+ .slice(0, 5)
+ .map(t => ({
+ name: `Spotify: ${`${t.title} - ${t.author} (${t.duration})`.length > 75 ? `${`${t.title} - ${t.author}`.substring(0, 75)}... (${t.duration})` : `${t.title} - ${t.author} (${t.duration})`}`,
+ value: t.url,
+ }))
+ .forEach(t => tracks.push({ name: t.name, value: t.value }));
+
+ return interaction.respond(tracks);
}
}
diff --git a/commands/Music/queue.js b/commands/Music/queue.js
index 0b110863..d49529a8 100644
--- a/commands/Music/queue.js
+++ b/commands/Music/queue.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
+const { SlashCommandBuilder, ActionRowBuilder, StringSelectMenuBuilder, StringSelectMenuOptionBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Queue extends BaseCommand {
@@ -16,11 +16,11 @@ class Queue extends BaseCommand {
ru: client.translate("music/queue:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -33,7 +33,7 @@ class Queue extends BaseCommand {
const queue = client.player.nodes.get(interaction.guildId);
if (!queue) return interaction.error("music/play:NOT_PLAYING");
- const { embeds, size } = generateQueueEmbeds(client, interaction, queue);
+ const { embeds, size } = generateQueueEmbeds(interaction, queue);
let currentPage = Number(interaction.message.content.match(/\d+/g)[0]) - 1 ?? 0;
@@ -114,6 +114,7 @@ class Queue extends BaseCommand {
}
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -124,7 +125,7 @@ class Queue extends BaseCommand {
const queue = client.player.nodes.get(interaction.guildId);
if (!queue) return interaction.error("music/play:NOT_PLAYING");
- const { embeds, size } = generateQueueEmbeds(client, interaction, queue),
+ const { embeds, size } = generateQueueEmbeds(interaction, queue),
row = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("queue_prev_page").setStyle(ButtonStyle.Primary).setEmoji("⬅️"),
new ButtonBuilder().setCustomId("queue_next_page").setStyle(ButtonStyle.Primary).setEmoji("➡️"),
@@ -148,12 +149,11 @@ class Queue extends BaseCommand {
/**
*
- * @param {import("../../base/Client")} client
* @param {import("discord.js").ChatInputCommandInteraction} interaction
* @param {import("discord-player").GuildQueue} queue
* @returns
*/
-function generateQueueEmbeds(client, interaction, queue) {
+function generateQueueEmbeds(interaction, queue) {
const embeds = [],
currentTrack = queue.currentTrack,
translated = {
@@ -166,16 +166,14 @@ function generateQueueEmbeds(client, interaction, queue) {
let k = 10;
if (!queue.tracks.size) {
- const embed = new EmbedBuilder()
- .setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING"))
- .setThumbnail(currentTrack.thumbnail)
- .setColor(interaction.client.config.embed.color)
- .setDescription(
- `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[queue.repeatMode]}\`\n${
- currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`
- }\n> ${interaction.translate("music/queue:ADDED")} ${currentTrack.requestedBy}\n\n**${interaction.translate("music/queue:NEXT")}**\n${interaction.translate("music/queue:NO_QUEUE")}`,
- )
- .setTimestamp();
+ const embed = interaction.client.embed({
+ title: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
+ thumbnail: currentTrack.thumbnail || null,
+ description: `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[queue.repeatMode]}\`\n${
+ currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`
+ }\n> ${interaction.translate("music/queue:ADDED")} ${currentTrack.requestedBy}\n\n**${interaction.translate("music/queue:NEXT")}**\n${interaction.translate("music/queue:NO_QUEUE")}`,
+ });
+
embeds.push(embed);
return { embeds: embeds, size: embeds.length };
@@ -188,19 +186,14 @@ function generateQueueEmbeds(client, interaction, queue) {
const info = current.map(track => `${++j}. ${track.url.startsWith("./clips") ? `${track.title} (clips)` : `[${track.title}](${track.url})`}\n> ${interaction.translate("music/queue:ADDED")} ${track.requestedBy}`).join("\n");
- const embed = new EmbedBuilder()
- .setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING"))
- .setThumbnail(currentTrack.thumbnail)
- .setColor(interaction.client.config.embed.color)
- .setDescription(
- `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[queue.repeatMode]}\`\n${
- currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`
- }\n * ${interaction.translate("music/queue:ADDED")} ${
- currentTrack.requestedBy
- }\n\n**${interaction.translate("music/queue:NEXT")}**\n${info}`,
- )
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ const embed = interaction.client.embed({
+ title: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
+ thumbnail: currentTrack.thumbnail || null,
+ description: `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[queue.repeatMode]}\`\n${
+ currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`
+ }\n * ${interaction.translate("music/queue:ADDED")} ${currentTrack.requestedBy}\n\n**${interaction.translate("music/queue:NEXT")}**\n${info}`,
+ });
+
embeds.push(embed);
}
diff --git a/commands/Music/seek.js b/commands/Music/seek.js
index 0c4705ac..84e3d0b6 100644
--- a/commands/Music/seek.js
+++ b/commands/Music/seek.js
@@ -25,18 +25,11 @@ class Seek extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Music/shuffle.js b/commands/Music/shuffle.js
index 613aa41f..5b1118c2 100644
--- a/commands/Music/shuffle.js
+++ b/commands/Music/shuffle.js
@@ -16,18 +16,11 @@ class Shuffle extends BaseCommand {
ru: client.translate("music/shuffle:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Music/skip.js b/commands/Music/skip.js
index 4b1f38b0..461abae8 100644
--- a/commands/Music/skip.js
+++ b/commands/Music/skip.js
@@ -16,18 +16,11 @@ class Skip extends BaseCommand {
ru: client.translate("music/skip:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Music/skipto.js b/commands/Music/skipto.js
index 2694701c..b4393a28 100644
--- a/commands/Music/skipto.js
+++ b/commands/Music/skipto.js
@@ -26,18 +26,11 @@ class Skipto extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Music/stop.js b/commands/Music/stop.js
index 0e12f78e..32e88605 100644
--- a/commands/Music/stop.js
+++ b/commands/Music/stop.js
@@ -16,18 +16,11 @@ class Stop extends BaseCommand {
ru: client.translate("music/stop:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Music/volume.js b/commands/Music/volume.js
index 45e4f75c..6013740b 100644
--- a/commands/Music/volume.js
+++ b/commands/Music/volume.js
@@ -27,18 +27,11 @@ class Volume extends BaseCommand {
.setRequired(true)
.setAutocomplete(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/!DISABLED/nsfw.js b/commands/NSFW/nsfw.js
similarity index 59%
rename from commands/!DISABLED/nsfw.js
rename to commands/NSFW/nsfw.js
index 676c90f6..9f986ac4 100644
--- a/commands/!DISABLED/nsfw.js
+++ b/commands/NSFW/nsfw.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js");
+const { SlashCommandBuilder, ActionRowBuilder, StringSelectMenuBuilder, AttachmentBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch");
@@ -17,11 +17,11 @@ class NSFW extends BaseCommand {
ru: client.translate("nsfw/nsfw:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -33,23 +33,24 @@ class NSFW extends BaseCommand {
if (interaction.customId === "nsfw_select") {
await interaction.deferUpdate();
- const tag = interaction?.values[0];
- const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json());
+ const tag = interaction?.values[0],
+ splitted = tag.split("_"),
+ res = await fetch(`https://nsfw-api-p302.onrender.com/media/${splitted[0].charAt(0).toLowerCase()}/${splitted[1].toLowerCase()}`).then(async r => await r.buffer()),
+ image = new AttachmentBuilder(res, { name: "image.jpeg" });
- const embed = new EmbedBuilder()
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTitle(res.title)
- .setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`)
- .setImage(res.url)
- .setTimestamp();
+ const embed = client.embed({
+ title: "xd",
+ image: "attachment://image.jpeg",
+ });
await interaction.editReply({
embeds: [embed],
+ files: [image],
});
}
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -59,23 +60,23 @@ class NSFW extends BaseCommand {
async execute(client, interaction) {
await interaction.deferReply({ ephemeral: true });
- if (interaction.guildId && !interaction.channel.nsfw) return interaction.replyT("misc:NSFW_COMMAND", null, { edit: true });
+ if (interaction.guildId && !interaction.channel.nsfw) return interaction.error("misc:NSFW_COMMAND", null, { edit: true, ephemeral: true });
- const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag =>
- JSON.parse(
- JSON.stringify({
- label: tag,
- value: tag,
- }),
- ),
- );
+ const tags = ["Hentai_Vanila", "Hentai_Yaoi", "Hentai_Yuri", "Hentai_BDSM", "Hentai_Trap", "Real_Ass", "Real_Boobs", "Real_Pussy"]
+ .map(tag =>
+ JSON.parse(
+ JSON.stringify({
+ label: `(${tag.split("_")[0]}) ${tag.split("_")[1]}`,
+ value: tag,
+ }),
+ ),
+ );
- const row = new ActionRowBuilder().addComponents(new StringSelectMenuBuilder().setCustomId("nsfw_select").setPlaceholder(interaction.translate("common:NOTHING_SELECTED")).addOptions(tags));
+ const row = new ActionRowBuilder().addComponents(new StringSelectMenuBuilder().setCustomId("nsfw_select").setPlaceholder(interaction.translate("common:NOTHING_SELECTED")).addOptions(tags.slice(0, 25)));
await interaction.editReply({
content: interaction.translate("common:AVAILABLE_OPTIONS"),
ephemeral: true,
- fetchReply: true,
components: [row],
});
}
diff --git a/commands/Owner/debug.js b/commands/Owner/debug.js
index b29135ac..21170d2a 100644
--- a/commands/Owner/debug.js
+++ b/commands/Owner/debug.js
@@ -108,18 +108,11 @@ class Debug extends BaseCommand {
.setRequired(true),
),
),
- aliases: [],
dirname: __dirname,
ownerOnly: true,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js
index e428fd5b..ecd66b20 100644
--- a/commands/Owner/eval.js
+++ b/commands/Owner/eval.js
@@ -26,18 +26,11 @@ class Eval extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: true,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Owner/reload.js b/commands/Owner/reload.js
index 7de5ed55..a96bc80b 100644
--- a/commands/Owner/reload.js
+++ b/commands/Owner/reload.js
@@ -29,18 +29,11 @@ class Reload extends BaseCommand {
.setRequired(true)
.setAutocomplete(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: true,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Owner/say.js b/commands/Owner/say.js
index 17411c85..13e9b41a 100644
--- a/commands/Owner/say.js
+++ b/commands/Owner/say.js
@@ -44,18 +44,11 @@ class Say extends BaseCommand {
ru: client.translate("common:ATTACHMENT", null, "ru-RU"),
}),
),
- aliases: [],
dirname: __dirname,
ownerOnly: true,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Owner/servers.js b/commands/Owner/servers.js
index 6ef89146..4d14cc80 100644
--- a/commands/Owner/servers.js
+++ b/commands/Owner/servers.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
+const { SlashCommandBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Servers extends BaseCommand {
@@ -16,18 +16,11 @@ class Servers extends BaseCommand {
ru: client.translate("owner/servers:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true),
- aliases: [],
dirname: __dirname,
ownerOnly: true,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
+
/**
*
* @param {import("../../base/Client")} client
@@ -128,12 +121,11 @@ function generateServersEmbeds(interaction, servers) {
)
.join("\n");
- const embed = new EmbedBuilder()
- .setTitle(interaction.translate("owner/servers:SERVERS_LIST"))
- .setDescription(info)
- .setColor(interaction.client.config.embed.color)
- .setFooter(interaction.client.config.embed.footer)
- .setTimestamp();
+ const embed = interaction.client.embed({
+ title: interaction.translate("owner/servers:SERVERS_LIST"),
+ Description: info,
+ });
+
embeds.push(embed);
}
diff --git a/commands/Tickets/adduser.js b/commands/Tickets/adduser.js
index 8a9247d0..3184cdf8 100644
--- a/commands/Tickets/adduser.js
+++ b/commands/Tickets/adduser.js
@@ -27,19 +27,11 @@ class AddUser extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
/**
*
* @param {import("../../base/Client")} client
diff --git a/commands/Tickets/closeticket.js b/commands/Tickets/closeticket.js
index 3689b738..3bae89b1 100644
--- a/commands/Tickets/closeticket.js
+++ b/commands/Tickets/closeticket.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, PermissionsBitField, EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require("discord.js");
+const { SlashCommandBuilder, PermissionsBitField, ButtonBuilder, ButtonStyle, ActionRowBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class CloseTicket extends BaseCommand {
@@ -17,19 +17,11 @@ class CloseTicket extends BaseCommand {
})
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
/**
*
* @param {import("../../base/Client")} client
@@ -41,10 +33,10 @@ class CloseTicket extends BaseCommand {
if (!interaction.channel.name.includes("support")) return interaction.error("tickets/adduser:NOT_TICKET", null, { ephemeral: true, edit: true });
- const embed = new EmbedBuilder()
- .setTitle(interaction.translate("tickets/closeticket:CLOSING_TITLE"))
- .setDescription(interaction.translate("tickets/closeticket:CLOSING_DESC"))
- .addFields(
+ const embed = client.embed({
+ title: interaction.translate("tickets/closeticket:CLOSING_TITLE"),
+ description: interaction.translate("tickets/closeticket:CLOSING_DESC"),
+ fields: [
{
name: interaction.translate("common:TICKET"),
value: interaction.channel.name,
@@ -53,10 +45,8 @@ class CloseTicket extends BaseCommand {
name: interaction.translate("tickets/closeticket:CLOSING_BY"),
value: interaction.user.getUsername(),
},
- )
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ ],
+ });
const button = new ButtonBuilder().setCustomId("cancel_closing").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Danger);
const row = new ActionRowBuilder().addComponents(button);
@@ -91,12 +81,10 @@ class CloseTicket extends BaseCommand {
if (ticketLogs) {
const logChannel = interaction.guild.channels.cache.get(ticketLogs);
- const logEmbed = new EmbedBuilder()
- .setTitle(interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE"))
- .setDescription(`${interaction.user.toString()} (${interaction.channel.toString()})`)
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ const logEmbed = client.embed({
+ title: interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE"),
+ description: `${interaction.user.toString()} (${interaction.channel.toString()})`,
+ });
logChannel.send({ embeds: [logEmbed] });
}
@@ -109,7 +97,7 @@ class CloseTicket extends BaseCommand {
files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
});
} catch (e) {
- await interaction.reply({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
+ interaction.reply({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
}
const member = interaction.guild.members.cache.find(u => u.user.id === interaction.channel.topic);
@@ -119,9 +107,9 @@ class CloseTicket extends BaseCommand {
});
const ticketLogs = data.guildData.plugins.tickets.ticketLogs;
- const logEmbed = new EmbedBuilder()
- .setTitle(interaction.translate("tickets/closeticket:CLOSED_TITLE"))
- .addFields(
+ const logEmbed = client.embed({
+ title: interaction.translate("tickets/closeticket:CLOSED_TITLE"),
+ fields: [
{
name: interaction.translate("common:TICKET"),
value: interaction.channel.name,
@@ -130,10 +118,8 @@ class CloseTicket extends BaseCommand {
name: interaction.translate("tickets/closeticket:CLOSING_BY"),
value: interaction.user.getUsername(),
},
- )
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ ],
+ });
if (ticketLogs) interaction.guild.channels.cache.get(ticketLogs).send({ embeds: [logEmbed] });
}
diff --git a/commands/Tickets/createticketembed.js b/commands/Tickets/createticketembed.js
index c66bccbb..6fe3dfbc 100644
--- a/commands/Tickets/createticketembed.js
+++ b/commands/Tickets/createticketembed.js
@@ -1,4 +1,4 @@
-const { SlashCommandBuilder, PermissionsBitField, EmbedBuilder, ButtonBuilder, ButtonStyle, ActionRowBuilder, ChannelType } = require("discord.js");
+const { SlashCommandBuilder, PermissionsBitField, ButtonBuilder, ButtonStyle, ActionRowBuilder, ChannelType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class CreateTicketEmbed extends BaseCommand {
@@ -17,7 +17,6 @@ class CreateTicketEmbed extends BaseCommand {
})
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
@@ -72,12 +71,10 @@ class CreateTicketEmbed extends BaseCommand {
});
const logChannel = interaction.guild.channels.cache.get(ticketLogs);
- const logEmbed = new EmbedBuilder()
- .setTitle(interaction.translate("tickets/createticketembed:TICKET_CREATED_TITLE"))
- .setDescription(`${interaction.user.toString()} (${channel.toString()})`)
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ const logEmbed = client.embed({
+ title: interaction.translate("tickets/createticketembed:TICKET_CREATED_TITLE"),
+ description: `${interaction.user.toString()} (${channel.toString()})`,
+ });
await logChannel.send({ embeds: [logEmbed] });
await interaction.success("tickets/createticketembed:TICKET_CREATED", {
@@ -86,13 +83,14 @@ class CreateTicketEmbed extends BaseCommand {
await channel.send(`<@${interaction.user.id}>`);
- const embed = new EmbedBuilder()
- .setTitle("Support Ticket")
- .setAuthor({ name: interaction.user.getUsername(), iconURL: interaction.user.displayAvatarURL() })
- .setDescription(interaction.translate("tickets/createticketembed:TICKET_CREATED_DESC"))
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ const embed = client.embed({
+ author: {
+ name: interaction.user.getUsername(),
+ iconURL: interaction.user.displayAvatarURL(),
+ },
+ title: "Support Ticket",
+ description: interaction.translate("tickets/createticketembed:TICKET_CREATED_DESC"),
+ });
const closeButton = new ButtonBuilder()
.setCustomId("close_ticket")
@@ -106,10 +104,10 @@ class CreateTicketEmbed extends BaseCommand {
await channel.send({ embeds: [embed], components: [row] });
} else if (button.customId === "close_ticket") {
- const embed = new EmbedBuilder()
- .setTitle(interaction.translate("tickets/closeticket:CLOSING_TITLE"))
- .setDescription(interaction.translate("tickets/closeticket:CLOSING_DESC"))
- .addFields(
+ const embed = client.embed({
+ title: interaction.translate("tickets/closeticket:CLOSING_TITLE"),
+ description: interaction.translate("tickets/closeticket:CLOSING_DESC"),
+ fields: [
{
name: interaction.translate("common:TICKET"),
value: interaction.channel.name,
@@ -118,10 +116,8 @@ class CreateTicketEmbed extends BaseCommand {
name: interaction.translate("tickets/closeticket:CLOSING_BY"),
value: interaction.user.getUsername(),
},
- )
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ ],
+ });
const button = new ButtonBuilder().setCustomId("cancel_closing").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Danger);
const row = new ActionRowBuilder().addComponents(button);
@@ -144,36 +140,37 @@ class CreateTicketEmbed extends BaseCommand {
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
const messages = Array.from(reversedMessages.values()).reverse();
- let transcript = "---- TICKET CREATED ----\n";
- messages.forEach(message => {
- transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`;
- });
- transcript += "---- TICKET CLOSED ----";
+ if (messages.length > 1) {
+ let transcript = "---- TICKET CREATED ----\n";
+ messages.forEach(message => {
+ transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`;
+ });
+ transcript += "---- TICKET CLOSED ----\n";
- if (transcriptionLogs !== null) interaction.guild.channels.cache.get(transcriptionLogs).send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }] });
+ if (transcriptionLogs !== null) interaction.guild.channels.cache.get(transcriptionLogs).send({ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }), files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }] });
+
+ try {
+ await interaction.user.send({
+ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: interaction.channel.name }),
+ files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
+ });
+ } catch (e) {
+ interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
+ }
+ }
const logChannel = interaction.guild.channels.cache.get(ticketLogs);
- const logEmbed = new EmbedBuilder()
- .setTitle(interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE"))
- .setDescription(`${interaction.user.toString()} (${interaction.channel.toString()})`)
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ const logEmbed = client.embed({
+ title: interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE"),
+ description: `${interaction.user.toString()} (${interaction.channel.toString()})`,
+ });
logChannel.send({ embeds: [logEmbed] });
interaction.channel.send("Closed!");
- try {
- await interaction.user.send({
- content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: interaction.channel.name }),
- files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
- });
- } catch (e) {
- await interaction.reply({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
- }
-
const member = interaction.guild.members.cache.find(u => u.user.id === interaction.channel.topic);
+
await interaction.channel.permissionOverwrites.edit(member, { ViewChannel: false, SendMessages: null });
await interaction.channel.setName(`${interaction.channel.name}-closed`);
}
@@ -184,24 +181,27 @@ class CreateTicketEmbed extends BaseCommand {
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
const messages = Array.from(reversedMessages.values()).reverse();
- let transcript = "---- TICKET CREATED ----\n";
- messages.forEach(message => {
- transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`;
- });
- transcript += "---- TICKET CLOSED ----";
-
- try {
- await interaction.user.send({
- content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }),
- files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
+ if (messages.length > 1) {
+ let transcript = "---- TICKET CREATED ----\n";
+ messages.forEach(message => {
+ transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`;
});
- } catch (error) {
- await interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
- }
+ transcript += "---- TICKET CLOSED ----\n";
+
+ try {
+ await interaction.user.send({
+ content: interaction.translate("tickets/closeticket:TRANSCRIPT", { channel: `<#${interaction.channelId}>` }),
+ files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
+ });
+ } catch (error) {
+ interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
+ }
+ } else return;
}
}
});
}
+
/**
*
* @param {import("../../base/Client")} client
@@ -213,11 +213,10 @@ class CreateTicketEmbed extends BaseCommand {
await interaction.deferReply({ ephemeral: true });
- const embed = new EmbedBuilder()
- .setTitle(interaction.translate("tickets/createticketembed:TICKET_TITLE"))
- .setDescription(interaction.translate("tickets/createticketembed:TICKET_DESC"))
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ const embed = client.embed({
+ title: interaction.translate("tickets/createticketembed:TICKET_TITLE"),
+ description: interaction.translate("tickets/createticketembed:TICKET_DESC"),
+ });
const supportButton = new ButtonBuilder().setCustomId("support_ticket").setLabel(interaction.translate("tickets/createticketembed:TICKET_SUPPORT")).setStyle(ButtonStyle.Primary);
const row = new ActionRowBuilder().addComponents(supportButton);
diff --git a/commands/Tickets/removeuser.js b/commands/Tickets/removeuser.js
index b91b711d..ddb31c7b 100644
--- a/commands/Tickets/removeuser.js
+++ b/commands/Tickets/removeuser.js
@@ -27,19 +27,11 @@ class RemoveUser extends BaseCommand {
})
.setRequired(true),
),
- aliases: [],
dirname: __dirname,
ownerOnly: false,
});
}
- /**
- *
- * @param {import("../../base/Client")} client
- */
- async onLoad() {
- //...
- }
/**
*
* @param {import("../../base/Client")} client
diff --git a/dashboard/dashboard.js b/dashboard/dashboard.js
index ec461f9c..d6a87a92 100644
--- a/dashboard/dashboard.js
+++ b/dashboard/dashboard.js
@@ -216,8 +216,8 @@ module.exports.load = async client => {
});
await Dashboard.init().then(() => {
- client.logger.log(`Dashboard launched on port ${client.config.dashboard.port}`, "ready");
+ client.logger.ready(`Dashboard launched on port ${client.config.dashboard.port}`);
}).catch(err => {
- client.logger.log(`Dashboard failed to initialize:\n${err}`, "error");
+ client.logger.error(`Dashboard failed to initialize:\n${err}`);
});
};
diff --git a/events/CommandHandler.js b/events/CommandHandler.js
index fd7c69da..8af21ed0 100644
--- a/events/CommandHandler.js
+++ b/events/CommandHandler.js
@@ -56,7 +56,7 @@ class CommandHandler extends BaseEvent {
interaction.user.send(args);
}
- client.logger.log(`User ${interaction.user.getUsername()} used ${command.command.name} in ${interaction.guild ? interaction.guild.name : "DM"} with arguments: ${interaction.options.data.length > 0 ? interaction.options.data.map(arg => { return `${arg.name}: ${arg.value}`; }).join(", ") : "no args" }`, "cmd");
+ client.logger.cmd(`User ${interaction.user.getUsername()} used ${command.command.name} in ${interaction.guild ? interaction.guild.name : "DM"} with arguments: ${interaction.options.data.length > 0 ? interaction.options.data.map(arg => { return `${arg.name}: ${arg.value}`; }).join(", ") : "no args" }`);
return command.execute(client, interaction, data);
}
diff --git a/events/Guild/guildBanAdd.js b/events/Guild/guildBanAdd.js
index 64ec9a78..c5feaa92 100644
--- a/events/Guild/guildBanAdd.js
+++ b/events/Guild/guildBanAdd.js
@@ -1,5 +1,4 @@
-const { EmbedBuilder } = require("discord.js"),
- BaseEvent = require("../../base/BaseEvent");
+const BaseEvent = require("../../base/BaseEvent");
class guildBanAdd extends BaseEvent {
constructor() {
@@ -15,18 +14,19 @@ class guildBanAdd extends BaseEvent {
* @param {import("discord.js").GuildBan} ban
*/
async execute(client, ban) {
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: client.user.getUsername(),
iconURL: ban.guild.iconURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setDescription(`You were banned from **${ban.guild.name}**!\nReason: **${ban.reason || "Not specified"}**`);
-
- ban.user.send({
- embeds: [embed],
+ },
+ description: `You were banned from **${ban.guild.name}**!\nReason: **${ban.reason || "Not specified"}**`,
});
+
+ try {
+ ban.user.send({
+ embeds: [embed],
+ });
+ } catch (e) { /**/ }
}
}
diff --git a/events/Guild/guildCreate.js b/events/Guild/guildCreate.js
index e1bce358..ff44c101 100644
--- a/events/Guild/guildCreate.js
+++ b/events/Guild/guildCreate.js
@@ -1,5 +1,4 @@
-const { EmbedBuilder } = require("discord.js"),
- BaseEvent = require("../../base/BaseEvent");
+const BaseEvent = require("../../base/BaseEvent");
class GuildCreate extends BaseEvent {
constructor() {
@@ -25,40 +24,40 @@ class GuildCreate extends BaseEvent {
await userData.save();
}
- const thanks = new EmbedBuilder()
- .setAuthor({
- name: "Thanks for inviting me to your server!",
- })
- .setDescription("Use in your server to get list of all commands!.")
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTimestamp();
+ const thanks = client.embed({
+ author: "Thanks for inviting me to your server!",
+ description: "Use in your server to get list of all commands!.",
+ });
- const owner = await guild.fetchOwner();
- owner.send({
- files: [
- {
- name: "unlocked.png",
- attachment: "./assets/img/achievements/achievement_unlocked7.png",
+ try {
+ const owner = await guild.fetchOwner();
+ owner.send({
+ files: [
+ {
+ name: "unlocked.png",
+ attachment: "./assets/img/achievements/achievement_unlocked7.png",
+ },
+ ],
+ embeds: [thanks],
+ });
+ } catch (e) { /**/ }
+
+ if (client.config.support.logs) {
+ const users = guild.members.cache.filter(m => !m.user.bot).size;
+ const bots = guild.members.cache.filter(m => m.user.bot).size;
+
+ const embed = client.embed({
+ author: {
+ name: guild.name,
+ iconURL: guild.iconURL(),
},
- ],
- embeds: [thanks],
- });
+ description: `Joined a new guild **${guild.name}**. It has **${users}** ${client.functions.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))} and **${bots}** ${client.functions.getNoun(bots, client.translate("misc:NOUNS:BOTS:1"), client.translate("misc:NOUNS:BOTS:2"), client.translate("misc:NOUNS:BOTS:5"))}`,
+ });
- const users = guild.members.cache.filter(m => !m.user.bot).size;
- const bots = guild.members.cache.filter(m => m.user.bot).size;
-
- const embed = new EmbedBuilder()
- .setAuthor({
- name: guild.name,
- iconURL: guild.iconURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${client.functions.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))} и **${bots}** ${client.functions.getNoun(bots, client.translate("misc:NOUNS:BOTS:1"), client.translate("misc:NOUNS:BOTS:2"), client.translate("misc:NOUNS:BOTS:5"))}`);
- client.channels.cache.get(client.config.support.logs).send({
- embeds: [embed],
- });
+ client.channels.cache.get(client.config.support.logs).send({
+ embeds: [embed],
+ });
+ }
}
}
diff --git a/events/Guild/guildDelete.js b/events/Guild/guildDelete.js
index 2065cf2c..c6013f3e 100644
--- a/events/Guild/guildDelete.js
+++ b/events/Guild/guildDelete.js
@@ -1,5 +1,4 @@
-const { EmbedBuilder } = require("discord.js"),
- BaseEvent = require("../../base/BaseEvent");
+const BaseEvent = require("../../base/BaseEvent");
class GuildDelete extends BaseEvent {
constructor() {
@@ -15,17 +14,19 @@ class GuildDelete extends BaseEvent {
* @param {import("discord.js").Guild} guild
*/
async execute(client, guild) {
- const embed = new EmbedBuilder()
- .setAuthor({
- name: guild.name,
- iconURL: guild.iconURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setDescription(`Вышел с сервера **${guild.name}**.`);
- client.channels.cache.get(client.config.support.logs).send({
- embeds: [embed],
- });
+ if (client.config.support.logs) {
+ const embed = client.embed({
+ author: {
+ name: guild.name,
+ iconURL: guild.iconURL(),
+ },
+ description: `Left from guild **${guild.name}**.`,
+ });
+
+ client.channels.cache.get(client.config.support.logs).send({
+ embeds: [embed],
+ });
+ }
}
}
diff --git a/events/MessageHandler.js b/events/MessageHandler.js
index 6b81931b..44b29ae1 100644
--- a/events/MessageHandler.js
+++ b/events/MessageHandler.js
@@ -1,4 +1,4 @@
-const { PermissionsBitField, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
+const { PermissionsBitField, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const BaseEvent = require("../base/BaseEvent");
const xpCooldown = {};
@@ -46,19 +46,19 @@ class MessageCreate extends BaseEvent {
messageId = ids[2];
const msg = await message.guild.channels.cache.get(channelId).messages.fetch(messageId);
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: message.translate("misc:QUOTE_TITLE", {
user: msg.author.getUsername(),
}),
iconURL: "https://wynem.com/assets/images/icons/quote.webp",
- })
- .setThumbnail(msg.author.displayAvatarURL())
- .setFooter({
+ },
+ thumbnail: msg.author.displayAvatarURL(),
+ footer: {
text: message.translate("misc:QUOTE_FOOTER", { user: message.author.getUsername() }),
- })
- .setColor(client.config.embed.color)
- .setTimestamp(msg.createdTimestamp);
+ },
+ timestamp: msg.createdTimestamp,
+ });
if (msg.content !== "") embed.addFields([
{
diff --git a/events/Monitoring/messageDelete.js b/events/Monitoring/messageDelete.js
index fdaf764e..445e7904 100644
--- a/events/Monitoring/messageDelete.js
+++ b/events/Monitoring/messageDelete.js
@@ -1,5 +1,4 @@
-const { EmbedBuilder } = require("discord.js"),
- BaseEvent = require("../../base/BaseEvent");
+const BaseEvent = require("../../base/BaseEvent");
class messageDelete extends BaseEvent {
constructor() {
@@ -21,15 +20,14 @@ class messageDelete extends BaseEvent {
const guildData = await client.findOrCreateGuild(message.guildId);
if (guildData.plugins?.monitoring?.messageDelete) {
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: message.author.getUsername(),
iconURL: message.author.displayAvatarURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTitle(`${message.author.getUsername()} deleted a message!`)
- .setDescription(`Message content was: \`\`\`${message.content}\`\`\``);
+ },
+ title: `${message.author.getUsername()} deleted a message!`,
+ description: `Message content was: \`\`\`${message.content}\`\`\``,
+ });
message.guild.channels.cache.get(guildData.plugins.monitoring.messageDelete).send({
embeds: [embed],
diff --git a/events/Monitoring/messageUpdate.js b/events/Monitoring/messageUpdate.js
index 61e80c51..e4bc058d 100644
--- a/events/Monitoring/messageUpdate.js
+++ b/events/Monitoring/messageUpdate.js
@@ -1,5 +1,4 @@
-const { EmbedBuilder } = require("discord.js"),
- BaseEvent = require("../../base/BaseEvent");
+const BaseEvent = require("../../base/BaseEvent");
class messageUpdate extends BaseEvent {
constructor() {
@@ -24,15 +23,14 @@ class messageUpdate extends BaseEvent {
const guildData = await client.findOrCreateGuild(oldMessage.guildId);
if (guildData.plugins?.monitoring?.messageUpdate) {
- const embed = new EmbedBuilder()
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: newMessage.author.getUsername(),
iconURL: newMessage.author.displayAvatarURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .setTitle(`${newMessage.author.getUsername()} edited a message!`)
- .setDescription(`Old Message: \`\`\`${oldMessage.content}\`\`\`\nNew Message: \`\`\`${newMessage.content}\`\`\`\nJump to message: ${newMessage.url}`);
+ },
+ title: `${newMessage.author.getUsername()} edited a message!`,
+ description: `Old Message: \`\`\`${oldMessage.content}\`\`\`\nNew Message: \`\`\`${newMessage.content}\`\`\`\nJump to message: ${newMessage.url}`,
+ });
newMessage.guild.channels.cache.get(guildData.plugins.monitoring.messageUpdate).send({
embeds: [embed],
diff --git a/events/ready.js b/events/ready.js
index ec4fdeb5..96bc66b9 100644
--- a/events/ready.js
+++ b/events/ready.js
@@ -1,4 +1,4 @@
-const { PermissionsBitField, ActivityType } = require("discord.js");
+const { ActivityType } = require("discord.js");
const BaseEvent = require("../base/BaseEvent");
class Ready extends BaseEvent {
@@ -31,9 +31,8 @@ class Ready extends BaseEvent {
if (client.config.dashboard.enabled) await client.dashboard.load(client);
- client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready");
- client.logger.log(`${client.user.getUsername()}, ready to serve ${tUsers} members in ${tServers} servers.`, "ready");
- client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [PermissionsBitField.Flags.Administrator] })}`, "ready");
+ client.logger.ready(`Loaded a total of ${commands.length} command(s).`);
+ client.logger.ready(`${client.user.getUsername()}, ready to serve ${tUsers} members in ${tServers} servers.`);
console.timeEnd("botReady");
diff --git a/helpers/autoUpdateDocs.js b/helpers/autoUpdateDocs.js
index 950181a0..ca5a6d5a 100644
--- a/helpers/autoUpdateDocs.js
+++ b/helpers/autoUpdateDocs.js
@@ -16,13 +16,6 @@ module.exports.update = function (client) {
let text = `# JaBa has **${commands.length} ${client.functions.getNoun(commands.length, "command", "commands", "commands")}** in **${categories.length} ${client.functions.getNoun(categories.length, "category", "categories", "categories")}**! \n\n#### Table content \n**Name**: Command name \n**Description**: Command description \n**Usage**: How to use the command (*[]* - required, *()* - optional) \n**Accessible in**: Where you can use the command \n\n`;
- // categories.sort(function(a, b) {
- // const aCmdsSize = commands.filter(cmd => cmd.category === a).size;
- // const bCmdsSize = commands.filter(cmd => cmd.category === b).size;
- // if (aCmdsSize > bCmdsSize) return -1;
- // else return 1;
- // })
-
categories.sort().forEach(cat => {
const categoriesArray = [["Name", "Description", "Usage", "Accessible in"]];
const cmds = [...new Map(commands.filter(cmd => cmd.category === cat).map(v => [v.constructor.name, v])).values()];
@@ -33,10 +26,10 @@ module.exports.update = function (client) {
else return 1;
}).forEach(cmd => {
categoriesArray.push([
- `**${cmd.command.name}** ${cmd.aliases.length ? `**(${cmd.aliases.join(", ")})**` : ""}`,
+ `**${cmd.command.name}**`,
client.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`),
`${cmd.command.name} ${client.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`).replace(/\n/, " \\| ")}`,
- cmd.command.dm_permission ? "Servers/DMs" : "Only on servers",
+ cmd.command.dm_permission ? "Anywhere" : "Servers only",
]);
});
text += `${table(categoriesArray)}\n\n`;
@@ -44,5 +37,6 @@ module.exports.update = function (client) {
if (!fs.existsSync("./dashboard/public/docs")) fs.mkdirSync("./dashboard/public/docs");
fs.writeFileSync("./dashboard/public/docs/commands.md", text);
+
client.logger.log("Dashboard docs updated!");
};
diff --git a/helpers/birthdays.js b/helpers/birthdays.js
index 13012299..9a00210c 100644
--- a/helpers/birthdays.js
+++ b/helpers/birthdays.js
@@ -1,11 +1,10 @@
-const { CronJob } = require("cron"),
- { EmbedBuilder } = require("discord.js");
+const { CronJob } = require("cron");
/**
*
* @param {import("../base/Client")} client
*/
-module.exports.init = async function (client) {
+module.exports.init = async client => {
const cronjob = new CronJob("0 5 * * *", async function () {
client.guilds.cache.forEach(async guild => {
const guildData = await client.findOrCreateGuild(guild.id);
@@ -22,35 +21,34 @@ module.exports.init = async function (client) {
for (const user of users) {
if (!guild.members.cache.find(m => m.id === user.id)) return;
- const userDate = new Date(user.birthdate),
+ const userDate = new Date(user.birthdate * 1000),
day = userDate.getDate(),
month = userDate.getMonth(),
year = userDate.getFullYear(),
age = currentYear - year;
if (currentMonth === month && currentDay === day) {
- const embed = new EmbedBuilder()
- .setAuthor({
- name: client.user.getUsername(),
- iconURL: client.user.displayAvatarURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .addFields([
+ const embed = client.embed({
+ author: client.user.getUsername(),
+ fields: [
{
name: client.translate("economy/birthdate:HAPPY_BIRTHDAY", null, guildData.language),
value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", {
- name: user.username,
user: user.id,
- age: `**${age}** ${client.functions.getNoun(age, client.translate("misc:NOUNS:AGE:1", null, guildData.language), client.translate("misc:NOUNS:AGE:2", null, guildData.language), client.translate("misc:NOUNS:AGE:5", null, guildData.language))}`,
+ age: `**${age}** ${client.functions.getNoun(
+ age,
+ client.translate("misc:NOUNS:AGE:1", null, guildData.language),
+ client.translate("misc:NOUNS:AGE:2", null, guildData.language),
+ client.translate("misc:NOUNS:AGE:5", null, guildData.language),
+ )}`,
}, guildData.language),
},
- ]);
-
- const msg = await channel.send({
- embeds: [embed],
+ ],
});
- await msg.react("🎉");
+
+ channel.send({
+ embeds: [embed],
+ }).then(m => m.react("🎉"));
}
}
});
@@ -65,7 +63,7 @@ module.exports.init = async function (client) {
cronjob.start();
};
-module.exports.run = async function (client) {
+module.exports.run = async client => {
client.guilds.cache.forEach(async guild => {
const guildData = await client.findOrCreateGuild(guild.id);
@@ -88,28 +86,27 @@ module.exports.run = async function (client) {
age = currentYear - year;
if (currentMonth === month && currentDay === day) {
- const embed = new EmbedBuilder()
- .setAuthor({
- name: client.user.getUsername(),
- iconURL: client.user.displayAvatarURL(),
- })
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer)
- .addFields([
+ const embed = client.embed({
+ author: client.user.getUsername(),
+ fields: [
{
name: client.translate("economy/birthdate:HAPPY_BIRTHDAY", null, guildData.language),
value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", {
- name: user.username,
user: user.id,
- age: `**${age}** ${client.functions.getNoun(age, client.translate("misc:NOUNS:AGE:1", null, guildData.language), client.translate("misc:NOUNS:AGE:2", null, guildData.language), client.translate("misc:NOUNS:AGE:5", null, guildData.language))}`,
+ age: `**${age}** ${client.functions.getNoun(
+ age,
+ client.translate("misc:NOUNS:AGE:1", null, guildData.language),
+ client.translate("misc:NOUNS:AGE:2", null, guildData.language),
+ client.translate("misc:NOUNS:AGE:5", null, guildData.language),
+ )}`,
}, guildData.language),
},
- ]);
-
- const msg = await channel.send({
- embeds: [embed],
+ ],
});
- await msg.react("🎉");
+
+ channel.send({
+ embeds: [embed],
+ }).then(m => m.react("🎉"));
}
}
});
diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js
index da7beb67..0a4d5962 100644
--- a/helpers/checkReminds.js
+++ b/helpers/checkReminds.js
@@ -1,4 +1,3 @@
-const { EmbedBuilder } = require("discord.js");
const moment = require("moment");
/**
@@ -25,11 +24,9 @@ module.exports.init = function (client) {
if (mustSent.length > 0) {
mustSent.forEach(r => {
- const embed = new EmbedBuilder()
- .setAuthor({
- name: client.translate("general/remindme:EMBED_TITLE"),
- })
- .addFields([
+ const embed = client.embed({
+ author: client.translate("general/remindme:EMBED_TITLE"),
+ fields: [
{
name: client.translate("general/remindme:EMBED_CREATED"),
value: moment(r.createdAt).locale(client.defaultLanguage).format("Do MMMM YYYY, HH:mm:ss"),
@@ -44,14 +41,14 @@ module.exports.init = function (client) {
name: client.translate("common:MESSAGE"),
value: r.message,
},
- ])
- .setColor(client.config.embed.color)
- .setFooter(client.config.embed.footer);
+ ],
+ });
cachedUser.send({
embeds: [embed],
});
});
+
user.reminds = user.reminds.filter(r => r.sendAt >= dateNow);
user.markModified("reminds");
diff --git a/helpers/functions.js b/helpers/functions.js
index 6e6fd4e4..c8e0596c 100644
--- a/helpers/functions.js
+++ b/helpers/functions.js
@@ -1,4 +1,3 @@
-const { PermissionsBitField, ChannelType } = require("discord.js");
const moment = require("moment");
moment.relativeTimeThreshold("ss", 5);
@@ -9,20 +8,6 @@ moment.relativeTimeThreshold("d", 24);
moment.relativeTimeThreshold("M", 12);
module.exports = {
- /**
- * Creates Invite Link to The Guild
- * @param {import("../base/Client")} client Discord Client
- * @param {String} guildId ID of The Guild
- * @returns {String} Invite Link to This Guild
- */
- async createInvite(client, guildId) {
- const guild = client.guilds.cache.get(guildId),
- member = guild.members.me,
- channel = guild.channels.cache.find(ch => (ch.permissionsFor(member.id).has(PermissionsBitField.Flags.CreateInstantInvite) && ch.type === ChannelType.GuildText) || ch.type === "GUILD_VOICE");
-
- if (channel) return (await channel.createInvite()).url || "No channels found or missing permissions";
- },
-
/**
* Calls a Callback for Each Element in Collection Asynchronously
* @param {Array} collection Collection
diff --git a/helpers/logger.js b/helpers/logger.js
index 3962121e..3414cde8 100644
--- a/helpers/logger.js
+++ b/helpers/logger.js
@@ -26,35 +26,39 @@ function format(tDate) {
}
module.exports = class Logger {
- static log(content, type = "log") {
+ static log(content) {
const date = `[${format(new Date(Date.now()))}]:`;
- switch (type) {
- case "log": {
- return console.log(`${date} ${bgBlue(type.toUpperCase())} ${content} `);
- }
- case "warn": {
- return console.log(`${date} ${black.bgYellow(type.toUpperCase())} ${content} `);
- }
+ return console.log(`${date} ${bgBlue("LOG")} ${content}`);
+ }
- case "error": {
- return console.log(`${date} ${black.bgRed(type.toUpperCase())} ${content} `);
- }
+ static warn(content) {
+ const date = `[${format(new Date(Date.now()))}]:`;
- case "debug": {
- return console.log(`${date} ${green(type.toUpperCase())} ${content} `);
- }
+ return console.log(`${date} ${black.bgYellow("WARN")} ${content}`);
+ }
- case "cmd": {
- return console.log(`${date} ${black.bgWhite(type.toUpperCase())} ${content}`);
- }
+ static error(content) {
+ const date = `[${format(new Date(Date.now()))}]:`;
- case "ready": {
- return console.log(`${date} ${black.bgGreen(type.toUpperCase())} ${content}`);
- }
+ return console.log(`${date} ${black.bgRed("ERROR")} ${content}`);
+ }
- default:
- throw new TypeError("Logger type must be either warn, debug, log, ready, cmd or error.");
- }
+ static debug(content) {
+ const date = `[${format(new Date(Date.now()))}]:`;
+
+ return console.log(`${date} ${green("DEBUG")} ${content}`);
+ }
+
+ static cmd(content) {
+ const date = `[${format(new Date(Date.now()))}]:`;
+
+ return console.log(`${date} ${black.bgWhite("CMD")} ${content}`);
+ }
+
+ static ready(content) {
+ const date = `[${format(new Date(Date.now()))}]:`;
+
+ return console.log(`${date} ${black.bgGreen("READY")} ${content}`);
}
};
diff --git a/helpers/mee6-api.js b/helpers/mee6-api.js
index a90a00f7..3d8791d1 100644
--- a/helpers/mee6-api.js
+++ b/helpers/mee6-api.js
@@ -1,6 +1,6 @@
/* eslint-disable no-constant-condition */
-
// Thanks to mee6-levels-api =)
+
const fetch = require("node-fetch");
const fetchMee6 = async args => {
diff --git a/helpers/tictactoe.js b/helpers/tictactoe.js
index 63e78d91..d5730587 100644
--- a/helpers/tictactoe.js
+++ b/helpers/tictactoe.js
@@ -1,21 +1,27 @@
// Thanks to simply-djs for this =)
-const { EmbedBuilder, ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } = require("discord.js");
+const { ButtonBuilder, ActionRowBuilder, ButtonStyle, ComponentType } = require("discord.js");
/**
* @param {import("discord.js").ChatInputCommandInteraction} interaction
* @param {Array} options
- */
-/**
- slash => Boolean
- userSlash => String
- resultBtn => Boolean
- embedFoot => String
- embedColor => HexColor
- timeoutEmbedColor => HexColor
- xEmoji => (Emoji ID) String
- oEmoji => (Emoji ID) String
- idleEmoji => (Emoji ID) String
+ * slash => Boolean
+ *
+ * userSlash => String
+ *
+ * resultBtn => Boolean
+ *
+ * embedFoot => String
+ *
+ * embedColor => HexColor
+ *
+ * timeoutEmbedColor => HexColor
+ *
+ * xEmoji => (Emoji ID) String
+ *
+ * oEmoji => (Emoji ID) String
+ *
+ * idleEmoji => (Emoji ID) String
*/
async function tictactoe(interaction, options = {}) {
// eslint-disable-next-line no-async-promise-executor
@@ -64,22 +70,21 @@ async function tictactoe(interaction, options = {}) {
});
}
- const foot = options.embedFoot ? options.embedFoot : { text: "GLHF" },
+ const footer = options.embedFoot ? options.embedFoot : { text: "GLHF" },
+ color = options.embedColor || "#075FFF",
user = interaction.user ? interaction.user : interaction.author;
- const acceptEmbed = new EmbedBuilder()
- .setTitle(
- interaction.translate("fun/tictactoe:REQUEST_WAIT", {
- user: opponent.getUsername(),
- }),
- )
- .setAuthor({
+ const acceptEmbed = client.embed({
+ author: {
name: user.getUsername(),
iconURL: user.displayAvatarURL(),
- })
- .setColor(options.embedColor || "#075FFF")
- .setFooter(foot)
- .setTimestamp();
+ },
+ title: interaction.translate("fun/tictactoe:REQUEST_WAIT", {
+ user: opponent.getUsername(),
+ }),
+ color,
+ footer,
+ });
const accept = new ButtonBuilder().setLabel(interaction.translate("common:ACCEPT")).setStyle(ButtonStyle.Success).setCustomId("acceptttt");
const decline = new ButtonBuilder().setLabel(interaction.translate("common:DECLINE")).setStyle(ButtonStyle.Danger).setCustomId("declinettt");
@@ -179,11 +184,11 @@ async function tictactoe(interaction, options = {}) {
},
};
- const epm = new EmbedBuilder()
- .setTitle(interaction.translate("fun/tictactoe:DESCRIPTION"))
- .setColor(options.embedColor || "#075FFF")
- .setFooter(foot)
- .setTimestamp();
+ const epm = client.embed({
+ title: interaction.translate("fun/tictactoe:DESCRIPTION"),
+ color,
+ footer,
+ });
let msg;
if (interaction.commandId)
@@ -592,16 +597,17 @@ async function tictactoe(interaction, options = {}) {
collector.on("end", (_, reason) => {
if (reason == "time") {
- const embed = new EmbedBuilder()
- .setTitle(interaction.translate("fun/tictactoe:NO_ANSWER_TITLE"))
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: user.getUsername(),
iconURL: user.displayAvatarURL(),
- })
- .setColor(options.timeoutEmbedColor || "#C90000")
- .setFooter(foot)
- .setTimestamp()
- .setDescription(interaction.translate("misc:TIMED_OUT"));
+ },
+ title: interaction.translate("fun/tictactoe:NO_ANSWER_TITLE"),
+ description: interaction.translate("misc:TIMED_OUT"),
+ color: options.timeoutEmbedColor || "#C90000",
+ footer,
+ });
+
m.interaction.editReply({
content: interaction.translate("fun/tictactoe:NOT_ANSWERED", {
user: opponent.id,
@@ -611,20 +617,19 @@ async function tictactoe(interaction, options = {}) {
});
}
if (reason == "decline") {
- const embed = new EmbedBuilder()
- .setTitle(interaction.translate("fun/tictactoe:CANCELED"))
- .setAuthor({
+ const embed = client.embed({
+ author: {
name: user.getUsername(),
iconURL: user.displayAvatarURL(),
- })
- .setColor(options.timeoutEmbedColor || "#C90000")
- .setFooter(foot)
- .setTimestamp()
- .setDescription(
- interaction.translate("fun/tictactoe:CANCELED_DESC", {
- user: opponent.id,
- }),
- );
+ },
+ title: interaction.translate("fun/tictactoe:CANCELED"),
+ description: interaction.translate("fun/tictactoe:CANCELED_DESC", {
+ user: opponent.id,
+ }),
+ color: options.timeoutEmbedColor || "#C90000",
+ footer,
+ });
+
m.interaction.editReply({
embeds: [embed],
components: [],
diff --git a/index.js b/index.js
index 10f3d0b2..3612456b 100644
--- a/index.js
+++ b/index.js
@@ -18,9 +18,12 @@ const client = new Client({
await client.init();
})();
-client.on("disconnect", () => client.logger.log("Bot is disconnecting...", "warn"))
- .on("reconnecting", () => client.logger.log("Bot reconnecting...", "warn"))
- .on("warn", warn => client.logger.log(warn, "warn"))
- .on("error", e => client.logger.log(`${e.message}\n${e.stack}`, "error"));
-process.on("unhandledRejection", e => console.log(e));
-process.on("uncaughtException", e => console.log(e));
\ No newline at end of file
+client
+ .on("disconnect", () => client.logger.warn("Bot is disconnecting..."))
+ .on("reconnecting", () => client.logger.warn("Bot reconnecting..."))
+ .on("warn", warn => client.logger.warn(warn))
+ .on("error", e => client.logger.error(`${e.message}\n${e.stack}`));
+
+process
+ .on("unhandledRejection", e => console.log(e))
+ .on("uncaughtException", e => console.log(e));
\ No newline at end of file
diff --git a/languages/en-US/general/help.json b/languages/en-US/general/help.json
index f206e477..d19c522e 100644
--- a/languages/en-US/general/help.json
+++ b/languages/en-US/general/help.json
@@ -6,9 +6,7 @@
"COMMANDS_IN": "Available commands in category \"{{category}}\":",
"FIELD_USAGE": "Usage",
"FIELD_DESCRIPTION": "Description",
- "FIELD_ALIASES": "Aliases",
"FIELD_EXAMPLES": "Examples",
- "NO_ALIAS": "No aliases",
"CMD_TITLE": "Help for {{cmd}}",
"INFO": "● To get help for a specific command, use `/help [command:command_name]`",
"FIELD_PERMISSIONS": "Required Permissions",
diff --git a/languages/en-US/general/stats.json b/languages/en-US/general/stats.json
index 8c88798f..c90e3a6e 100644
--- a/languages/en-US/general/stats.json
+++ b/languages/en-US/general/stats.json
@@ -7,7 +7,7 @@
"VERSIONS_TITLE": "• __Used__",
"RAM_TITLE": "• __RAM Usage__",
"ONLINE_TITLE": "• __Online__",
- "ONLINE_CONTENT": "Been online for {{time}}",
+ "ONLINE_CONTENT": "Was started {{time}}",
"MUSIC_TITLE": "• __Music__",
"MUSIC_CONTENT": "Playing music on {{count}}",
"CREDITS_TITLE": ":heart: • __Additional Information__",
diff --git a/languages/ru-RU/general/help.json b/languages/ru-RU/general/help.json
index 581e542c..06f7d5a5 100644
--- a/languages/ru-RU/general/help.json
+++ b/languages/ru-RU/general/help.json
@@ -6,9 +6,7 @@
"COMMANDS_IN": "Доступные команды в категории \"{{category}}\":",
"FIELD_USAGE": "Использование",
"FIELD_DESCRIPTION": "Описание",
- "FIELD_ALIASES": "Сокращения",
"FIELD_EXAMPLES": "Примеры",
- "NO_ALIAS": "Нет сокращений",
"CMD_TITLE": "Помощь по {{cmd}}",
"INFO": "● Чтобы получить помощь по определённой команде используйте `/help [command:command_name]`",
"FIELD_PERMISSIONS": "Необходимые права",
diff --git a/languages/ru-RU/general/stats.json b/languages/ru-RU/general/stats.json
index 62fef3ee..553b4973 100644
--- a/languages/ru-RU/general/stats.json
+++ b/languages/ru-RU/general/stats.json
@@ -7,7 +7,7 @@
"VERSIONS_TITLE": "• __Используется__",
"RAM_TITLE": "• __Использование ОЗУ__",
"ONLINE_TITLE": "• __Онлайн__",
- "ONLINE_CONTENT": "Работаю уже {{time}}",
+ "ONLINE_CONTENT": "Был запущен {{time}}",
"MUSIC_TITLE": "• __Музыка__",
"MUSIC_CONTENT": "Играю музыку на {{count}}",
"CREDITS_TITLE": ":heart: • __Доп. информация__",
diff --git a/languages/uk-UA/general/help.json b/languages/uk-UA/general/help.json
index c04d268f..bb163e0d 100644
--- a/languages/uk-UA/general/help.json
+++ b/languages/uk-UA/general/help.json
@@ -6,9 +6,7 @@
"COMMANDS_IN": "Доступні команди в категорії `{{category}}`:",
"FIELD_USAGE": "Використання",
"FIELD_DESCRIPTION": "Опис",
- "FIELD_ALIASES": "Скорочення",
"FIELD_EXAMPLES": "Приклади",
- "NO_ALIAS": "Немає скорочень",
"CMD_TITLE": "Допомога з {{cmd}}",
"INFO": "● Щоб отримати допомогу по певній команді, використовуйте `/help [command:command_name]`",
"FIELD_PERMISSIONS": "Необхідні права",
diff --git a/languages/uk-UA/general/stats.json b/languages/uk-UA/general/stats.json
index fa93e2dc..0430b1a7 100644
--- a/languages/uk-UA/general/stats.json
+++ b/languages/uk-UA/general/stats.json
@@ -7,7 +7,7 @@
"VERSIONS_TITLE": "• __Використовується__",
"RAM_TITLE": "• __Використання ОЗУ__",
"ONLINE_TITLE": "• __Онлайн__",
- "ONLINE_CONTENT": "Працюю вже {{time}}",
+ "ONLINE_CONTENT": "Був запущений {{time}}",
"MUSIC_TITLE": "• __Музика__",
"MUSIC_CONTENT": "Граю музику на {{count}}",
"CREDITS_TITLE": ":heart: • __Додаткова інформація__",
diff --git a/package.json b/package.json
index 192d1b12..f31b5bc5 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jaba",
- "version": "4.4.1",
+ "version": "4.4.2",
"description": "My Discord Bot",
"main": "index.js",
"scripts": {