This commit is contained in:
Jonny_Bro (Nikita) 2024-02-06 21:45:53 +05:00
parent 20b438fb5d
commit 70a37c9ea0
No known key found for this signature in database
GPG key ID: 391C19BE62D36B33
111 changed files with 1001 additions and 1679 deletions

View file

@ -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://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://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)<br> [![](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)<br>
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** команды! * 👑 **Команды владельца**: `eval`, `getinvite`, `servers-list` и ещё **2** команды!
> [!NOTE] > [!NOTE]
> [Список изменений](/dashboard/docs/updates.md)\ > [Список изменений](https://blog.jababot.ru)\
> [Полный список команд](http://jababot.ru:8080/commands) > [Полный список команд](https://dash.jababot.ru/commands)
## *Относительно* мощная панель управления ## *Относительно* мощная панель управления
У JaBa есть своя панель управления с доступом к настройке параметров сервера! У JaBa есть своя панель управления с доступом к настройке параметров сервера!
<!-- <img align="left" style="float: centrer; margin: 0 10px 0 0;" src="https://example.com" height="200" width="350"/>
<img align="center" style="float: left; margin: 0 10px 0 0;" src="https://example.com" height="200" width="350"/>
<img align="center" style="float: centrer; margin: 0 10px 0 0;" src="https://example.com" height="200" width="350"/> -->
## Установка ## Установка
@ -57,11 +54,11 @@ JaBa имеет множество функций, вот **8 основных
## Ссылки ## Ссылки
* [Список команд](http://jababot.ru:8080/commands) * [Список команд](https://dash.jababot.ru/commands)
* [Инструкция по установке](https://github.com/JonnyBro/JaBa/wiki/Установка-JaBa-на-своей-машине) * [Инструкция по установке](https://github.com/JonnyBro/JaBa/wiki/Self-Hosting)
* [Discord](https://discord.gg/Ptkj2n9nzZ) * [Discord](https://discord.gg/Ptkj2n9nzZ)
* [Github](https://github.com/JonnyBro/JaBa/) * [Github](https://github.com/JonnyBro/JaBa/)
* [Панель управления](http://jababot.ru) * [Панель управления](https://dash.jababot.ru)
## Поддержка ## Поддержка

View file

@ -7,10 +7,6 @@ class BaseCommand {
* @type {import("discord.js").SlashCommandBuilder | import("discord.js").ContextMenuCommandBuilder | import("discord.js").ApplicationCommandData} * @type {import("discord.js").SlashCommandBuilder | import("discord.js").ContextMenuCommandBuilder | import("discord.js").ApplicationCommandData}
*/ */
this.command = options.command; this.command = options.command;
/**
* @type {Array<String>}
*/
this.aliases = options.aliases || [];
/** /**
* @type {Boolean} * @type {Boolean}
*/ */

View file

@ -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"), { Player } = require("discord-player"),
{ GiveawaysManager } = require("discord-giveaways"), { GiveawaysManager } = require("discord-giveaways"),
{ REST } = require("@discordjs/rest"), { REST } = require("@discordjs/rest"),
@ -13,6 +13,7 @@ const BaseEvent = require("./BaseEvent.js"),
class JaBaClient extends Client { class JaBaClient extends Client {
constructor(options) { constructor(options) {
super(options); super(options);
this.config = require("../config"); this.config = require("../config");
this.customEmojis = require("../emojis"); this.customEmojis = require("../emojis");
this.languages = require("../languages/language-meta"); this.languages = require("../languages/language-meta");
@ -38,9 +39,11 @@ class JaBaClient extends Client {
this.player.extractors.loadDefault(); this.player.extractors.loadDefault();
this.player.events.on("playerStart", async (queue, track) => { this.player.events.on("playerStart", async (queue, track) => {
const m = (await queue.metadata.channel.send({ const m = (
content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language), await queue.metadata.channel.send({
})).id; content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language),
})
).id;
if (track.durationMS > 1) if (track.durationMS > 1)
setTimeout(() => { setTimeout(() => {
@ -53,7 +56,7 @@ class JaBaClient extends Client {
const message = queue.metadata.channel.messages.cache.get(m); const message = queue.metadata.channel.messages.cache.get(m);
if (message && message.deletable) message.delete(); 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("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))); 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() { async init() {
this.login(this.config.token); this.login(this.config.token);
@ -86,22 +89,19 @@ class JaBaClient extends Client {
mongoose mongoose
.connect(this.config.mongoDB) .connect(this.config.mongoDB)
.then(() => { .then(() => {
this.logger.log("Connected to the Mongodb database.", "log"); this.logger.log("Connected to the Mongodb database.");
}) })
.catch(err => { .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"); // const autoUpdateDocs = require("../helpers/autoUpdateDocs");
// autoUpdateDocs.update(this); // autoUpdateDocs.update(this);
} }
/** /**
* Loads commands from directory * Loads all commands from directory
* @param {String} dir Directory where's all commands located * @param {String} dir Directory where commands are located
* @returns
*/ */
async loadCommands(dir) { async loadCommands(dir) {
const rest = new REST().setToken(this.config.token), const rest = new REST().setToken(this.config.token),
@ -121,21 +121,15 @@ class JaBaClient extends Client {
if (file.endsWith(".js")) { if (file.endsWith(".js")) {
const Command = require(path.join(folder, file)); const Command = require(path.join(folder, file));
if (Command.prototype instanceof BaseCommand) { if (Command.prototype instanceof BaseCommand) {
const command = new Command(this); const command = new Command(this);
this.commands.set(command.command.name, command); 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})`); this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`);
} }
} }
@ -143,80 +137,12 @@ class JaBaClient extends Client {
} }
try { try {
if (this.config.production) if (this.config.production) await rest.put(Routes.applicationCommands(this.config.userId), { body: commands });
await rest.put(Routes.applicationCommands(this.config.userId), { else await rest.put(Routes.applicationGuildCommands(this.config.userId, this.config.support.id), { body: commands });
body: commands,
});
else
await rest.put(Routes.applicationGuildCommands(this.config.userId, this.config.support.id), {
body: commands,
});
this.logger.log("Successfully registered application commands."); this.logger.log("Successfully registered application commands.");
} catch (err) { } catch (err) {
this.logger.log("Cannot load commands: " + err.message, "error"); this.logger.error(`Error during commands registration!\n${err.message}`);
}
}
/**
* 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})`);
}
}
} }
} }
@ -240,35 +166,127 @@ class JaBaClient extends Client {
} }
/** /**
* Finds or creates user in DB * Returns an embed created from given data
* @param {String} userID User ID * @param {Object} data Data for embed
* @returns {import("./User")} Mongoose model * @returns {import("discord.js").Embed}
*/ */
async findOrCreateUser(userID) { embed(data) {
if (this.databaseCache.users.get(userID)) return this.databaseCache.users.get(userID); const embed = new EmbedBuilder()
else { .setTitle(data.title || null)
let userData = await this.usersData.findOne({ id: userID }); .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) { if (typeof data.author === "string") embed.setAuthor({ name: data.author, iconURL: this.user.avatarURL() });
this.databaseCache.users.set(userID, userData); 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; return embed;
} else { }
userData = new this.usersData({ id: userID });
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<import("./User")>} 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 } * @param {Array} { id: Member ID, Guild ID }
* @returns {import("./Member")} Mongoose model * @returns {Promise<import("./Member")>} Mongoose model
*/ */
async findOrCreateMember({ id: memberID, guildId }) { async findOrCreateMember({ id: memberID, guildId }) {
let memberData = await this.membersData.findOne({ guildID: guildId, id: memberID }); let memberData = await this.membersData.findOne({ guildID: guildId, id: memberID });
@ -299,7 +317,7 @@ class JaBaClient extends Client {
/** /**
* Finds or creates guild in DB * Finds or creates guild in DB
* @param {String} guildId Guild ID * @param {String} guildId Guild ID
* @returns {import("./Guild")} Mongoose model * @returns {Promise<import("./Guild")>} Mongoose model
*/ */
async findOrCreateGuild(guildId) { async findOrCreateGuild(guildId) {
let guildData = await this.guildsData.findOne({ id: guildId }).populate("members"); let guildData = await this.guildsData.findOne({ id: guildId }).populate("members");

View file

@ -37,19 +37,11 @@ class Ban extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -14,18 +14,11 @@ class ImportMee6 extends BaseCommand {
.setDescription(client.translate("economy/importmee6:DESCRIPTION")) .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") }) .setDescriptionLocalizations({ uk: client.translate("economy/importmee6:DESCRIPTION", null, "uk-UA"), ru: client.translate("economy/importmee6:DESCRIPTION", null, "ru-RU") })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -37,19 +37,11 @@ class Kick extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js"); const { SlashCommandBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"), const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch"); fetch = require("node-fetch");
@ -17,11 +17,11 @@ class Memes extends BaseCommand {
ru: client.translate("fun/memes:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/memes:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -36,13 +36,11 @@ class Memes extends BaseCommand {
const tag = interaction.values[0]; const tag = interaction.values[0];
const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json()); const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json());
const embed = new EmbedBuilder() const embed = client.embed({
.setColor(client.config.embed.color) title: res.title,
.setFooter(client.config.embed.footer) description: `${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`,
.setTitle(res.title) image: res.url,
.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();
await interaction.editReply({ await interaction.editReply({
embeds: [embed], embeds: [embed],
@ -50,6 +48,7 @@ class Memes extends BaseCommand {
} }
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField } = require("discord.js"); const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Staff extends BaseCommand { class Staff extends BaseCommand {
@ -16,18 +16,11 @@ class Staff extends BaseCommand {
ru: client.translate("general/staff:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/staff:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @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 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 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", { name: interaction.translate("general/staff:TITLE", {
guild: interaction.guild.name, guild: interaction.guild.name,
}), }),
}) iconURL: interaction.guild.iconURL(),
.addFields([ },
fields: [
{ {
name: interaction.translate("general/staff:ADMINS"), name: interaction.translate("general/staff:ADMINS"),
value: value:
@ -57,9 +52,8 @@ class Staff extends BaseCommand {
name: interaction.translate("general/staff:MODS"), 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"), 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({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -56,18 +56,11 @@ class Automod extends BaseCommand {
.setRequired(true), .setRequired(true),
), ),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -36,18 +36,11 @@ class Autorole extends BaseCommand {
ru: client.translate("common:ROLE", null, "ru-RU"), ru: client.translate("common:ROLE", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField, ChannelType } = require("discord.js"); const { SlashCommandBuilder, PermissionsBitField, ChannelType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Config extends BaseCommand { class Config extends BaseCommand {
@ -75,18 +75,11 @@ class Config extends BaseCommand {
}), }),
), ),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -99,14 +92,12 @@ class Config extends BaseCommand {
if (command === "list") { if (command === "list") {
const guildData = data.guildData; const guildData = data.guildData;
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: interaction.guild.name, name: interaction.guild.name,
iconURL: interaction.guild.iconURL(), iconURL: interaction.guild.iconURL(),
}) },
.setColor(client.config.embed.color) fields: [
.setFooter(client.config.embed.footer)
.addFields([
{ {
name: interaction.translate("administration/config:WELCOME_TITLE"), name: interaction.translate("administration/config:WELCOME_TITLE"),
value: guildData.plugins.welcome.enabled value: guildData.plugins.welcome.enabled
@ -170,7 +161,8 @@ class Config extends BaseCommand {
name: interaction.translate("administration/config:DASHBOARD_TITLE"), name: interaction.translate("administration/config:DASHBOARD_TITLE"),
value: `[${interaction.translate("administration/config:DASHBOARD_CONTENT")}](${client.config.dashboard.domain})`, value: `[${interaction.translate("administration/config:DASHBOARD_CONTENT")}](${client.config.dashboard.domain})`,
}, },
]); ],
});
interaction.reply({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -72,18 +72,11 @@ class Goodbye extends BaseCommand {
}), }),
), ),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -75,11 +75,11 @@ class Selectroles extends BaseCommand {
.setRequired(true), .setRequired(true),
), ),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -108,6 +108,7 @@ class Selectroles extends BaseCommand {
} }
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -53,18 +53,11 @@ class Set extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -28,18 +28,11 @@ class Setlang extends BaseCommand {
.setRequired(true) .setRequired(true)
.setChoices({ name: "English", value: "en-US" }, { name: "Русский", value: "ru-RU" }, { name: "Українська", value: "uk-UA" }), .setChoices({ name: "English", value: "en-US" }, { name: "Русский", value: "ru-RU" }, { name: "Українська", value: "uk-UA" }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -27,18 +27,11 @@ class Stealemoji extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -72,18 +72,11 @@ class Welcome extends BaseCommand {
}), }),
), ),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Achievements extends BaseCommand { class Achievements extends BaseCommand {
@ -25,18 +25,11 @@ class Achievements extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @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 userData = user.id === interaction.user.id ? data.userData : await client.findOrCreateUser(user.id);
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: interaction.translate("economy/achievements:TITLE"), name: interaction.translate("economy/achievements:TITLE"),
}) iconURL: user.displayAvatarURL(),
.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)),
}),
}, },
{ fields: [
name: interaction.translate("economy/achievements:CLAIM_SALARY"), {
value: interaction.translate("economy/achievements:PROGRESS", { name: interaction.translate("economy/achievements:SEND_CMD"),
now: userData.achievements.work.progress.now, value: interaction.translate("economy/achievements:PROGRESS", {
total: userData.achievements.work.progress.total, now: userData.achievements.firstCommand.progress.now,
percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total)), 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:MARRY"), {
value: interaction.translate("economy/achievements:PROGRESS", { name: interaction.translate("economy/achievements:CLAIM_SALARY"),
now: userData.achievements.married.progress.now, value: interaction.translate("economy/achievements:PROGRESS", {
total: userData.achievements.married.progress.total, now: userData.achievements.work.progress.now,
percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total)), 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:SLOTS"), {
value: interaction.translate("economy/achievements:PROGRESS", { name: interaction.translate("economy/achievements:MARRY"),
now: userData.achievements.slots.progress.now, value: interaction.translate("economy/achievements:PROGRESS", {
total: userData.achievements.slots.progress.total, now: userData.achievements.married.progress.now,
percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total)), 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:TIP"), {
value: interaction.translate("economy/achievements:PROGRESS", { name: interaction.translate("economy/achievements:SLOTS"),
now: userData.achievements.tip.progress.now, value: interaction.translate("economy/achievements:PROGRESS", {
total: userData.achievements.tip.progress.total, now: userData.achievements.slots.progress.now,
percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total)), 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:REP"), {
value: interaction.translate("economy/achievements:PROGRESS", { name: interaction.translate("economy/achievements:TIP"),
now: userData.achievements.rep.progress.now, value: interaction.translate("economy/achievements:PROGRESS", {
total: userData.achievements.rep.progress.total, now: userData.achievements.tip.progress.now,
percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total)), 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:INVITE"), {
value: interaction.translate("economy/achievements:PROGRESS", { name: interaction.translate("economy/achievements:REP"),
now: userData.achievements.invite.progress.now, value: interaction.translate("economy/achievements:PROGRESS", {
total: userData.achievements.invite.progress.total, now: userData.achievements.rep.progress.now,
percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total)), 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({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -37,18 +37,11 @@ class Bank extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -60,18 +60,11 @@ class Birthdate extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -82,11 +75,12 @@ class Birthdate extends BaseCommand {
const day = interaction.options.getInteger("day"), const day = interaction.options.getInteger("day"),
month = interaction.options.getInteger("month"), month = interaction.options.getInteger("month"),
year = interaction.options.getInteger("year"), 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 (!(day == date.getDate() && month - 1 == date.getMonth() && year == date.getFullYear())) return interaction.error("economy/birthdate:INVALID_DATE");
if (d.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH"); if (date.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 (date.getTime() < Date.now() - 2.523e12) return interaction.error("economy/birthdate:DATE_TOO_LOW");
data.userData.birthdate = d; data.userData.birthdate = d;
@ -94,7 +88,7 @@ class Birthdate extends BaseCommand {
await data.userData.save(); await data.userData.save();
interaction.success("economy/birthdate:SUCCESS", { interaction.success("economy/birthdate:SUCCESS", {
date: client.functions.printDate(client, d, "Do MMMM YYYY", interaction.getLocale()), date: `<t:${d}:D>`,
}); });
} }
} }

View file

@ -16,18 +16,11 @@ class Divorce extends BaseCommand {
ru: client.translate("economy/divorce:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/divorce:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Leaderboard extends BaseCommand { class Leaderboard extends BaseCommand {
@ -27,18 +27,11 @@ class Leaderboard extends BaseCommand {
.setRequired(true) .setRequired(true)
.setChoices({ name: client.translate("common:LEVEL"), value: "level" }, { name: client.translate("common:MONEY"), value: "money" }, { name: client.translate("common:REP"), value: "rep" }), .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, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -56,6 +49,15 @@ class Leaderboard extends BaseCommand {
ephemeral: true, ephemeral: true,
}); });
const embed = client.embed({
author: {
name: interaction.translate("economy/leaderboard:TABLE", {
name: interaction.guild.name,
}),
iconURL: interaction.guild.iconURL(),
},
});
if (type === "money") { if (type === "money") {
const membersLeaderboard = [], const membersLeaderboard = [],
membersData = await client.membersData.find({ guildID: interaction.guildId }).lean(); membersData = await client.membersData.find({ guildID: interaction.guildId }).lean();
@ -78,28 +80,18 @@ class Leaderboard extends BaseCommand {
money += `${data.money}\n`; money += `${data.money}\n`;
} }
const embed = new EmbedBuilder() embed.fields = [
.setAuthor({ {
name: interaction.translate("economy/leaderboard:TABLE", { name: interaction.translate("common:USER"),
name: interaction.guild.name, value: userNames,
}), inline: true,
iconURL: interaction.guild.iconURL(), },
}) {
.setColor(client.config.embed.color) name: interaction.translate("common:CREDITS"),
.addFields( value: money,
{ inline: true,
name: interaction.translate("common:USER"), },
value: userNames, ];
inline: true,
},
{
name: interaction.translate("common:CREDITS"),
value: money,
inline: true,
},
)
.setFooter(client.config.embed.footer)
.setTimestamp();
interaction.editReply({ interaction.editReply({
embeds: [embed], embeds: [embed],
@ -129,33 +121,23 @@ class Leaderboard extends BaseCommand {
xp.push(`${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}`); xp.push(`${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}`);
} }
const embed = new EmbedBuilder() embed.fields = [
.setAuthor({ {
name: interaction.translate("economy/leaderboard:TABLE", { name: interaction.translate("common:USER"),
name: interaction.guild.name, value: userNames.join("\n"),
}), inline: true,
iconURL: interaction.guild.iconURL(), },
}) {
.setColor(client.config.embed.color) name: interaction.translate("common:LEVEL"),
.addFields([ value: level.join("\n"),
{ inline: true,
name: interaction.translate("common:USER"), },
value: userNames.join("\n"), {
inline: true, name: interaction.translate("common:XP"),
}, value: xp.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();
interaction.editReply({ interaction.editReply({
embeds: [embed], embeds: [embed],
@ -182,28 +164,18 @@ class Leaderboard extends BaseCommand {
rep += `${data.rep}\n`; rep += `${data.rep}\n`;
} }
const embed = new EmbedBuilder() embed.fields = [
.setAuthor({ {
name: interaction.translate("economy/leaderboard:TABLE", { name: interaction.translate("common:USER"),
name: interaction.guild.name, value: userNames,
}), inline: true,
iconURL: interaction.guild.iconURL(), },
}) {
.setColor(client.config.embed.color) name: interaction.translate("common:REP"),
.addFields( value: rep,
{ inline: true,
name: interaction.translate("common:USER"), },
value: userNames, ];
inline: true,
},
{
name: interaction.translate("common:REP"),
value: rep,
inline: true,
},
)
.setFooter(client.config.embed.footer)
.setTimestamp();
interaction.editReply({ interaction.editReply({
embeds: [embed], embeds: [embed],

View file

@ -27,18 +27,11 @@ class Marry extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Money extends BaseCommand { class Money extends BaseCommand {
@ -25,18 +25,11 @@ class Money extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -61,14 +54,14 @@ class Money extends BaseCommand {
globalMoney += data.money + data.bankSold; globalMoney += data.money + data.bankSold;
}); });
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: interaction.translate("economy/money:TITLE", { name: interaction.translate("economy/money:TITLE", {
user: member.user.getUsername(), user: member.user.getUsername(),
}), }),
iconURL: member.user.displayAvatarURL(), iconURL: member.user.displayAvatarURL(),
}) },
.addFields([ fields: [
{ {
name: interaction.translate("economy/profile:CASH"), 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"))}`, 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"))}`, 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, inline: true,
}, },
]) ],
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer);
interaction.editReply({ interaction.editReply({
embeds: [embed], embeds: [embed],
}); });

View file

@ -36,18 +36,11 @@ class Pay extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Profile extends BaseCommand { class Profile extends BaseCommand {
@ -25,18 +25,11 @@ class Profile extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -65,19 +58,15 @@ class Profile extends BaseCommand {
const lover = client.users.cache.get(userData.lover); const lover = client.users.cache.get(userData.lover);
const profileEmbed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: interaction.translate("economy/profile:TITLE", { name: interaction.translate("economy/profile:TITLE", {
user: member.user.getUsername(), user: member.user.getUsername(),
}), }),
iconURL: member.displayAvatarURL(), iconURL: member.displayAvatarURL(),
}) },
.setImage("attachment://achievements.png") image: "attachment://achievements.png",
.addFields([ fields: [
// {
// 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})`,
// },
{ {
name: interaction.translate("economy/profile:BIO"), name: interaction.translate("economy/profile:BIO"),
value: userData.bio ? userData.bio : interaction.translate("common:UNKNOWN"), value: userData.bio ? userData.bio : interaction.translate("common:UNKNOWN"),
@ -114,12 +103,12 @@ class Profile extends BaseCommand {
}, },
{ {
name: interaction.translate("economy/profile:REGISTERED"), name: interaction.translate("economy/profile:REGISTERED"),
value: client.functions.printDate(client, new Date(memberData.registeredAt), null, interaction.getLocale()), value: `<t:${Math.floor(memberData.registeredAt / 1000)}:f>`,
inline: true, inline: true,
}, },
{ {
name: interaction.translate("economy/profile:BIRTHDATE"), 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") : `<t:${userData.birthdate}:D>`,
inline: true, inline: true,
}, },
{ {
@ -131,15 +120,13 @@ class Profile extends BaseCommand {
name: interaction.translate("economy/profile:ACHIEVEMENTS"), name: interaction.translate("economy/profile:ACHIEVEMENTS"),
value: interaction.translate("economy/profile:ACHIEVEMENTS_CONTENT"), value: interaction.translate("economy/profile:ACHIEVEMENTS_CONTENT"),
}, },
]) ],
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer)
.setTimestamp();
const buffer = await userData.getAchievements(); const buffer = await userData.getAchievements();
interaction.editReply({ interaction.editReply({
embeds: [profileEmbed], embeds: [embed],
files: [ files: [
{ {
name: "achievements.png", name: "achievements.png",

View file

@ -26,18 +26,11 @@ class Rep extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -46,10 +39,11 @@ class Rep extends BaseCommand {
*/ */
async execute(client, interaction, data) { async execute(client, interaction, data) {
const isInCooldown = data.userData.cooldowns?.rep; const isInCooldown = data.userData.cooldowns?.rep;
if (isInCooldown) { if (isInCooldown) {
if (isInCooldown > Date.now()) if (isInCooldown > Date.now())
return interaction.error("economy/rep:COOLDOWN", { return interaction.error("economy/rep:COOLDOWN", {
time: client.functions.convertTime(client, isInCooldown, true, false, interaction.getLocale()), time: `<t:${Math.floor(isInCooldown / 1000)}:R>`,
}); });
} }
@ -57,7 +51,7 @@ class Rep extends BaseCommand {
if (user.bot) return interaction.error("economy/rep:BOT_USER"); if (user.bot) return interaction.error("economy/rep:BOT_USER");
if (user.id === interaction.user.id) return interaction.error("economy/rep:YOURSELF"); 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 = {}; if (!data.userData.cooldowns) data.userData.cooldowns = {};
data.userData.cooldowns.rep = toWait; data.userData.cooldowns.rep = toWait;

View file

@ -36,18 +36,11 @@ class Rob extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -26,18 +26,11 @@ class Setbio extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -26,18 +26,11 @@ class Slots extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Transactions extends BaseCommand { class Transactions extends BaseCommand {
@ -25,18 +25,11 @@ class Transactions extends BaseCommand {
ru: client.translate("economy/transactions:CLEAR", null, "ru-RU"), ru: client.translate("economy/transactions:CLEAR", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -53,14 +46,12 @@ class Transactions extends BaseCommand {
return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true }); return interaction.success("economy/transactions:CLEARED", null, { ephemeral: true });
} }
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: interaction.translate("economy/transactions:EMBED_TRANSACTIONS"), name: interaction.translate("economy/transactions:EMBED_TRANSACTIONS"),
iconURL: interaction.member.displayAvatarURL(), iconURL: interaction.member.displayAvatarURL(),
}) },
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer);
const transactions = data.memberData.transactions, const transactions = data.memberData.transactions,
sortedTransactions = [[], []]; sortedTransactions = [[], []];
@ -69,15 +60,15 @@ class Transactions extends BaseCommand {
array.push( 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( `${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", "economy/transactions:T_DATE",
)}: ${client.functions.printDate(client, t.date, "Do MMMM YYYY, HH:mm", interaction.getLocale())}\n`, )}: <t:${Math.floor(t.date / 1000)}:f>\n`,
); );
}); });
if (transactions.length < 1) { if (transactions.length < 1) {
embed.setDescription(interaction.translate("economy/transactions:NO_TRANSACTIONS")); embed.data.description = interaction.translate("economy/transactions:NO_TRANSACTIONS");
} else { } else {
if (sortedTransactions[0].length > 0) if (sortedTransactions[0].length > 0)
embed.addFields([ embed.data.fields.push([
{ {
name: interaction.translate("economy/transactions:T_GOT"), name: interaction.translate("economy/transactions:T_GOT"),
value: sortedTransactions[0].join("\n"), value: sortedTransactions[0].join("\n"),
@ -85,7 +76,7 @@ class Transactions extends BaseCommand {
}, },
]); ]);
if (sortedTransactions[1].length > 0) if (sortedTransactions[1].length > 0)
embed.addFields([ embed.data.fields.push([
{ {
name: interaction.translate("economy/transactions:T_SEND"), name: interaction.translate("economy/transactions:T_SEND"),
value: sortedTransactions[1].join("\n"), value: sortedTransactions[1].join("\n"),

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js"); const { SlashCommandBuilder, parseEmoji } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Work extends BaseCommand { class Work extends BaseCommand {
@ -16,18 +16,11 @@ class Work extends BaseCommand {
ru: client.translate("economy/work:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/work:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -36,15 +29,17 @@ class Work extends BaseCommand {
*/ */
async execute(client, interaction, data) { async execute(client, interaction, data) {
const isInCooldown = data.memberData.cooldowns?.work; const isInCooldown = data.memberData.cooldowns?.work;
if (isInCooldown) { if (isInCooldown) {
if (isInCooldown > Date.now()) if (isInCooldown > Date.now())
return interaction.error("economy/work:COOLDOWN", { return interaction.error("economy/work:COOLDOWN", {
time: client.functions.convertTime(client, isInCooldown, true, false, interaction.getLocale()), time: `<t:${Math.floor(isInCooldown / 1000)}:R>`,
}); });
} }
if (Date.now() > data.memberData.cooldowns.work + 24 * 60 * 60 * 1000) data.memberData.workStreak = 0; 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.cooldowns.work = toWait;
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1; data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
@ -52,19 +47,19 @@ class Work extends BaseCommand {
data.memberData.markModified("workStreak"); data.memberData.markModified("workStreak");
await data.memberData.save(); await data.memberData.save();
const embed = new EmbedBuilder() const embed = client.embed({
.setFooter({ footer: {
text: interaction.translate("economy/work:AWARD"), text: interaction.translate("economy/work:AWARD"),
iconURL: interaction.member.displayAvatarURL(), 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]; 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; let won = 200;
if (data.memberData.workStreak >= 5) { if (data.memberData.workStreak >= 5) {
won += 200; won += 200;
embed.addFields([ embed.fields = [
{ {
name: interaction.translate("economy/work:SALARY"), name: interaction.translate("economy/work:SALARY"),
value: interaction.translate("economy/work:SALARY_CONTENT", { value: interaction.translate("economy/work:SALARY_CONTENT", {
@ -75,7 +70,7 @@ class Work extends BaseCommand {
name: interaction.translate("economy/work:STREAK"), name: interaction.translate("economy/work:STREAK"),
value: interaction.translate("economy/work:STREAK_CONTENT"), value: interaction.translate("economy/work:STREAK_CONTENT"),
}, },
]); ];
data.memberData.workStreak = 0; data.memberData.workStreak = 0;
} else { } else {
for (let i = 0; i < award.length; i++) { for (let i = 0; i < award.length; i++) {
@ -84,7 +79,7 @@ class Work extends BaseCommand {
award[i] = `:regional_indicator_${letter.toLowerCase()}:`; award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
} }
} }
embed.addFields([ embed.fields = [
{ {
name: interaction.translate("economy/work:SALARY"), name: interaction.translate("economy/work:SALARY"),
value: interaction.translate("economy/work:SALARY_CONTENT", { value: interaction.translate("economy/work:SALARY_CONTENT", {
@ -95,7 +90,7 @@ class Work extends BaseCommand {
name: interaction.translate("economy/work:STREAK"), name: interaction.translate("economy/work:STREAK"),
value: award.join(""), value: award.join(""),
}, },
]); ];
} }
data.memberData.money += won; data.memberData.money += won;

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Eightball extends BaseCommand { class Eightball extends BaseCommand {
@ -26,18 +26,11 @@ class Eightball extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -48,8 +41,8 @@ class Eightball extends BaseCommand {
await interaction.deferReply(); await interaction.deferReply();
const question = interaction.options.getString("question"); const question = interaction.options.getString("question");
const embed = new EmbedBuilder() const embed = client.embed({
.setFields( fields: [
{ {
name: interaction.translate("fun/8ball:QUESTION"), name: interaction.translate("fun/8ball:QUESTION"),
value: question, value: question,
@ -58,10 +51,8 @@ class Eightball extends BaseCommand {
name: interaction.translate("fun/8ball:ANSWER"), name: interaction.translate("fun/8ball:ANSWER"),
value: interaction.translate(`fun/8ball:RESPONSE_${client.functions.randomNum(1, 20)}`), 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); await client.wait(5000);

View file

@ -17,18 +17,11 @@ class Cat extends BaseCommand {
ru: client.translate("fun/cat:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/cat:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @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 res = await fetch("https://api.thecatapi.com/v1/images/search").then(r => r.json());
const cat = res[0].url; const cat = res[0].url;
await interaction.editReply({ content: cat }); const embed = client.embed({
image: cat,
});
await interaction.editReply({ embeds: [embed] });
} }
} }

View file

@ -17,18 +17,11 @@ class Dog extends BaseCommand {
ru: client.translate("fun/dog:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/dog:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @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 res = await fetch("https://dog.ceo/api/breeds/image/random").then(r => r.json());
const dog = res.message; const dog = res.message;
await interaction.editReply({ content: dog }); const embed = client.embed({
image: dog,
});
await interaction.editReply({ embeds: [embed] });
} }
} }

View file

@ -37,18 +37,11 @@ class LMGTFY extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"), const BaseCommand = require("../../base/BaseCommand"),
md5 = require("md5"); md5 = require("md5");
@ -36,18 +36,11 @@ class Lovecalc extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -67,19 +60,16 @@ class Lovecalc extends BaseCommand {
.join(""); .join("");
const percent = parseInt(string.slice(0, 2), 10); const percent = parseInt(string.slice(0, 2), 10);
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}`, name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}`,
}) },
.setDescription( description: interaction.translate("fun/lovecalc:CONTENT", {
interaction.translate("fun/lovecalc:CONTENT", { percent,
percent, firstMember: firstMember.user.toString(),
firstMember: firstMember.user.toString(), secondMember: secondMember.user.toString(),
secondMember: secondMember.user.toString(), }),
}), });
)
.setColor(client.config.embed.color)
.setFooter(client.config.embed.footer);
interaction.reply({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -17,18 +17,11 @@ class Number extends BaseCommand {
ru: client.translate("fun/number:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/number:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -60,12 +53,11 @@ class Number extends BaseCommand {
const parsedNumber = parseInt(msg.content, 10); const parsedNumber = parseInt(msg.content, 10);
if (parsedNumber === number) { if (parsedNumber === number) {
const time = client.functions.convertTime(client, gameCreatedAt, false, true, interaction.getLocale());
interaction.channel.send({ interaction.channel.send({
content: interaction.translate("fun/number:GAME_STATS", { content: interaction.translate("fun/number:GAME_STATS", {
winner: msg.author.toString(), winner: msg.author.toString(),
number, number,
time, time: `<t:${Math.floor(gameCreatedAt / 1000)}:R>`,
participantCount: participants.length, participantCount: participants.length,
participants: participants.map(p => `<@${p}>`).join(", "), participants: participants.map(p => `<@${p}>`).join(", "),
}), }),

View file

@ -27,18 +27,11 @@ class TicTacToe extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -26,18 +26,11 @@ class Afk extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -12,18 +12,11 @@ class AvatarContext extends BaseCommand {
.setName("Get Avatar") .setName("Get Avatar")
.setType(ApplicationCommandType.User) .setType(ApplicationCommandType.User)
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -31,14 +24,11 @@ class AvatarContext extends BaseCommand {
* @param {Object} data * @param {Object} data
*/ */
async execute(client, interaction) { 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({ interaction.reply({
files: [ embeds: [embed],
{
attachment: avatar,
},
],
}); });
} }
} }

View file

@ -34,18 +34,11 @@ class Avatar extends BaseCommand {
ru: client.translate("general/avatar:SERVER", null, "ru-RU"), ru: client.translate("general/avatar:SERVER", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -54,14 +47,11 @@ class Avatar extends BaseCommand {
*/ */
async execute(client, interaction) { async execute(client, interaction) {
const member = interaction.options.getMember("user") || interaction.member; 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({ interaction.reply({
files: [ embeds: [embed],
{
attachment: avatarURL,
},
],
}); });
} }
} }

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class Boosters extends BaseCommand { class Boosters extends BaseCommand {
@ -16,11 +16,11 @@ class Boosters extends BaseCommand {
ru: client.translate("general/boosters:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/boosters:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -110,6 +110,7 @@ class Boosters extends BaseCommand {
} }
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -158,14 +159,13 @@ function generateBoostersEmbeds(client, interaction, boosters) {
let j = i; let j = i;
k += 10; 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); embeds.push(embed);
} }

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js"); const { SlashCommandBuilder, parseEmoji } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Emoji extends BaseCommand { class Emoji extends BaseCommand {
@ -26,18 +26,11 @@ class Emoji extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -48,15 +41,13 @@ class Emoji extends BaseCommand {
const rawEmoji = interaction.options.getString("emoji"); const rawEmoji = interaction.options.getString("emoji");
const parsedEmoji = parseEmoji(rawEmoji); const parsedEmoji = parseEmoji(rawEmoji);
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: interaction.translate("general/emoji:TITLE", { name: interaction.translate("general/emoji:TITLE", {
emoji: parsedEmoji.name, emoji: parsedEmoji.name,
}), }),
}) },
.setColor(client.config.embed.color) fields: [
.setFooter(client.config.embed.footer)
.addFields([
{ {
name: interaction.translate("common:NAME"), name: interaction.translate("common:NAME"),
value: parsedEmoji.name, value: parsedEmoji.name,
@ -73,7 +64,8 @@ class Emoji extends BaseCommand {
name: interaction.translate("general/emoji:LINK"), name: interaction.translate("general/emoji:LINK"),
value: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${parsedEmoji.animated ? "gif" : "png"}`, value: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${parsedEmoji.animated ? "gif" : "png"}`,
}, },
]); ],
});
interaction.reply({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class Help extends BaseCommand { class Help extends BaseCommand {
@ -26,11 +26,11 @@ class Help extends BaseCommand {
}) })
.setAutocomplete(true), .setAutocomplete(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -52,19 +52,15 @@ class Help extends BaseCommand {
}; };
}); });
const embed = new EmbedBuilder() const embed = client.embed({
.setColor(client.config.embed.color) author: {
.setFooter(client.config.embed.footer)
.setAuthor({
name: interaction.translate("general/help:COMMANDS_IN", { category: arg }), name: interaction.translate("general/help:COMMANDS_IN", { category: arg }),
}) },
.addFields(categoryCommands) fields: categoryCommands.concat({
.addFields([ name: "\u200B",
{ value: interaction.translate("general/help:INFO"),
name: "\u200B", }),
value: interaction.translate("general/help:INFO"), });
},
]);
return interaction.editReply({ return interaction.editReply({
content: null, content: null,
@ -73,6 +69,7 @@ class Help extends BaseCommand {
} }
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -83,24 +80,15 @@ class Help extends BaseCommand {
await interaction.deferReply(); await interaction.deferReply();
const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()]; 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"); const command = interaction.options.getString("command");
if (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 }); 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 });
return interaction.editReply({ embeds: [generateCommandHelp(interaction, command)] }); 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 => { const categoriesRows = categories.sort().map(c => {
return { return {
label: `${c} (${commands.filter(cmd => cmd.category === c).length})`, label: `${c} (${commands.filter(cmd => cmd.category === c).length})`,
@ -145,38 +133,36 @@ function generateCommandHelp(interaction, command) {
const cmd = interaction.client.commands.get(command); const cmd = interaction.client.commands.get(command);
if (!cmd) return interaction.error("general/help:NOT_FOUND", { command }, { edit: true }); 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() const embed = interaction.client.embed({
.setAuthor({ author: {
name: interaction.translate("general/help:CMD_TITLE", { name: interaction.translate("general/help:CMD_TITLE", {
cmd: cmd.command.name, cmd: cmd.command.name,
}), }),
}) },
.addFields([ fields: [
{ {
name: interaction.translate("general/help:FIELD_DESCRIPTION"), name: interaction.translate("general/help:FIELD_DESCRIPTION"),
value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`), value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`),
}, },
{ {
name: interaction.translate("general/help:FIELD_USAGE"), 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"), name: interaction.translate("general/help:FIELD_EXAMPLES"),
value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}: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"), 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"), 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; return embed;
} }

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"), const BaseCommand = require("../../base/BaseCommand"),
gamedig = require("gamedig"); gamedig = require("gamedig");
@ -27,18 +27,11 @@ class Minecraft extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -69,11 +62,10 @@ class Minecraft extends BaseCommand {
if (!res) return interaction.error("general/minecraft:FAILED", null, { edit: true }); if (!res) return interaction.error("general/minecraft:FAILED", null, { edit: true });
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: { name: res.name || "Unknown" },
name: res.name || "Unknown", thumbnail: `https://eu.mc-api.net/v3/server/favicon/${ip}`,
}) fields: [
.addFields([
{ {
name: interaction.translate("general/minecraft:FIELD_STATUS"), name: interaction.translate("general/minecraft:FIELD_STATUS"),
value: interaction.translate("general/minecraft:ONLINE"), value: interaction.translate("general/minecraft:ONLINE"),
@ -106,10 +98,8 @@ class Minecraft extends BaseCommand {
name: interaction.translate("general/minecraft:FIELD_PING"), name: interaction.translate("general/minecraft:FIELD_PING"),
value: res.raw.vanilla.ping.toString(), 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({ interaction.editReply({
embeds: [embed], embeds: [embed],

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Ping extends BaseCommand { class Ping extends BaseCommand {
@ -16,18 +16,11 @@ class Ping extends BaseCommand {
ru: client.translate("general/ping:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/ping:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -35,18 +28,14 @@ class Ping extends BaseCommand {
* @param {Object} data * @param {Object} data
*/ */
async execute(client, interaction) { async execute(client, interaction) {
const embed = new EmbedBuilder() const embed = client.embed({
.setColor(client.config.embed.color) author: {
.setFooter(client.config.embed.footer)
.setAuthor({
name: interaction.translate("general/ping:PONG"), name: interaction.translate("general/ping:PONG"),
iconURL: client.user.avatarURL(), },
}) description: interaction.translate("general/ping:PING", {
.setDescription( ping: Math.round(client.ws.ping),
interaction.translate("general/ping:PING", { }),
ping: Math.round(client.ws.ping), });
}),
);
interaction.reply({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"), const BaseCommand = require("../../base/BaseCommand"),
ms = require("ms"), ms = require("ms"),
moment = require("moment"); moment = require("moment");
@ -38,18 +38,11 @@ class Remindme extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -76,11 +69,9 @@ class Remindme extends BaseCommand {
client.databaseCache.usersReminds.set(interaction.user.id, data.userData); client.databaseCache.usersReminds.set(interaction.user.id, data.userData);
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: interaction.translate("general/remindme:EMBED_SAVED"),
name: interaction.translate("general/remindme:EMBED_SAVED"), fields: [
})
.addFields([
{ {
name: interaction.translate("general/remindme:EMBED_TIME"), name: interaction.translate("general/remindme:EMBED_TIME"),
value: moment(reminderData.sendAt).locale(interaction.getLocale()).format("Do MMMM YYYY, HH:mm:ss"), 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"), name: interaction.translate("common:MESSAGE"),
value: reminderData.message, value: reminderData.message,
}, },
]) ],
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer);
interaction.editReply({ interaction.editReply({
embeds: [embed], embeds: [embed],

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js"); const { SlashCommandBuilder, parseEmoji } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Report extends BaseCommand { class Report extends BaseCommand {
@ -36,18 +36,11 @@ class Report extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -63,20 +56,17 @@ class Report extends BaseCommand {
const rep = interaction.options.getString("message"); const rep = interaction.options.getString("message");
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: interaction.translate("general/report:TITLE", { name: interaction.translate("general/report:TITLE", {
user: member.user.getUsername(), user: member.user.getUsername(),
}), }),
iconURL: interaction.user.displayAvatarURL({ iconURL: interaction.user.displayAvatarURL(),
extension: "png", },
size: 512, fields: [
}),
})
.addFields([
{ {
name: interaction.translate("common:DATE"), name: interaction.translate("common:DATE"),
value: client.functions.printDate(client, new Date(Date.now()), null, interaction.getLocale()), value: `<t:${Math.floor(Date.now() / 1000)}:D>`,
}, },
{ {
name: interaction.translate("common:AUTHOR"), name: interaction.translate("common:AUTHOR"),
@ -93,9 +83,8 @@ class Report extends BaseCommand {
value: rep, value: rep,
inline: true, inline: true,
}, },
]) ],
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer);
const success = parseEmoji(client.customEmojis.cool).id; const success = parseEmoji(client.customEmojis.cool).id;
const error = parseEmoji(client.customEmojis.notcool).id; const error = parseEmoji(client.customEmojis.notcool).id;

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder, ChannelType } = require("discord.js"); const { SlashCommandBuilder, ChannelType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Serverinfo extends BaseCommand { class Serverinfo extends BaseCommand {
@ -16,18 +16,11 @@ class Serverinfo extends BaseCommand {
ru: client.translate("general/serverinfo:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/serverinfo:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -40,17 +33,10 @@ class Serverinfo extends BaseCommand {
await guild.members.fetch(); await guild.members.fetch();
const owner = await guild.fetchOwner(); const owner = await guild.fetchOwner();
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: guild.name,
name: guild.name, thumbnail: guild.iconURL(),
iconURL: guild.iconURL(), fields: [
})
.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})`,
// },
{ {
name: client.customEmojis.title + interaction.translate("common:NAME"), name: client.customEmojis.title + interaction.translate("common:NAME"),
value: guild.name, value: guild.name,
@ -58,7 +44,7 @@ class Serverinfo extends BaseCommand {
}, },
{ {
name: client.customEmojis.calendar + interaction.translate("common:CREATION"), name: client.customEmojis.calendar + interaction.translate("common:CREATION"),
value: client.functions.printDate(client, guild.createdAt, null, interaction.getLocale()), value: `<t:${guild.createdTimestamp}:D>`,
inline: true, inline: true,
}, },
{ {
@ -124,10 +110,8 @@ class Serverinfo extends BaseCommand {
)}`, )}`,
inline: true, inline: true,
}, },
]) ],
});
.setColor(client.config.embed.color)
.setFooter(client.config.embed.footer);
interaction.reply({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -27,18 +27,11 @@ class Shorturl extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class Stats extends BaseCommand { class Stats extends BaseCommand {
@ -16,18 +16,11 @@ class Stats extends BaseCommand {
ru: client.translate("general/stats:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/stats:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -43,14 +36,10 @@ class Stats extends BaseCommand {
}); });
users = users - hiddenGuildMembersCount; users = users - hiddenGuildMembersCount;
const statsEmbed = new EmbedBuilder() const embed = client.embed({
.setColor(client.config.embed.color) author: interaction.translate("common:STATS"),
.setFooter(client.config.embed.footer) descirption: interaction.translate("general/stats:MADE"),
.setAuthor({ fields: [
name: interaction.translate("common:STATS"),
})
.setDescription(interaction.translate("general/stats:MADE"))
.addFields([
{ {
name: client.customEmojis.stats + " " + interaction.translate("general/stats:COUNTS_TITLE"), name: client.customEmojis.stats + " " + interaction.translate("general/stats:COUNTS_TITLE"),
value: interaction.translate("general/stats:COUNTS_CONTENT", { 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"), 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, inline: true,
}, },
{ {
@ -72,7 +61,7 @@ class Stats extends BaseCommand {
{ {
name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"), name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"),
value: interaction.translate("general/stats:ONLINE_CONTENT", { value: interaction.translate("general/stats:ONLINE_CONTENT", {
time: client.functions.convertTime(client, Date.now() + client.uptime, true, false, interaction.getLocale()), time: `<t:${Math.floor((Date.now() + client.uptime) / 1000)}:R>`,
}), }),
}, },
{ {
@ -100,10 +89,11 @@ class Stats extends BaseCommand {
owner: client.config.owner.id, owner: client.config.owner.id,
}), }),
}, },
]); ],
});
interaction.reply({ interaction.reply({
embeds: [statsEmbed], embeds: [embed],
}); });
} }
} }

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js"); const { SlashCommandBuilder, parseEmoji } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Suggest extends BaseCommand { class Suggest extends BaseCommand {
@ -26,18 +26,11 @@ class Suggest extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -45,22 +38,22 @@ class Suggest extends BaseCommand {
* @param {Object} data * @param {Object} data
*/ */
async execute(client, interaction, data) { async execute(client, interaction, data) {
const suggChannel = interaction.guild.channels.cache.get(data.guildData.plugins.suggestions); const channel = interaction.guild.channels.cache.get(data.guildData.plugins.suggestions);
if (!suggChannel) return interaction.error("general/suggest:MISSING_CHANNEL"); if (!channel) return interaction.error("general/suggest:MISSING_CHANNEL");
const suggestion = interaction.options.getString("message"); const suggestion = interaction.options.getString("message");
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: interaction.translate("general/suggest:TITLE", { name: interaction.translate("general/suggest:TITLE", {
user: interaction.user.getUsername(), user: interaction.user.getUsername(),
}), }),
iconURL: interaction.member.displayAvatarURL(), iconURL: interaction.member.displayAvatarURL(),
}) },
.addFields([ fields: [
{ {
name: interaction.translate("common:DATE"), name: interaction.translate("common:DATE"),
value: client.functions.printDate(client, new Date(Date.now()), null, interaction.getLocale()), value: `<t:${Math.floor(Date.now() / 1000)}:D>`,
}, },
{ {
name: interaction.translate("common:AUTHOR"), name: interaction.translate("common:AUTHOR"),
@ -72,14 +65,13 @@ class Suggest extends BaseCommand {
value: suggestion, value: suggestion,
inline: true, inline: true,
}, },
]) ],
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer);
const success = parseEmoji(client.customEmojis.cool).id; const success = parseEmoji(client.customEmojis.cool).id;
const error = parseEmoji(client.customEmojis.notcool).id; const error = parseEmoji(client.customEmojis.notcool).id;
suggChannel.send({ channel.send({
embeds: [embed], embeds: [embed],
}).then(async m => { }).then(async m => {
await m.react(success); await m.react(success);
@ -87,7 +79,7 @@ class Suggest extends BaseCommand {
}); });
interaction.success("general/suggest:SUCCESS", { interaction.success("general/suggest:SUCCESS", {
channel: suggChannel.toString(), channel: channel.toString(),
}, { ephemeral: true }); }, { ephemeral: true });
} }
} }

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Userinfo extends BaseCommand { class Userinfo extends BaseCommand {
@ -25,18 +25,11 @@ class Userinfo extends BaseCommand {
ru: client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -45,17 +38,14 @@ class Userinfo extends BaseCommand {
*/ */
async execute(client, interaction) { async execute(client, interaction) {
const member = interaction.options.getMember("user") || interaction.member; const member = interaction.options.getMember("user") || interaction.member;
const embed = new EmbedBuilder()
.setAuthor({ const embed = client.embed({
author: {
name: `${member.user.getUsername()} (${member.id})`, name: `${member.user.getUsername()} (${member.id})`,
iconURL: member.displayAvatarURL(), iconURL: member.displayAvatarURL(),
}) },
.setThumbnail( thumbnail: member.displayAvatarURL(),
member.displayAvatarURL({ fields: [
size: 512,
}),
)
.addFields([
{ {
name: ":man: " + interaction.translate("common:USERNAME"), name: ":man: " + interaction.translate("common:USERNAME"),
value: member.user.getUsername(), value: member.user.getUsername(),
@ -66,11 +56,6 @@ class Userinfo extends BaseCommand {
value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"), value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"),
inline: true, 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"), name: client.customEmojis.bot + " " + interaction.translate("common:ROBOT"),
value: member.user.bot ? interaction.translate("common:YES") : interaction.translate("common:NO"), 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"), name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"),
value: client.functions.printDate(client, member.user.createdAt, null, interaction.getLocale()), value: `<t:${member.user.createdTimestamp}:D>`,
inline: true, inline: true,
}, },
{ {
name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"), name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"),
value: client.functions.printDate(client, member.joinedAt, null, interaction.getLocale()), value: `<t:${member.joinedTimestamp}:D>`,
inline: true, 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(", "), : 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, 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({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"), const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch"); fetch = require("node-fetch");
@ -27,18 +27,11 @@ class Whois extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @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 }) }); if (whois.status === "fail") return interaction.editReply({ content: interaction.translate("general/whois:ERROR", { ip }) });
const embed = new EmbedBuilder() const embed = client.embed({
.setTitle( title: interaction.translate("general/whois:INFO_ABOUT", {
interaction.translate("general/whois:INFO_ABOUT", { ip,
ip, }),
}), fields: [
)
.setFooter(client.config.embed.footer)
.setColor(client.config.embed.color)
.addFields(
{ name: interaction.translate("common:IP"), value: whois.query, inline: true }, { 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: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 }, { 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: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: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 }, { 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.proxy) embed.data.fields.push({ 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.mobile) embed.data.fields.push({ 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.hosting) embed.data.fields.push({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:HOSTING") });
interaction.editReply({ interaction.editReply({
embeds: [embed], embeds: [embed],

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"), const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch"), fetch = require("node-fetch"),
moment = require("moment"); moment = require("moment");
@ -18,18 +18,11 @@ class Checkjar extends BaseCommand {
ru: client.translate("iat/checkjar:DESCRIPTION", null, "ru-RU"), ru: client.translate("iat/checkjar:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -55,18 +48,16 @@ class Checkjar extends BaseCommand {
}, },
}).then(res => res.json()); }).then(res => res.json());
const embed = new EmbedBuilder() const embed = client.embed({
.setColor(client.config.embed.color) description: `Текущий баланс: **${jar.balance / Math.pow(10, 2)}** грн\nТребуется на след. месяц: **379,18** грн (по курсу евро на 02.07.2023).\nЗдесь указаны последние 10 транзакций.`,
.setFooter(client.config.embed.footer) });
.setTimestamp()
.setDescription(`Текущий баланс: **${jar.balance / Math.pow(10, 2)}** грн\nТребуется на след. месяц: **379,18** грн (по курсу евро на 02.07.2023).\nЗдесь указаны последние 10 транзакций.`);
jarTransactions.length = 10; jarTransactions.length = 10;
jarTransactions.forEach(t => { jarTransactions.forEach(t => {
const time = moment.unix(t.time); const time = moment.unix(t.time);
embed.addFields([ embed.data.fields.push([
{ {
name: `${t.description}`, name: `${t.description}`,
value: `Дата: ${time.locale("uk-UA").format("DD MMMM YYYY, HH:mm")}\nСумма: ${t.amount / Math.pow(10, 2)} грн`, value: `Дата: ${time.locale("uk-UA").format("DD MMMM YYYY, HH:mm")}\nСумма: ${t.amount / Math.pow(10, 2)} грн`,

View file

@ -45,18 +45,11 @@ class Clear extends BaseCommand {
ru: client.translate("common:USER_ID", null, "ru-RU"), ru: client.translate("common:USER_ID", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -27,18 +27,11 @@ class Clearwarns extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -124,18 +124,11 @@ class Giveaway extends BaseCommand {
.setRequired(true), .setRequired(true),
), ),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class Poll extends BaseCommand { class Poll extends BaseCommand {
@ -27,18 +27,11 @@ class Poll extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @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 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 notcool = client.emojis.cache.find(e => e.name === client.customEmojis.notcool.split(":")[1]);
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: interaction.translate("moderation/poll:TITLE"),
name: interaction.translate("moderation/poll:TITLE"), fields: [
})
.setColor(client.config.embed.color)
.addFields([
{ {
name: "\u200b", name: "\u200b",
value: question, value: question,
@ -112,7 +102,8 @@ class Poll extends BaseCommand {
error: notcool.toString(), error: notcool.toString(),
}), }),
}, },
]); ],
});
return interaction.channel.send({ return interaction.channel.send({
content: mention, content: mention,

View file

@ -27,18 +27,11 @@ class Unban extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -27,19 +27,11 @@ class Ban extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class WarnContext extends BaseCommand { class WarnContext extends BaseCommand {
@ -13,18 +13,11 @@ class WarnContext extends BaseCommand {
.setType(ApplicationCommandType.User) .setType(ApplicationCommandType.User)
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages), .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -89,21 +82,25 @@ class WarnContext extends BaseCommand {
reason, reason,
}; };
const embed = new EmbedBuilder().addFields([ const embed = client.embed({
{ author: interaction.translate("moderation/warn:WARN"),
name: interaction.translate("common:USER"), fields: [
value: `\`${member.user.getUsername()}\` (${member.user.toString()})`, {
}, 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:MODERATOR"),
{ value: `\`${interaction.user.getUsername()}\` (${interaction.user.toString()})`,
name: interaction.translate("common:REASON"), },
value: reason, {
inline: true, name: interaction.translate("common:REASON"),
}, value: reason,
]); inline: true,
},
],
});
/* /*
if (banCount) { if (banCount) {
if (sanctions >= 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 try {
.setAuthor({ await member.send({
name: interaction.translate("moderation/warn:WARN"), content: interaction.translate("moderation/warn:WARNED_DM", {
}) user: member.user.getUsername(),
.setColor(client.config.embed.color); 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); memberData.sanctions.push(caseInfo);

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder, PermissionsBitField, EmbedBuilder } = require("discord.js"); const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Warns extends BaseCommand { class Warns extends BaseCommand {
@ -27,18 +27,11 @@ class Warns extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -54,34 +47,30 @@ class Warns extends BaseCommand {
guildId: interaction.guildId, guildId: interaction.guildId,
}); });
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: interaction.translate("moderation/warns:SANCTIONS_OF", { name: interaction.translate("moderation/warns:SANCTIONS_OF", {
member: member.user.getUsername(), member: member.user.getUsername(),
}), }),
iconURL: member.displayAvatarURL(), iconURL: member.displayAvatarURL(),
}) },
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer);
if (memberData.sanctions.length === 0) { if (memberData.sanctions.length === 0) {
embed.setDescription( embed.data.description = interaction.translate("moderation/warns:NO_SANCTIONS", {
interaction.translate("moderation/warns:NO_SANCTIONS", { member: member.user.getUsername(),
member: member.user.getUsername(), });
}),
);
return interaction.reply({ return interaction.reply({
embeds: [embed], embeds: [embed],
}); });
} else { } else {
memberData.sanctions.forEach(sanction => { memberData.sanctions.forEach(sanction => {
embed.addFields([ embed.data.fields.push({
{ name: sanction.type,
name: sanction.type, value: `${interaction.translate("common:MODERATOR")}: <@${sanction.moderator}>\n${interaction.translate("common:REASON")}: ${sanction.reason}`,
value: `${interaction.translate("common:MODERATOR")}: <@${sanction.moderator}>\n${interaction.translate("common:REASON")}: ${sanction.reason}`, inline: true,
inline: true, });
},
]);
}); });
} }

View file

@ -16,18 +16,11 @@ class Back extends BaseCommand {
ru: client.translate("music/back:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/back:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -29,18 +29,11 @@ class Clips extends BaseCommand {
.setRequired(true) .setRequired(true)
.setAutocomplete(true), .setAutocomplete(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -33,18 +33,11 @@ class Loop extends BaseCommand {
{ name: client.translate("music/loop:DISABLE"), value: "0" }, { name: client.translate("music/loop:DISABLE"), value: "0" },
), ),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -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"); { QueueRepeatMode } = require("discord-player");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
@ -17,11 +17,11 @@ class Nowplaying extends BaseCommand {
ru: client.translate("music/nowplaying:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/nowplaying:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -119,7 +119,7 @@ class Nowplaying extends BaseCommand {
ephemeral: true, 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"), 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(), 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], 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 * @param {import("../../base/Client")} client
@ -242,13 +243,10 @@ async function updateEmbed(interaction, queue) {
"0": interaction.translate("common:DISABLED"), "0": interaction.translate("common:DISABLED"),
}; };
const embed = interaction.client.embed({
const embed = new EmbedBuilder() author: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
.setAuthor({ thumbnail: track.thumbnail || null,
name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"), fields: [
})
.setThumbnail(track.thumbnail)
.addFields([
{ {
name: interaction.translate("music/nowplaying:T_TITLE"), name: interaction.translate("music/nowplaying:T_TITLE"),
value: `[${track.title}](${track.url})`, value: `[${track.title}](${track.url})`,
@ -278,10 +276,8 @@ async function updateEmbed(interaction, queue) {
name: "\u200b", name: "\u200b",
value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[mode]}\``, value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[mode]}\``,
}, },
]) ],
.setColor(interaction.client.config.embed.color) });
.setFooter(interaction.client.config.embed.footer)
.setTimestamp();
return embed; return embed;
} }

View file

@ -12,18 +12,11 @@ class PlayContext extends BaseCommand {
.setName("Add to Queue") .setName("Add to Queue")
.setType(ApplicationCommandType.Message) .setType(ApplicationCommandType.Message)
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class Play extends BaseCommand { class Play extends BaseCommand {
@ -27,18 +28,11 @@ class Play extends BaseCommand {
.setRequired(true) .setRequired(true)
.setAutocomplete(true), .setAutocomplete(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @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 }); if (!searchResult.hasTracks()) return interaction.error("music/play:NO_RESULT", { query }, { edit: true });
else { else {
const { queue } = await client.player.play(interaction.member.voice.channel, searchResult, { await client.player.play(interaction.member.voice.channel, searchResult, {
nodeOptions: { nodeOptions: {
metadata: interaction, metadata: interaction,
}, },
@ -78,13 +72,6 @@ class Play extends BaseCommand {
songName: searchResult.hasPlaylist() ? searchResult.playlist.title : searchResult.tracks[0].title, 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"); const query = interaction.options.getString("query");
if (query === "") return; if (query === "") return;
if (query.startsWith("http")) return interaction.respond([ if (query.startsWith("http"))
{ return interaction.respond([
name: "Current link", {
value: query, 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( youtubeResults.tracks
results.tracks.slice(0, 10).map(track => ({ .slice(0, 5)
name: (`${track.author} - ${track.title}`.length >= 100) & (`${track.author} - ${track.title}`.slice(0, 80) + "...") || `${track.author} - ${track.title}`, .map(t => ({
value: track.url, 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,
) : await interaction.respond([ }))
{ .forEach(t => tracks.push({ name: t.name, value: t.value }));
name: "Nothing",
value: "Nothing", 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);
} }
} }

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class Queue extends BaseCommand { class Queue extends BaseCommand {
@ -16,11 +16,11 @@ class Queue extends BaseCommand {
ru: client.translate("music/queue:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/queue:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -33,7 +33,7 @@ class Queue extends BaseCommand {
const queue = client.player.nodes.get(interaction.guildId); const queue = client.player.nodes.get(interaction.guildId);
if (!queue) return interaction.error("music/play:NOT_PLAYING"); 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; 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 * @param {import("../../base/Client")} client
@ -124,7 +125,7 @@ class Queue extends BaseCommand {
const queue = client.player.nodes.get(interaction.guildId); const queue = client.player.nodes.get(interaction.guildId);
if (!queue) return interaction.error("music/play:NOT_PLAYING"); 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( row = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("queue_prev_page").setStyle(ButtonStyle.Primary).setEmoji("⬅️"), new ButtonBuilder().setCustomId("queue_prev_page").setStyle(ButtonStyle.Primary).setEmoji("⬅️"),
new ButtonBuilder().setCustomId("queue_next_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.js").ChatInputCommandInteraction} interaction
* @param {import("discord-player").GuildQueue} queue * @param {import("discord-player").GuildQueue} queue
* @returns * @returns
*/ */
function generateQueueEmbeds(client, interaction, queue) { function generateQueueEmbeds(interaction, queue) {
const embeds = [], const embeds = [],
currentTrack = queue.currentTrack, currentTrack = queue.currentTrack,
translated = { translated = {
@ -166,16 +166,14 @@ function generateQueueEmbeds(client, interaction, queue) {
let k = 10; let k = 10;
if (!queue.tracks.size) { if (!queue.tracks.size) {
const embed = new EmbedBuilder() const embed = interaction.client.embed({
.setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING")) title: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
.setThumbnail(currentTrack.thumbnail) thumbnail: currentTrack.thumbnail || null,
.setColor(interaction.client.config.embed.color) description: `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[queue.repeatMode]}\`\n${
.setDescription( currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`
`${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[queue.repeatMode]}\`\n${ }\n> ${interaction.translate("music/queue:ADDED")} ${currentTrack.requestedBy}\n\n**${interaction.translate("music/queue:NEXT")}**\n${interaction.translate("music/queue:NO_QUEUE")}`,
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();
embeds.push(embed); embeds.push(embed);
return { embeds: embeds, size: embeds.length }; 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 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() const embed = interaction.client.embed({
.setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING")) title: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
.setThumbnail(currentTrack.thumbnail) thumbnail: currentTrack.thumbnail || null,
.setColor(interaction.client.config.embed.color) description: `${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[queue.repeatMode]}\`\n${
.setDescription( currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`
`${interaction.translate("music/nowplaying:REPEAT")}: \`${translated[queue.repeatMode]}\`\n${ }\n * ${interaction.translate("music/queue:ADDED")} ${currentTrack.requestedBy}\n\n**${interaction.translate("music/queue:NEXT")}**\n${info}`,
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();
embeds.push(embed); embeds.push(embed);
} }

View file

@ -25,18 +25,11 @@ class Seek extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -16,18 +16,11 @@ class Shuffle extends BaseCommand {
ru: client.translate("music/shuffle:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/shuffle:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -16,18 +16,11 @@ class Skip extends BaseCommand {
ru: client.translate("music/skip:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/skip:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -26,18 +26,11 @@ class Skipto extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -16,18 +16,11 @@ class Stop extends BaseCommand {
ru: client.translate("music/stop:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/stop:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -27,18 +27,11 @@ class Volume extends BaseCommand {
.setRequired(true) .setRequired(true)
.setAutocomplete(true), .setAutocomplete(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -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"), const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch"); fetch = require("node-fetch");
@ -17,11 +17,11 @@ class NSFW extends BaseCommand {
ru: client.translate("nsfw/nsfw:DESCRIPTION", null, "ru-RU"), ru: client.translate("nsfw/nsfw:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -33,23 +33,24 @@ class NSFW extends BaseCommand {
if (interaction.customId === "nsfw_select") { if (interaction.customId === "nsfw_select") {
await interaction.deferUpdate(); await interaction.deferUpdate();
const tag = interaction?.values[0]; const tag = interaction?.values[0],
const res = await fetch(`https://meme-api.com/gimme/${tag}`).then(response => response.json()); 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() const embed = client.embed({
.setColor(client.config.embed.color) title: "xd",
.setFooter(client.config.embed.footer) image: "attachment://image.jpeg",
.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();
await interaction.editReply({ await interaction.editReply({
embeds: [embed], embeds: [embed],
files: [image],
}); });
} }
}); });
} }
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -59,23 +60,23 @@ class NSFW extends BaseCommand {
async execute(client, interaction) { async execute(client, interaction) {
await interaction.deferReply({ ephemeral: true }); 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 => const tags = ["Hentai_Vanila", "Hentai_Yaoi", "Hentai_Yuri", "Hentai_BDSM", "Hentai_Trap", "Real_Ass", "Real_Boobs", "Real_Pussy"]
JSON.parse( .map(tag =>
JSON.stringify({ JSON.parse(
label: tag, JSON.stringify({
value: tag, 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({ await interaction.editReply({
content: interaction.translate("common:AVAILABLE_OPTIONS"), content: interaction.translate("common:AVAILABLE_OPTIONS"),
ephemeral: true, ephemeral: true,
fetchReply: true,
components: [row], components: [row],
}); });
} }

View file

@ -108,18 +108,11 @@ class Debug extends BaseCommand {
.setRequired(true), .setRequired(true),
), ),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true, ownerOnly: true,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -26,18 +26,11 @@ class Eval extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true, ownerOnly: true,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -29,18 +29,11 @@ class Reload extends BaseCommand {
.setRequired(true) .setRequired(true)
.setAutocomplete(true), .setAutocomplete(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true, ownerOnly: true,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -44,18 +44,11 @@ class Say extends BaseCommand {
ru: client.translate("common:ATTACHMENT", null, "ru-RU"), ru: client.translate("common:ATTACHMENT", null, "ru-RU"),
}), }),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true, ownerOnly: true,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class Servers extends BaseCommand { class Servers extends BaseCommand {
@ -16,18 +16,11 @@ class Servers extends BaseCommand {
ru: client.translate("owner/servers:DESCRIPTION", null, "ru-RU"), ru: client.translate("owner/servers:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true, ownerOnly: true,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client
@ -128,12 +121,11 @@ function generateServersEmbeds(interaction, servers) {
) )
.join("\n"); .join("\n");
const embed = new EmbedBuilder() const embed = interaction.client.embed({
.setTitle(interaction.translate("owner/servers:SERVERS_LIST")) title: interaction.translate("owner/servers:SERVERS_LIST"),
.setDescription(info) Description: info,
.setColor(interaction.client.config.embed.color) });
.setFooter(interaction.client.config.embed.footer)
.setTimestamp();
embeds.push(embed); embeds.push(embed);
} }

View file

@ -27,19 +27,11 @@ class AddUser extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class CloseTicket extends BaseCommand { class CloseTicket extends BaseCommand {
@ -17,19 +17,11 @@ class CloseTicket extends BaseCommand {
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages), .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @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 }); if (!interaction.channel.name.includes("support")) return interaction.error("tickets/adduser:NOT_TICKET", null, { ephemeral: true, edit: true });
const embed = new EmbedBuilder() const embed = client.embed({
.setTitle(interaction.translate("tickets/closeticket:CLOSING_TITLE")) title: interaction.translate("tickets/closeticket:CLOSING_TITLE"),
.setDescription(interaction.translate("tickets/closeticket:CLOSING_DESC")) description: interaction.translate("tickets/closeticket:CLOSING_DESC"),
.addFields( fields: [
{ {
name: interaction.translate("common:TICKET"), name: interaction.translate("common:TICKET"),
value: interaction.channel.name, value: interaction.channel.name,
@ -53,10 +45,8 @@ class CloseTicket extends BaseCommand {
name: interaction.translate("tickets/closeticket:CLOSING_BY"), name: interaction.translate("tickets/closeticket:CLOSING_BY"),
value: interaction.user.getUsername(), 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 button = new ButtonBuilder().setCustomId("cancel_closing").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Danger);
const row = new ActionRowBuilder().addComponents(button); const row = new ActionRowBuilder().addComponents(button);
@ -91,12 +81,10 @@ class CloseTicket extends BaseCommand {
if (ticketLogs) { if (ticketLogs) {
const logChannel = interaction.guild.channels.cache.get(ticketLogs); const logChannel = interaction.guild.channels.cache.get(ticketLogs);
const logEmbed = new EmbedBuilder() const logEmbed = client.embed({
.setTitle(interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE")) title: interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE"),
.setDescription(`${interaction.user.toString()} (${interaction.channel.toString()})`) description: `${interaction.user.toString()} (${interaction.channel.toString()})`,
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer)
.setTimestamp();
logChannel.send({ embeds: [logEmbed] }); logChannel.send({ embeds: [logEmbed] });
} }
@ -109,7 +97,7 @@ class CloseTicket extends BaseCommand {
files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }], files: [{ attachment: Buffer.from(transcript), name: `${interaction.channel.name}.txt` }],
}); });
} catch (e) { } 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); 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 ticketLogs = data.guildData.plugins.tickets.ticketLogs;
const logEmbed = new EmbedBuilder() const logEmbed = client.embed({
.setTitle(interaction.translate("tickets/closeticket:CLOSED_TITLE")) title: interaction.translate("tickets/closeticket:CLOSED_TITLE"),
.addFields( fields: [
{ {
name: interaction.translate("common:TICKET"), name: interaction.translate("common:TICKET"),
value: interaction.channel.name, value: interaction.channel.name,
@ -130,10 +118,8 @@ class CloseTicket extends BaseCommand {
name: interaction.translate("tickets/closeticket:CLOSING_BY"), name: interaction.translate("tickets/closeticket:CLOSING_BY"),
value: interaction.user.getUsername(), 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] }); if (ticketLogs) interaction.guild.channels.cache.get(ticketLogs).send({ embeds: [logEmbed] });
} }

View file

@ -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"); const BaseCommand = require("../../base/BaseCommand");
class CreateTicketEmbed extends BaseCommand { class CreateTicketEmbed extends BaseCommand {
@ -17,7 +17,6 @@ class CreateTicketEmbed extends BaseCommand {
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild), .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
@ -72,12 +71,10 @@ class CreateTicketEmbed extends BaseCommand {
}); });
const logChannel = interaction.guild.channels.cache.get(ticketLogs); const logChannel = interaction.guild.channels.cache.get(ticketLogs);
const logEmbed = new EmbedBuilder() const logEmbed = client.embed({
.setTitle(interaction.translate("tickets/createticketembed:TICKET_CREATED_TITLE")) title: interaction.translate("tickets/createticketembed:TICKET_CREATED_TITLE"),
.setDescription(`${interaction.user.toString()} (${channel.toString()})`) description: `${interaction.user.toString()} (${channel.toString()})`,
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer)
.setTimestamp();
await logChannel.send({ embeds: [logEmbed] }); await logChannel.send({ embeds: [logEmbed] });
await interaction.success("tickets/createticketembed:TICKET_CREATED", { await interaction.success("tickets/createticketembed:TICKET_CREATED", {
@ -86,13 +83,14 @@ class CreateTicketEmbed extends BaseCommand {
await channel.send(`<@${interaction.user.id}>`); await channel.send(`<@${interaction.user.id}>`);
const embed = new EmbedBuilder() const embed = client.embed({
.setTitle("Support Ticket") author: {
.setAuthor({ name: interaction.user.getUsername(), iconURL: interaction.user.displayAvatarURL() }) name: interaction.user.getUsername(),
.setDescription(interaction.translate("tickets/createticketembed:TICKET_CREATED_DESC")) iconURL: interaction.user.displayAvatarURL(),
.setColor(client.config.embed.color) },
.setFooter(client.config.embed.footer) title: "Support Ticket",
.setTimestamp(); description: interaction.translate("tickets/createticketembed:TICKET_CREATED_DESC"),
});
const closeButton = new ButtonBuilder() const closeButton = new ButtonBuilder()
.setCustomId("close_ticket") .setCustomId("close_ticket")
@ -106,10 +104,10 @@ class CreateTicketEmbed extends BaseCommand {
await channel.send({ embeds: [embed], components: [row] }); await channel.send({ embeds: [embed], components: [row] });
} else if (button.customId === "close_ticket") { } else if (button.customId === "close_ticket") {
const embed = new EmbedBuilder() const embed = client.embed({
.setTitle(interaction.translate("tickets/closeticket:CLOSING_TITLE")) title: interaction.translate("tickets/closeticket:CLOSING_TITLE"),
.setDescription(interaction.translate("tickets/closeticket:CLOSING_DESC")) description: interaction.translate("tickets/closeticket:CLOSING_DESC"),
.addFields( fields: [
{ {
name: interaction.translate("common:TICKET"), name: interaction.translate("common:TICKET"),
value: interaction.channel.name, value: interaction.channel.name,
@ -118,10 +116,8 @@ class CreateTicketEmbed extends BaseCommand {
name: interaction.translate("tickets/closeticket:CLOSING_BY"), name: interaction.translate("tickets/closeticket:CLOSING_BY"),
value: interaction.user.getUsername(), 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 button = new ButtonBuilder().setCustomId("cancel_closing").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Danger);
const row = new ActionRowBuilder().addComponents(button); 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 reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
const messages = Array.from(reversedMessages.values()).reverse(); const messages = Array.from(reversedMessages.values()).reverse();
let transcript = "---- TICKET CREATED ----\n"; if (messages.length > 1) {
messages.forEach(message => { let transcript = "---- TICKET CREATED ----\n";
transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`; messages.forEach(message => {
}); transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\n`;
transcript += "---- TICKET CLOSED ----"; });
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 logChannel = interaction.guild.channels.cache.get(ticketLogs);
const logEmbed = new EmbedBuilder() const logEmbed = client.embed({
.setTitle(interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE")) title: interaction.translate("tickets/createticketembed:TICKET_CLOSED_TITLE"),
.setDescription(`${interaction.user.toString()} (${interaction.channel.toString()})`) description: `${interaction.user.toString()} (${interaction.channel.toString()})`,
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer)
.setTimestamp();
logChannel.send({ embeds: [logEmbed] }); logChannel.send({ embeds: [logEmbed] });
interaction.channel.send("Closed!"); 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); 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.permissionOverwrites.edit(member, { ViewChannel: false, SendMessages: null });
await interaction.channel.setName(`${interaction.channel.name}-closed`); 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 reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
const messages = Array.from(reversedMessages.values()).reverse(); const messages = Array.from(reversedMessages.values()).reverse();
let transcript = "---- TICKET CREATED ----\n"; if (messages.length > 1) {
messages.forEach(message => { let transcript = "---- TICKET CREATED ----\n";
transcript += `[${client.functions.printDate(client, message.createdTimestamp, null, interaction.getLocale())}] ${message.author.getUsername()}: ${message.content}\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` }],
}); });
} catch (error) { transcript += "---- TICKET CLOSED ----\n";
await interaction.followUp({ content: interaction.translate("misc:CANT_DM"), ephemeral: true });
} 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 * @param {import("../../base/Client")} client
@ -213,11 +213,10 @@ class CreateTicketEmbed extends BaseCommand {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const embed = new EmbedBuilder() const embed = client.embed({
.setTitle(interaction.translate("tickets/createticketembed:TICKET_TITLE")) title: interaction.translate("tickets/createticketembed:TICKET_TITLE"),
.setDescription(interaction.translate("tickets/createticketembed:TICKET_DESC")) description: interaction.translate("tickets/createticketembed:TICKET_DESC"),
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer);
const supportButton = new ButtonBuilder().setCustomId("support_ticket").setLabel(interaction.translate("tickets/createticketembed:TICKET_SUPPORT")).setStyle(ButtonStyle.Primary); const supportButton = new ButtonBuilder().setCustomId("support_ticket").setLabel(interaction.translate("tickets/createticketembed:TICKET_SUPPORT")).setStyle(ButtonStyle.Primary);
const row = new ActionRowBuilder().addComponents(supportButton); const row = new ActionRowBuilder().addComponents(supportButton);

View file

@ -27,19 +27,11 @@ class RemoveUser extends BaseCommand {
}) })
.setRequired(true), .setRequired(true),
), ),
aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
}); });
} }
/**
*
* @param {import("../../base/Client")} client
*/
async onLoad() {
//...
}
/** /**
* *
* @param {import("../../base/Client")} client * @param {import("../../base/Client")} client

View file

@ -216,8 +216,8 @@ module.exports.load = async client => {
}); });
await Dashboard.init().then(() => { 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 => { }).catch(err => {
client.logger.log(`Dashboard failed to initialize:\n${err}`, "error"); client.logger.error(`Dashboard failed to initialize:\n${err}`);
}); });
}; };

View file

@ -56,7 +56,7 @@ class CommandHandler extends BaseEvent {
interaction.user.send(args); 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); return command.execute(client, interaction, data);
} }

View file

@ -1,5 +1,4 @@
const { EmbedBuilder } = require("discord.js"), const BaseEvent = require("../../base/BaseEvent");
BaseEvent = require("../../base/BaseEvent");
class guildBanAdd extends BaseEvent { class guildBanAdd extends BaseEvent {
constructor() { constructor() {
@ -15,18 +14,19 @@ class guildBanAdd extends BaseEvent {
* @param {import("discord.js").GuildBan} ban * @param {import("discord.js").GuildBan} ban
*/ */
async execute(client, ban) { async execute(client, ban) {
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: client.user.getUsername(), name: client.user.getUsername(),
iconURL: ban.guild.iconURL(), iconURL: ban.guild.iconURL(),
}) },
.setColor(client.config.embed.color) description: `You were banned from **${ban.guild.name}**!\nReason: **${ban.reason || "Not specified"}**`,
.setFooter(client.config.embed.footer)
.setDescription(`You were banned from **${ban.guild.name}**!\nReason: **${ban.reason || "Not specified"}**`);
ban.user.send({
embeds: [embed],
}); });
try {
ban.user.send({
embeds: [embed],
});
} catch (e) { /**/ }
} }
} }

View file

@ -1,5 +1,4 @@
const { EmbedBuilder } = require("discord.js"), const BaseEvent = require("../../base/BaseEvent");
BaseEvent = require("../../base/BaseEvent");
class GuildCreate extends BaseEvent { class GuildCreate extends BaseEvent {
constructor() { constructor() {
@ -25,40 +24,40 @@ class GuildCreate extends BaseEvent {
await userData.save(); await userData.save();
} }
const thanks = new EmbedBuilder() const thanks = client.embed({
.setAuthor({ author: "Thanks for inviting me to your server!",
name: "Thanks for inviting me to your server!", description: "Use </help:1029832476077596773> in your server to get list of all commands!.",
}) });
.setDescription("Use </help:1029832476077596773> in your server to get list of all commands!.")
.setColor(client.config.embed.color)
.setFooter(client.config.embed.footer)
.setTimestamp();
const owner = await guild.fetchOwner(); try {
owner.send({ const owner = await guild.fetchOwner();
files: [ owner.send({
{ files: [
name: "unlocked.png", {
attachment: "./assets/img/achievements/achievement_unlocked7.png", 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(),
}, },
], 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"))}`,
embeds: [thanks], });
});
const users = guild.members.cache.filter(m => !m.user.bot).size; client.channels.cache.get(client.config.support.logs).send({
const bots = guild.members.cache.filter(m => m.user.bot).size; embeds: [embed],
});
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],
});
} }
} }

View file

@ -1,5 +1,4 @@
const { EmbedBuilder } = require("discord.js"), const BaseEvent = require("../../base/BaseEvent");
BaseEvent = require("../../base/BaseEvent");
class GuildDelete extends BaseEvent { class GuildDelete extends BaseEvent {
constructor() { constructor() {
@ -15,17 +14,19 @@ class GuildDelete extends BaseEvent {
* @param {import("discord.js").Guild} guild * @param {import("discord.js").Guild} guild
*/ */
async execute(client, guild) { async execute(client, guild) {
const embed = new EmbedBuilder() if (client.config.support.logs) {
.setAuthor({ const embed = client.embed({
name: guild.name, author: {
iconURL: guild.iconURL(), name: guild.name,
}) iconURL: guild.iconURL(),
.setColor(client.config.embed.color) },
.setFooter(client.config.embed.footer) description: `Left from guild **${guild.name}**.`,
.setDescription(`Вышел с сервера **${guild.name}**.`); });
client.channels.cache.get(client.config.support.logs).send({
embeds: [embed], client.channels.cache.get(client.config.support.logs).send({
}); embeds: [embed],
});
}
} }
} }

View file

@ -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 BaseEvent = require("../base/BaseEvent");
const xpCooldown = {}; const xpCooldown = {};
@ -46,19 +46,19 @@ class MessageCreate extends BaseEvent {
messageId = ids[2]; messageId = ids[2];
const msg = await message.guild.channels.cache.get(channelId).messages.fetch(messageId); const msg = await message.guild.channels.cache.get(channelId).messages.fetch(messageId);
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: message.translate("misc:QUOTE_TITLE", { name: message.translate("misc:QUOTE_TITLE", {
user: msg.author.getUsername(), user: msg.author.getUsername(),
}), }),
iconURL: "https://wynem.com/assets/images/icons/quote.webp", iconURL: "https://wynem.com/assets/images/icons/quote.webp",
}) },
.setThumbnail(msg.author.displayAvatarURL()) thumbnail: msg.author.displayAvatarURL(),
.setFooter({ footer: {
text: message.translate("misc:QUOTE_FOOTER", { user: message.author.getUsername() }), text: message.translate("misc:QUOTE_FOOTER", { user: message.author.getUsername() }),
}) },
.setColor(client.config.embed.color) timestamp: msg.createdTimestamp,
.setTimestamp(msg.createdTimestamp); });
if (msg.content !== "") embed.addFields([ if (msg.content !== "") embed.addFields([
{ {

View file

@ -1,5 +1,4 @@
const { EmbedBuilder } = require("discord.js"), const BaseEvent = require("../../base/BaseEvent");
BaseEvent = require("../../base/BaseEvent");
class messageDelete extends BaseEvent { class messageDelete extends BaseEvent {
constructor() { constructor() {
@ -21,15 +20,14 @@ class messageDelete extends BaseEvent {
const guildData = await client.findOrCreateGuild(message.guildId); const guildData = await client.findOrCreateGuild(message.guildId);
if (guildData.plugins?.monitoring?.messageDelete) { if (guildData.plugins?.monitoring?.messageDelete) {
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: message.author.getUsername(), name: message.author.getUsername(),
iconURL: message.author.displayAvatarURL(), iconURL: message.author.displayAvatarURL(),
}) },
.setColor(client.config.embed.color) title: `${message.author.getUsername()} deleted a message!`,
.setFooter(client.config.embed.footer) description: `Message content was: \`\`\`${message.content}\`\`\``,
.setTitle(`${message.author.getUsername()} deleted a message!`) });
.setDescription(`Message content was: \`\`\`${message.content}\`\`\``);
message.guild.channels.cache.get(guildData.plugins.monitoring.messageDelete).send({ message.guild.channels.cache.get(guildData.plugins.monitoring.messageDelete).send({
embeds: [embed], embeds: [embed],

View file

@ -1,5 +1,4 @@
const { EmbedBuilder } = require("discord.js"), const BaseEvent = require("../../base/BaseEvent");
BaseEvent = require("../../base/BaseEvent");
class messageUpdate extends BaseEvent { class messageUpdate extends BaseEvent {
constructor() { constructor() {
@ -24,15 +23,14 @@ class messageUpdate extends BaseEvent {
const guildData = await client.findOrCreateGuild(oldMessage.guildId); const guildData = await client.findOrCreateGuild(oldMessage.guildId);
if (guildData.plugins?.monitoring?.messageUpdate) { if (guildData.plugins?.monitoring?.messageUpdate) {
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: {
name: newMessage.author.getUsername(), name: newMessage.author.getUsername(),
iconURL: newMessage.author.displayAvatarURL(), iconURL: newMessage.author.displayAvatarURL(),
}) },
.setColor(client.config.embed.color) title: `${newMessage.author.getUsername()} edited a message!`,
.setFooter(client.config.embed.footer) description: `Old Message: \`\`\`${oldMessage.content}\`\`\`\nNew Message: \`\`\`${newMessage.content}\`\`\`\nJump to message: ${newMessage.url}`,
.setTitle(`${newMessage.author.getUsername()} edited a message!`) });
.setDescription(`Old Message: \`\`\`${oldMessage.content}\`\`\`\nNew Message: \`\`\`${newMessage.content}\`\`\`\nJump to message: ${newMessage.url}`);
newMessage.guild.channels.cache.get(guildData.plugins.monitoring.messageUpdate).send({ newMessage.guild.channels.cache.get(guildData.plugins.monitoring.messageUpdate).send({
embeds: [embed], embeds: [embed],

View file

@ -1,4 +1,4 @@
const { PermissionsBitField, ActivityType } = require("discord.js"); const { ActivityType } = require("discord.js");
const BaseEvent = require("../base/BaseEvent"); const BaseEvent = require("../base/BaseEvent");
class Ready extends BaseEvent { class Ready extends BaseEvent {
@ -31,9 +31,8 @@ class Ready extends BaseEvent {
if (client.config.dashboard.enabled) await client.dashboard.load(client); if (client.config.dashboard.enabled) await client.dashboard.load(client);
client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready"); client.logger.ready(`Loaded a total of ${commands.length} command(s).`);
client.logger.log(`${client.user.getUsername()}, ready to serve ${tUsers} members in ${tServers} servers.`, "ready"); client.logger.ready(`${client.user.getUsername()}, ready to serve ${tUsers} members in ${tServers} servers.`);
client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [PermissionsBitField.Flags.Administrator] })}`, "ready");
console.timeEnd("botReady"); console.timeEnd("botReady");

View file

@ -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`; 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 => { categories.sort().forEach(cat => {
const categoriesArray = [["Name", "Description", "Usage", "Accessible in"]]; const categoriesArray = [["Name", "Description", "Usage", "Accessible in"]];
const cmds = [...new Map(commands.filter(cmd => cmd.category === cat).map(v => [v.constructor.name, v])).values()]; 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; else return 1;
}).forEach(cmd => { }).forEach(cmd => {
categoriesArray.push([ categoriesArray.push([
`**${cmd.command.name}** ${cmd.aliases.length ? `**(${cmd.aliases.join(", ")})**` : ""}`, `**${cmd.command.name}**`,
client.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`), 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.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`; 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"); if (!fs.existsSync("./dashboard/public/docs")) fs.mkdirSync("./dashboard/public/docs");
fs.writeFileSync("./dashboard/public/docs/commands.md", text); fs.writeFileSync("./dashboard/public/docs/commands.md", text);
client.logger.log("Dashboard docs updated!"); client.logger.log("Dashboard docs updated!");
}; };

View file

@ -1,11 +1,10 @@
const { CronJob } = require("cron"), const { CronJob } = require("cron");
{ EmbedBuilder } = require("discord.js");
/** /**
* *
* @param {import("../base/Client")} client * @param {import("../base/Client")} client
*/ */
module.exports.init = async function (client) { module.exports.init = async client => {
const cronjob = new CronJob("0 5 * * *", async function () { const cronjob = new CronJob("0 5 * * *", async function () {
client.guilds.cache.forEach(async guild => { client.guilds.cache.forEach(async guild => {
const guildData = await client.findOrCreateGuild(guild.id); const guildData = await client.findOrCreateGuild(guild.id);
@ -22,35 +21,34 @@ module.exports.init = async function (client) {
for (const user of users) { for (const user of users) {
if (!guild.members.cache.find(m => m.id === user.id)) return; 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(), day = userDate.getDate(),
month = userDate.getMonth(), month = userDate.getMonth(),
year = userDate.getFullYear(), year = userDate.getFullYear(),
age = currentYear - year; age = currentYear - year;
if (currentMonth === month && currentDay === day) { if (currentMonth === month && currentDay === day) {
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: client.user.getUsername(),
name: client.user.getUsername(), fields: [
iconURL: client.user.displayAvatarURL(),
})
.setColor(client.config.embed.color)
.setFooter(client.config.embed.footer)
.addFields([
{ {
name: client.translate("economy/birthdate:HAPPY_BIRTHDAY", null, guildData.language), name: client.translate("economy/birthdate:HAPPY_BIRTHDAY", null, guildData.language),
value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", { value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", {
name: user.username,
user: user.id, 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), }, 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(); cronjob.start();
}; };
module.exports.run = async function (client) { module.exports.run = async client => {
client.guilds.cache.forEach(async guild => { client.guilds.cache.forEach(async guild => {
const guildData = await client.findOrCreateGuild(guild.id); const guildData = await client.findOrCreateGuild(guild.id);
@ -88,28 +86,27 @@ module.exports.run = async function (client) {
age = currentYear - year; age = currentYear - year;
if (currentMonth === month && currentDay === day) { if (currentMonth === month && currentDay === day) {
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: client.user.getUsername(),
name: client.user.getUsername(), fields: [
iconURL: client.user.displayAvatarURL(),
})
.setColor(client.config.embed.color)
.setFooter(client.config.embed.footer)
.addFields([
{ {
name: client.translate("economy/birthdate:HAPPY_BIRTHDAY", null, guildData.language), name: client.translate("economy/birthdate:HAPPY_BIRTHDAY", null, guildData.language),
value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", { value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", {
name: user.username,
user: user.id, 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), }, guildData.language),
}, },
]); ],
const msg = await channel.send({
embeds: [embed],
}); });
await msg.react("🎉");
channel.send({
embeds: [embed],
}).then(m => m.react("🎉"));
} }
} }
}); });

View file

@ -1,4 +1,3 @@
const { EmbedBuilder } = require("discord.js");
const moment = require("moment"); const moment = require("moment");
/** /**
@ -25,11 +24,9 @@ module.exports.init = function (client) {
if (mustSent.length > 0) { if (mustSent.length > 0) {
mustSent.forEach(r => { mustSent.forEach(r => {
const embed = new EmbedBuilder() const embed = client.embed({
.setAuthor({ author: client.translate("general/remindme:EMBED_TITLE"),
name: client.translate("general/remindme:EMBED_TITLE"), fields: [
})
.addFields([
{ {
name: client.translate("general/remindme:EMBED_CREATED"), name: client.translate("general/remindme:EMBED_CREATED"),
value: moment(r.createdAt).locale(client.defaultLanguage).format("Do MMMM YYYY, HH:mm:ss"), 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"), name: client.translate("common:MESSAGE"),
value: r.message, value: r.message,
}, },
]) ],
.setColor(client.config.embed.color) });
.setFooter(client.config.embed.footer);
cachedUser.send({ cachedUser.send({
embeds: [embed], embeds: [embed],
}); });
}); });
user.reminds = user.reminds.filter(r => r.sendAt >= dateNow); user.reminds = user.reminds.filter(r => r.sendAt >= dateNow);
user.markModified("reminds"); user.markModified("reminds");

View file

@ -1,4 +1,3 @@
const { PermissionsBitField, ChannelType } = require("discord.js");
const moment = require("moment"); const moment = require("moment");
moment.relativeTimeThreshold("ss", 5); moment.relativeTimeThreshold("ss", 5);
@ -9,20 +8,6 @@ moment.relativeTimeThreshold("d", 24);
moment.relativeTimeThreshold("M", 12); moment.relativeTimeThreshold("M", 12);
module.exports = { 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 * Calls a Callback for Each Element in Collection Asynchronously
* @param {Array} collection Collection * @param {Array} collection Collection

Some files were not shown because too many files have changed in this diff Show more