This commit is contained in:
Jonny_Bro (Nikita) 2023-07-05 00:58:06 +05:00
parent 0fb732b1d0
commit c3dca64be4
109 changed files with 2403 additions and 2864 deletions

11
.prettierrc Normal file
View file

@ -0,0 +1,11 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "lf",
"printWidth": 250,
"semi": true,
"tabWidth": 4,
"trailingComma": "all",
"useTabs": true,
"parser": "babel"
}

View file

@ -19,7 +19,7 @@ class BaseCommand {
/** /**
* @type {String} * @type {String}
*/ */
this.category = (this.dirname ? this.dirname.split(path.sep)[parseInt(this.dirname.split(path.sep).length - 1, 10)] : "Other"); this.category = this.dirname ? this.dirname.split(path.sep)[parseInt(this.dirname.split(path.sep).length - 1, 10)] : "Other";
} }
} }

View file

@ -9,7 +9,9 @@ module.exports = mongoose.model("Guild", new Schema({
members: [{ type: Schema.Types.ObjectId, ref: "Member" }], members: [{ type: Schema.Types.ObjectId, ref: "Member" }],
language: { type: String, default: languages.find(l => l.default).name }, language: { type: String, default: languages.find(l => l.default).name },
plugins: { type: Object, default: { plugins: {
type: Object,
default: {
welcome: { welcome: {
enabled: false, enabled: false,
message: null, message: null,
@ -44,5 +46,6 @@ module.exports = mongoose.model("Guild", new Schema({
reports: null, reports: null,
birthdays: null, birthdays: null,
modlogs: null, modlogs: null,
} }, },
},
})); }));

View file

@ -46,7 +46,7 @@ class JaBa extends Client {
else else
setTimeout(() => { setTimeout(() => {
if (m.deletable) m.delete(); if (m.deletable) m.delete();
}, (5 * 60 * 1000)); // m * s * ms }, 5 * 60 * 1000); // m * s * ms
}); });
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)));
@ -76,12 +76,15 @@ class JaBa extends Client {
async init() { async init() {
this.login(this.config.token); this.login(this.config.token);
mongoose.connect(this.config.mongoDB, { mongoose
.connect(this.config.mongoDB, {
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true, useUnifiedTopology: true,
}).then(() => { })
.then(() => {
this.logger.log("Connected to the Mongodb database.", "log"); this.logger.log("Connected to the Mongodb database.", "log");
}).catch(err => { })
.catch(err => {
this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error"); this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error");
}); });
@ -99,9 +102,7 @@ class JaBa extends Client {
async loadCommands(dir) { async loadCommands(dir) {
const rest = new REST().setToken(this.config.token), const rest = new REST().setToken(this.config.token),
filePath = path.join(__dirname, dir), filePath = path.join(__dirname, dir),
folders = (await fs.readdir(filePath)) folders = (await fs.readdir(filePath)).map(file => path.join(filePath, file)).filter(async path => (await fs.lstat(path)).isDirectory());
.map(file => path.join(filePath, file))
.filter(async path => (await fs.lstat(path)).isDirectory());
const commands = []; const commands = [];
for (let index = 0; index < folders.length; index++) { for (let index = 0; index < folders.length; index++) {
@ -122,13 +123,13 @@ class JaBa extends Client {
const aliases = []; const aliases = [];
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0)
command.aliases.forEach(alias => { command.aliases.forEach(alias => {
const command_alias = (command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? { ...command.command.toJSON() } : { ...command.command }; const command_alias = command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder ? { ...command.command.toJSON() } : { ...command.command };
command_alias.name = alias; command_alias.name = alias;
aliases.push(command_alias); aliases.push(command_alias);
this.commands.set(alias, command); this.commands.set(alias, command);
}); });
commands.push((command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? command.command.toJSON() : command.command, ...aliases); 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); 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})`);
@ -139,17 +140,13 @@ class JaBa extends Client {
try { try {
if (this.config.production) if (this.config.production)
await rest.put( await rest.put(Routes.applicationCommands(this.config.userId), {
Routes.applicationCommands(this.config.user), {
body: commands, body: commands,
}, });
);
else else
await rest.put( await rest.put(Routes.applicationGuildCommands(this.config.userId, this.config.support.id), {
Routes.applicationGuildCommands(this.config.user, this.config.support.id), {
body: commands, body: commands,
}, });
);
this.logger.log("Successfully registered application commands."); this.logger.log("Successfully registered application commands.");
} catch (err) { } catch (err) {

View file

@ -13,15 +13,21 @@ module.exports = mongoose.model("Member", new mongoose.Schema({
registeredAt: { type: Number, default: Date.now() }, registeredAt: { type: Number, default: Date.now() },
cooldowns: { type: Object, default: { cooldowns: {
type: Object,
default: {
work: 0, work: 0,
rob: 0, rob: 0,
} }, },
},
sanctions: { type: Array, default: [] }, sanctions: { type: Array, default: [] },
mute: { type: Object, default: { mute: {
type: Object,
default: {
muted: false, muted: false,
case: null, case: null,
endDate: null, endDate: null,
} }, },
},
})); }));

View file

@ -4,8 +4,7 @@ const mongoose = require("mongoose"),
const genToken = () => { const genToken = () => {
let token = ""; let token = "";
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwzy0123456789.-_"; const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwzy0123456789.-_";
for (let i = 0; i < 32; i++) for (let i = 0; i < 32; i++) token += characters.charAt(Math.floor(Math.random() * characters.length));
token += characters.charAt(Math.floor(Math.random() * characters.length));
return token; return token;
}; };
@ -20,7 +19,9 @@ const userSchema = new mongoose.Schema({
registeredAt: { type: Number, default: Date.now() }, registeredAt: { type: Number, default: Date.now() },
achievements: { type: Object, default: { achievements: {
type: Object,
default: {
married: { married: {
achieved: false, achieved: false,
progress: { progress: {
@ -70,11 +71,15 @@ const userSchema = new mongoose.Schema({
total: 1, total: 1,
}, },
}, },
} }, },
},
cooldowns: { type: Object, default: { cooldowns: {
type: Object,
default: {
rep: 0, rep: 0,
} }, },
},
afk: { type: String, default: null }, afk: { type: String, default: null },
reminds: { type: Array, default: [] }, reminds: { type: Array, default: [] },
@ -82,7 +87,7 @@ const userSchema = new mongoose.Schema({
apiToken: { type: String, default: genToken() }, apiToken: { type: String, default: genToken() },
}); });
userSchema.method("getAchievements", async function() { userSchema.method("getAchievements", async function () {
const canvas = Canvas.createCanvas(1800, 250), const canvas = Canvas.createCanvas(1800, 250),
ctx = canvas.getContext("2d"); ctx = canvas.getContext("2d");

View file

@ -12,7 +12,7 @@ class ImportMee6 extends BaseCommand {
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
.setName("importmee6") .setName("importmee6")
.setDescription(client.translate("economy/importmee6:DESCRIPTION")) .setDescription(client.translate("economy/importmee6:DESCRIPTION"))
.setDescriptionLocalizations({ "uk": client.translate("economy/importmee6:DESCRIPTION", null, "uk-UA") }) .setDescriptionLocalizations({ uk: client.translate("economy/importmee6:DESCRIPTION", null, "uk-UA"), ru: client.translate("economy/importmee6:DESCRIPTION", null, "ru-RU") })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,

View file

@ -13,8 +13,8 @@ class Memes extends BaseCommand {
.setName("memes") .setName("memes")
.setDescription(client.translate("fun/memes:DESCRIPTION")) .setDescription(client.translate("fun/memes:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/memes:DESCRIPTION", null, "uk-UA"), uk: client.translate("fun/memes:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("fun/memes:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/memes:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -39,14 +39,15 @@ class Memes extends BaseCommand {
await interaction.deferReply(); await interaction.deferReply();
const tags = ["funny", "memes", "dankmemes", "me_irl", "wholesomememes"].map(tag => const tags = ["funny", "memes", "dankmemes", "me_irl", "wholesomememes"].map(tag =>
JSON.parse(JSON.stringify({ JSON.parse(
JSON.stringify({
label: tag, label: tag,
value: tag, value: tag,
})), }),
),
); );
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(
.addComponents(
new StringSelectMenuBuilder() new StringSelectMenuBuilder()
.setCustomId("memes_select") .setCustomId("memes_select")
.setPlaceholder(client.translate("common:NOTHING_SELECTED")) .setPlaceholder(client.translate("common:NOTHING_SELECTED"))
@ -60,7 +61,7 @@ class Memes extends BaseCommand {
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
const collector = msg.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) }); const collector = msg.createMessageComponentCollector({ filter, idle: 2 * 60 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isStringSelectMenu() && i.customId === "memes_select") { if (i.isStringSelectMenu() && i.customId === "memes_select") {

View file

@ -12,8 +12,8 @@ class Staff extends BaseCommand {
.setName("staff") .setName("staff")
.setDescription(client.translate("general/staff:DESCRIPTION")) .setDescription(client.translate("general/staff:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/staff:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/staff:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/staff:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/staff:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -47,11 +47,14 @@ class Staff extends BaseCommand {
.addFields([ .addFields([
{ {
name: interaction.translate("general/staff:ADMINS"), name: interaction.translate("general/staff:ADMINS"),
value: (administrators.size > 0 ? administrators.map(a => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : interaction.translate("general/staff:NO_ADMINS")), value:
administrators.size > 0
? administrators.map(a => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n")
: interaction.translate("general/staff:NO_ADMINS"),
}, },
{ {
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) .setColor(client.config.embed.color)

View file

@ -12,25 +12,31 @@ class Automod extends BaseCommand {
.setName("automod") .setName("automod")
.setDescription(client.translate("administration/automod:DESCRIPTION")) .setDescription(client.translate("administration/automod:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/automod:DESCRIPTION", null, "uk-UA"), uk: client.translate("administration/automod:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("administration/automod:DESCRIPTION", null, "ru-RU"), ru: client.translate("administration/automod:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addBooleanOption(option => option.setName("state") .addBooleanOption(option =>
option
.setName("state")
.setDescription(client.translate("common:STATE")) .setDescription(client.translate("common:STATE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:STATE", null, "uk-UA"), uk: client.translate("common:STATE", null, "uk-UA"),
"ru": client.translate("common:STATE", null, "ru-RU"), ru: client.translate("common:STATE", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addChannelOption(option => option.setName("channel") )
.addChannelOption(option =>
option
.setName("channel")
.setDescription(client.translate("common:CHANNEL")) .setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:CHANNEL", null, "uk-UA"), uk: client.translate("common:CHANNEL", null, "uk-UA"),
"ru": client.translate("common:CHANNEL", null, "ru-RU"), ru: client.translate("common:CHANNEL", null, "ru-RU"),
}) })
.addChannelTypes(ChannelType.GuildText)), .addChannelTypes(ChannelType.GuildText),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,24 +12,30 @@ class Autorole extends BaseCommand {
.setName("autorole") .setName("autorole")
.setDescription(client.translate("administration/autorole:DESCRIPTION")) .setDescription(client.translate("administration/autorole:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/autorole:DESCRIPTION", null, "uk-UA"), uk: client.translate("administration/autorole:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("administration/autorole:DESCRIPTION", null, "ru-RU"), ru: client.translate("administration/autorole:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addBooleanOption(option => option.setName("state") .addBooleanOption(option =>
option
.setName("state")
.setDescription(client.translate("common:STATE")) .setDescription(client.translate("common:STATE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:STATE", null, "uk-UA"), uk: client.translate("common:STATE", null, "uk-UA"),
"ru": client.translate("common:STATE", null, "ru-RU"), ru: client.translate("common:STATE", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addRoleOption(option => option.setName("role") )
.addRoleOption(option =>
option
.setName("role")
.setDescription(client.translate("common:ROLE")) .setDescription(client.translate("common:ROLE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:ROLE", null, "uk-UA"), uk: client.translate("common:ROLE", null, "uk-UA"),
"ru": client.translate("common:ROLE", null, "ru-RU"), ru: client.translate("common:ROLE", null, "ru-RU"),
})), }),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,29 +12,35 @@ class Config extends BaseCommand {
.setName("config") .setName("config")
.setDescription(client.translate("administration/config:DESCRIPTION")) .setDescription(client.translate("administration/config:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/config:DESCRIPTION", null, "uk-UA"), uk: client.translate("administration/config:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("administration/config:DESCRIPTION", null, "ru-RU"), ru: client.translate("administration/config:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addSubcommand(subcommand => subcommand.setName("list") .addSubcommand(subcommand =>
subcommand
.setName("list")
.setDescription(client.translate("administration/config:LIST")) .setDescription(client.translate("administration/config:LIST"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/config:LIST", null, "uk-UA"), uk: client.translate("administration/config:LIST", null, "uk-UA"),
"ru": client.translate("administration/config:LIST", null, "ru-RU"), ru: client.translate("administration/config:LIST", null, "ru-RU"),
}), }),
) )
.addSubcommand(subcommand => subcommand.setName("set") .addSubcommand(subcommand =>
subcommand
.setName("set")
.setDescription(client.translate("administration/config:SET")) .setDescription(client.translate("administration/config:SET"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/config:SET", null, "uk-UA"), uk: client.translate("administration/config:SET", null, "uk-UA"),
"ru": client.translate("administration/config:SET", null, "ru-RU"), ru: client.translate("administration/config:SET", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("setting") .addStringOption(option =>
option
.setName("setting")
.setDescription(client.translate("administration/config:SETTING")) .setDescription(client.translate("administration/config:SETTING"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/config:SETTING", null, "uk-UA"), uk: client.translate("administration/config:SETTING", null, "uk-UA"),
"ru": client.translate("administration/config:SETTING", null, "ru-RU"), ru: client.translate("administration/config:SETTING", null, "ru-RU"),
}) })
.setChoices( .setChoices(
{ name: client.translate("administration/config:BIRTHDAYS"), value: "birthdays" }, { name: client.translate("administration/config:BIRTHDAYS"), value: "birthdays" },
@ -43,20 +49,27 @@ class Config extends BaseCommand {
{ name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" }, { name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" },
{ name: client.translate("administration/config:MESSAGEUPDATE"), value: "monitoring.messageUpdate" }, { name: client.translate("administration/config:MESSAGEUPDATE"), value: "monitoring.messageUpdate" },
) )
.setRequired(true)) .setRequired(true),
.addBooleanOption(option => option.setName("state") )
.addBooleanOption(option =>
option
.setName("state")
.setDescription(client.translate("common:STATE")) .setDescription(client.translate("common:STATE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:STATE", null, "uk-UA"), uk: client.translate("common:STATE", null, "uk-UA"),
"ru": client.translate("common:STATE", null, "ru-RU"), ru: client.translate("common:STATE", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addChannelOption(option => option.setName("channel") )
.addChannelOption(option =>
option
.setName("channel")
.setDescription(client.translate("common:CHANNEL")) .setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:CHANNEL", null, "uk-UA"), uk: client.translate("common:CHANNEL", null, "uk-UA"),
"ru": client.translate("common:CHANNEL", null, "ru-RU"), ru: client.translate("common:CHANNEL", null, "ru-RU"),
})), }),
),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
@ -94,7 +107,8 @@ class Config extends BaseCommand {
.addFields([ .addFields([
{ {
name: interaction.translate("administration/config:WELCOME_TITLE"), name: interaction.translate("administration/config:WELCOME_TITLE"),
value: guildData.plugins.welcome.enabled ? interaction.translate("administration/config:WELCOME_CONTENT", { value: guildData.plugins.welcome.enabled
? interaction.translate("administration/config:WELCOME_CONTENT", {
channel: `<#${guildData.plugins.welcome.channel}>`, channel: `<#${guildData.plugins.welcome.channel}>`,
withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"),
}) : interaction.translate("common:DISABLED"), }) : interaction.translate("common:DISABLED"),
@ -102,7 +116,8 @@ class Config extends BaseCommand {
}, },
{ {
name: interaction.translate("administration/config:GOODBYE_TITLE"), name: interaction.translate("administration/config:GOODBYE_TITLE"),
value: guildData.plugins.goodbye.enabled ? interaction.translate("administration/config:GOODBYE_CONTENT", { value: guildData.plugins.goodbye.enabled
? interaction.translate("administration/config:GOODBYE_CONTENT", {
channel: `<#${guildData.plugins.goodbye.channel}>`, channel: `<#${guildData.plugins.goodbye.channel}>`,
withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"),
}) : interaction.translate("common:DISABLED"), }) : interaction.translate("common:DISABLED"),
@ -110,20 +125,25 @@ class Config extends BaseCommand {
}, },
{ {
name: interaction.translate("administration/config:AUTOROLE_TITLE"), name: interaction.translate("administration/config:AUTOROLE_TITLE"),
value: guildData.plugins.autorole.enabled ? `<@&${guildData.plugins.autorole.role}>` value: guildData.plugins.autorole.enabled ? `<@&${guildData.plugins.autorole.role}>` : interaction.translate("common:DISABLED"),
: interaction.translate("common:DISABLED"),
}, },
{ {
name: interaction.translate("administration/config:AUTO_SANCTIONS"), name: interaction.translate("administration/config:AUTO_SANCTIONS"),
value: (guildData.plugins.warnsSanctions.kick ? interaction.translate("administration/config:KICK_CONTENT", { value:
(guildData.plugins.warnsSanctions.kick
? interaction.translate("administration/config:KICK_CONTENT", {
count: guildData.plugins.warnsSanctions.kick, count: guildData.plugins.warnsSanctions.kick,
}) : interaction.translate("administration/config:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? interaction.translate("administration/config:BAN_CONTENT", { }) : interaction.translate("administration/config:KICK_NOT_DEFINED")) +
"\n" +
(guildData.plugins.warnsSanctions.ban
? interaction.translate("administration/config:BAN_CONTENT", {
count: guildData.plugins.warnsSanctions.ban, count: guildData.plugins.warnsSanctions.ban,
}) : interaction.translate("administration/config:BAN_NOT_DEFINED")), }) : interaction.translate("administration/config:BAN_NOT_DEFINED")),
}, },
{ {
name: interaction.translate("administration/config:AUTOMOD_TITLE"), name: interaction.translate("administration/config:AUTOMOD_TITLE"),
value: guildData.plugins.automod.enabled ? interaction.translate("administration/config:AUTOMOD_CONTENT", { value: guildData.plugins.automod.enabled
? interaction.translate("administration/config:AUTOMOD_CONTENT", {
channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`), channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`),
}) : interaction.translate("common:DISABLED"), }) : interaction.translate("common:DISABLED"),
}, },
@ -189,8 +209,11 @@ async function changeSetting(interaction, setting, state, channel, guildData) {
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`, content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`,
ephemeral: true, ephemeral: true,
}); });
} else return interaction.reply({ } else
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${guildData.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${guildData.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`}`, return interaction.reply({
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${
guildData.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${guildData.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`
}`,
ephemeral: true, ephemeral: true,
}); });
} }

View file

@ -12,49 +12,65 @@ class Goodbye extends BaseCommand {
.setName("goodbye") .setName("goodbye")
.setDescription(client.translate("administration/goodbye:DESCRIPTION")) .setDescription(client.translate("administration/goodbye:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/goodbye:DESCRIPTION", null, "uk-UA"), uk: client.translate("administration/goodbye:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("administration/goodbye:DESCRIPTION", null, "ru-RU"), ru: client.translate("administration/goodbye:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addSubcommand(subcommand => subcommand.setName("test") .addSubcommand(subcommand =>
subcommand
.setName("test")
.setDescription(client.translate("administration/goodbye:TEST")) .setDescription(client.translate("administration/goodbye:TEST"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/goodbye:TEST", null, "uk-UA"), uk: client.translate("administration/goodbye:TEST", null, "uk-UA"),
"ru": client.translate("administration/goodbye:TEST", null, "ru-RU"), ru: client.translate("administration/goodbye:TEST", null, "ru-RU"),
}), }),
) )
.addSubcommand(subcommand => subcommand.setName("config") .addSubcommand(subcommand =>
subcommand
.setName("config")
.setDescription(client.translate("administration/goodbye:CONFIG")) .setDescription(client.translate("administration/goodbye:CONFIG"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/goodbye:CONFIG", null, "uk-UA"), uk: client.translate("administration/goodbye:CONFIG", null, "uk-UA"),
"ru": client.translate("administration/goodbye:CONFIG", null, "ru-RU"), ru: client.translate("administration/goodbye:CONFIG", null, "ru-RU"),
}) })
.addBooleanOption(option => option.setName("state") .addBooleanOption(option =>
option
.setName("state")
.setDescription(client.translate("common:STATE")) .setDescription(client.translate("common:STATE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:STATE", null, "uk-UA"), uk: client.translate("common:STATE", null, "uk-UA"),
"ru": client.translate("common:STATE", null, "ru-RU"), ru: client.translate("common:STATE", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addChannelOption(option => option.setName("channel") )
.addChannelOption(option =>
option
.setName("channel")
.setDescription(client.translate("common:CHANNEL")) .setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:CHANNEL", null, "uk-UA"), uk: client.translate("common:CHANNEL", null, "uk-UA"),
"ru": client.translate("common:CHANNEL", null, "ru-RU"), ru: client.translate("common:CHANNEL", null, "ru-RU"),
})) }),
.addStringOption(option => option.setName("message") )
.addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("administration/goodbye:MESSAGE")) .setDescription(client.translate("administration/goodbye:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/goodbye:MESSAGE", null, "uk-UA"), uk: client.translate("administration/goodbye:MESSAGE", null, "uk-UA"),
"ru": client.translate("administration/goodbye:MESSAGE", null, "ru-RU"), ru: client.translate("administration/goodbye:MESSAGE", null, "ru-RU"),
})) }),
.addBooleanOption(option => option.setName("image") )
.addBooleanOption(option =>
option
.setName("image")
.setDescription(client.translate("administration/goodbye:IMAGE")) .setDescription(client.translate("administration/goodbye:IMAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/goodbye:IMAGE", null, "uk-UA"), uk: client.translate("administration/goodbye:IMAGE", null, "uk-UA"),
"ru": client.translate("administration/goodbye:IMAGE", null, "ru-RU"), ru: client.translate("administration/goodbye:IMAGE", null, "ru-RU"),
})), }),
),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,

View file

@ -12,52 +12,68 @@ class Selectroles extends BaseCommand {
.setName("selectroles") .setName("selectroles")
.setDescription(client.translate("administration/selectroles:DESCRIPTION")) .setDescription(client.translate("administration/selectroles:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/selectroles:DESCRIPTION", null, "uk-UA"), uk: client.translate("administration/selectroles:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("administration/selectroles:DESCRIPTION", null, "ru-RU"), ru: client.translate("administration/selectroles:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addSubcommand(subcommand => subcommand.setName("message") .addSubcommand(subcommand =>
subcommand
.setName("message")
.setDescription(client.translate("administration/selectroles:MESSAGE")) .setDescription(client.translate("administration/selectroles:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/selectroles:MESSAGE", null, "uk-UA"), uk: client.translate("administration/selectroles:MESSAGE", null, "uk-UA"),
"ru": client.translate("administration/selectroles:MESSAGE", null, "ru-RU"), ru: client.translate("administration/selectroles:MESSAGE", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("text") .addStringOption(option =>
option
.setName("text")
.setDescription(client.translate("common:MESSAGE")) .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("common:MESSAGE", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("common:MESSAGE", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("addrole") .addSubcommand(subcommand =>
subcommand
.setName("addrole")
.setDescription(client.translate("administration/selectroles:ADDROLE")) .setDescription(client.translate("administration/selectroles:ADDROLE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/selectroles:ADDROLE", null, "uk-UA"), uk: client.translate("administration/selectroles:ADDROLE", null, "uk-UA"),
"ru": client.translate("administration/selectroles:ADDROLE", null, "ru-RU"), ru: client.translate("administration/selectroles:ADDROLE", null, "ru-RU"),
}) })
.addChannelOption(option => option.setName("channel") .addChannelOption(option =>
option
.setName("channel")
.setDescription(client.translate("common:CHANNEL")) .setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:CHANNEL", null, "uk-UA"), uk: client.translate("common:CHANNEL", null, "uk-UA"),
"ru": client.translate("common:CHANNEL", null, "ru-RU"), ru: client.translate("common:CHANNEL", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addStringOption(option => option.setName("message_id") )
.addStringOption(option =>
option
.setName("message_id")
.setDescription(client.translate("common:MESSAGE_ID")) .setDescription(client.translate("common:MESSAGE_ID"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE_ID", null, "uk-UA"), uk: client.translate("common:MESSAGE_ID", null, "uk-UA"),
"ru": client.translate("common:MESSAGE_ID", null, "ru-RU"), ru: client.translate("common:MESSAGE_ID", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addRoleOption(option => option.setName("role") )
.addRoleOption(option =>
option
.setName("role")
.setDescription(client.translate("common:ROLE")) .setDescription(client.translate("common:ROLE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:ROLE", null, "uk-UA"), uk: client.translate("common:ROLE", null, "uk-UA"),
"ru": client.translate("common:ROLE", null, "ru-RU"), ru: client.translate("common:ROLE", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
@ -123,10 +139,12 @@ class Selectroles extends BaseCommand {
let row = message.components[0]; let row = message.components[0];
if (!row) row = new ActionRowBuilder(); if (!row) row = new ActionRowBuilder();
const option = [{ const option = [
{
label: role.name, label: role.name,
value: role.id, value: role.id,
}]; },
];
const menu = row.components[0]; const menu = row.components[0];
if (menu) { if (menu) {
@ -134,22 +152,14 @@ class Selectroles extends BaseCommand {
if (o.value === option[0].value) return interaction.error("administration/selectroles:ALREADY_IN_MENU"); if (o.value === option[0].value) return interaction.error("administration/selectroles:ALREADY_IN_MENU");
} }
row = ActionRowBuilder.from(row) row = ActionRowBuilder.from(row).setComponents(
.setComponents(
StringSelectMenuBuilder.from(menu) StringSelectMenuBuilder.from(menu)
.setMinValues(0) .setMinValues(0)
.setMaxValues(menu.options.length + 1) .setMaxValues(menu.options.length + 1)
.addOptions(option), .addOptions(option),
); );
} else { } else {
row.addComponents( row.addComponents(new StringSelectMenuBuilder().setCustomId("auto_roles").setMinValues(0).setMaxValues(1).setPlaceholder(interaction.translate("common:AVAILABLE_OPTIONS")).addOptions(option));
new StringSelectMenuBuilder()
.setCustomId("auto_roles")
.setMinValues(0)
.setMaxValues(1)
.setPlaceholder(interaction.translate("common:AVAILABLE_OPTIONS"))
.addOptions(option),
);
} }
message.edit({ message.edit({

View file

@ -12,16 +12,18 @@ class Set extends BaseCommand {
.setName("set") .setName("set")
.setDescription(client.translate("administration/set:DESCRIPTION")) .setDescription(client.translate("administration/set:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/set:DESCRIPTION", null, "uk-UA"), uk: client.translate("administration/set:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("administration/set:DESCRIPTION", null, "ru-RU"), ru: client.translate("administration/set:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addStringOption(option => option.setName("type") .addStringOption(option =>
option
.setName("type")
.setDescription(client.translate("owner/debug:TYPE")) .setDescription(client.translate("owner/debug:TYPE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/debug:TYPE", null, "uk-UA"), uk: client.translate("owner/debug:TYPE", null, "uk-UA"),
"ru": client.translate("owner/debug:TYPE", null, "ru-RU"), ru: client.translate("owner/debug:TYPE", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setChoices( .setChoices(
@ -29,21 +31,28 @@ class Set extends BaseCommand {
{ name: client.translate("common:XP"), value: "xp" }, { name: client.translate("common:XP"), value: "xp" },
{ name: client.translate("common:CREDITS"), value: "credits" }, { name: client.translate("common:CREDITS"), value: "credits" },
{ name: client.translate("economy/transactions:BANK"), value: "bank" }, { name: client.translate("economy/transactions:BANK"), value: "bank" },
)) ),
.addUserOption(option => option.setName("user") )
.addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addIntegerOption(option => option.setName("int") )
.addIntegerOption(option =>
option
.setName("int")
.setDescription(client.translate("common:INT")) .setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:INT", null, "uk-UA"), uk: client.translate("common:INT", null, "uk-UA"),
"ru": client.translate("common:INT", null, "ru-RU"), ru: client.translate("common:INT", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,23 +12,22 @@ class Setlang extends BaseCommand {
.setName("setlang") .setName("setlang")
.setDescription(client.translate("administration/setlang:DESCRIPTION")) .setDescription(client.translate("administration/setlang:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/setlang:DESCRIPTION", null, "uk-UA"), uk: client.translate("administration/setlang:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("administration/setlang:DESCRIPTION", null, "ru-RU"), ru: client.translate("administration/setlang:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addStringOption(option => option.setName("language") .addStringOption(option =>
option
.setName("language")
.setDescription(client.translate("common:LANGUAGE")) .setDescription(client.translate("common:LANGUAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:LANGUAGE", null, "uk-UA"), uk: client.translate("common:LANGUAGE", null, "uk-UA"),
"ru": client.translate("common:LANGUAGE", null, "ru-RU"), ru: client.translate("common:LANGUAGE", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setChoices( .setChoices({ name: "English", value: "en-US" }, { name: "Русский", value: "ru-RU" }, { name: "Українська", value: "uk-UA" }),
{ name: "English", value: "en-US" }, ),
{ name: "Русский", value: "ru-RU" },
{ name: "Українська", value: "uk-UA" },
)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,18 +12,21 @@ class Stealemoji extends BaseCommand {
.setName("stealemoji") .setName("stealemoji")
.setDescription(client.translate("administration/stealemoji:DESCRIPTION")) .setDescription(client.translate("administration/stealemoji:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/stealemoji:DESCRIPTION", null, "uk-UA"), uk: client.translate("administration/stealemoji:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("administration/stealemoji:DESCRIPTION", null, "ru-RU"), ru: client.translate("administration/stealemoji:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addStringOption(option => option.setName("emoji") .addStringOption(option =>
option
.setName("emoji")
.setDescription(client.translate("common:EMOJI")) .setDescription(client.translate("common:EMOJI"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:EMOJI", null, "uk-UA"), uk: client.translate("common:EMOJI", null, "uk-UA"),
"ru": client.translate("common:EMOJI", null, "ru-RU"), ru: client.translate("common:EMOJI", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -51,9 +54,11 @@ class Stealemoji extends BaseCommand {
name: parsedEmoji.name, name: parsedEmoji.name,
attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${ext}`, attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${ext}`,
}) })
.then(emoji => interaction.success("administration/stealemoji:SUCCESS", { .then(emoji =>
interaction.success("administration/stealemoji:SUCCESS", {
emoji: emoji.name, emoji: emoji.name,
}, { ephemeral: true })) }, { ephemeral: true }),
)
.catch(e => { .catch(e => {
interaction.error("administration/stealemoji:ERROR", { interaction.error("administration/stealemoji:ERROR", {
emoji: parsedEmoji.name, emoji: parsedEmoji.name,

View file

@ -12,49 +12,65 @@ class Welcome extends BaseCommand {
.setName("welcome") .setName("welcome")
.setDescription(client.translate("administration/welcome:DESCRIPTION")) .setDescription(client.translate("administration/welcome:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/welcome:DESCRIPTION", null, "uk-UA"), uk: client.translate("administration/welcome:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("administration/welcome:DESCRIPTION", null, "ru-RU"), ru: client.translate("administration/welcome:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addSubcommand(subcommand => subcommand.setName("test") .addSubcommand(subcommand =>
subcommand
.setName("test")
.setDescription(client.translate("administration/goodbye:TEST")) .setDescription(client.translate("administration/goodbye:TEST"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/goodbye:TEST", null, "uk-UA"), uk: client.translate("administration/goodbye:TEST", null, "uk-UA"),
"ru": client.translate("administration/goodbye:TEST", null, "ru-RU"), ru: client.translate("administration/goodbye:TEST", null, "ru-RU"),
}), }),
) )
.addSubcommand(subcommand => subcommand.setName("config") .addSubcommand(subcommand =>
subcommand
.setName("config")
.setDescription(client.translate("administration/goodbye:CONFIG")) .setDescription(client.translate("administration/goodbye:CONFIG"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/goodbye:CONFIG", null, "uk-UA"), uk: client.translate("administration/goodbye:CONFIG", null, "uk-UA"),
"ru": client.translate("administration/goodbye:CONFIG", null, "ru-RU"), ru: client.translate("administration/goodbye:CONFIG", null, "ru-RU"),
}) })
.addBooleanOption(option => option.setName("state") .addBooleanOption(option =>
option
.setName("state")
.setDescription(client.translate("common:STATE")) .setDescription(client.translate("common:STATE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:STATE", null, "uk-UA"), uk: client.translate("common:STATE", null, "uk-UA"),
"ru": client.translate("common:STATE", null, "ru-RU"), ru: client.translate("common:STATE", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addChannelOption(option => option.setName("channel") )
.addChannelOption(option =>
option
.setName("channel")
.setDescription(client.translate("common:CHANNEL")) .setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:CHANNEL", null, "uk-UA"), uk: client.translate("common:CHANNEL", null, "uk-UA"),
"ru": client.translate("common:CHANNEL", null, "ru-RU"), ru: client.translate("common:CHANNEL", null, "ru-RU"),
})) }),
.addStringOption(option => option.setName("message") )
.addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("administration/goodbye:MESSAGE")) .setDescription(client.translate("administration/goodbye:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/goodbye:MESSAGE", null, "uk-UA"), uk: client.translate("administration/goodbye:MESSAGE", null, "uk-UA"),
"ru": client.translate("administration/goodbye:MESSAGE", null, "ru-RU"), ru: client.translate("administration/goodbye:MESSAGE", null, "ru-RU"),
})) }),
.addBooleanOption(option => option.setName("image") )
.addBooleanOption(option =>
option
.setName("image")
.setDescription(client.translate("administration/goodbye:IMAGE")) .setDescription(client.translate("administration/goodbye:IMAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/goodbye:IMAGE", null, "uk-UA"), uk: client.translate("administration/goodbye:IMAGE", null, "uk-UA"),
"ru": client.translate("administration/goodbye:IMAGE", null, "ru-RU"), ru: client.translate("administration/goodbye:IMAGE", null, "ru-RU"),
})), }),
),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,

View file

@ -12,16 +12,19 @@ class Achievements extends BaseCommand {
.setName("achievements") .setName("achievements")
.setDescription(client.translate("economy/achievements:DESCRIPTION")) .setDescription(client.translate("economy/achievements:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/achievements:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/achievements:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/achievements:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/achievements:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
})), }),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -44,9 +47,7 @@ class Achievements extends BaseCommand {
const user = interaction.options.getUser("user") || interaction.member; const user = interaction.options.getUser("user") || interaction.member;
if (user.bot) return interaction.error("economy/profile:BOT_USER"); if (user.bot) return interaction.error("economy/profile:BOT_USER");
const userData = (user.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ const userData = user.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ id: user.id });
id: user.id,
}));
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({

View file

@ -12,28 +12,31 @@ class Bank extends BaseCommand {
.setName("bank") .setName("bank")
.setDescription(client.translate("economy/bank:DESCRIPTION")) .setDescription(client.translate("economy/bank:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/bank:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/bank:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/bank:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/bank:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addStringOption(option => option.setName("option") .addStringOption(option =>
option
.setName("option")
.setDescription(client.translate("economy/bank:OPTION")) .setDescription(client.translate("economy/bank:OPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/bank:OPTION", null, "uk-UA"), uk: client.translate("economy/bank:OPTION", null, "uk-UA"),
"ru": client.translate("economy/bank:OPTION", null, "ru-RU"), ru: client.translate("economy/bank:OPTION", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setChoices( .setChoices({ name: client.translate("economy/bank:DEPOSIT"), value: "deposit" }, { name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" }),
{ name: client.translate("economy/bank:DEPOSIT"), value: "deposit" }, )
{ name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" }, .addStringOption(option =>
)) option
.addStringOption(option => option.setName("credits") .setName("credits")
.setDescription(client.translate("misc:OPTION_NAN_ALL")) .setDescription(client.translate("misc:OPTION_NAN_ALL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("misc:OPTION_NAN_ALL", null, "uk-UA"), uk: client.translate("misc:OPTION_NAN_ALL", null, "uk-UA"),
"ru": client.translate("misc:OPTION_NAN_ALL", null, "ru-RU"), ru: client.translate("misc:OPTION_NAN_ALL", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -58,7 +61,10 @@ class Bank extends BaseCommand {
if (choice === "deposit") { if (choice === "deposit") {
const credits = interaction.options.getString("credits").toLowerCase() === "all" ? data.memberData.money : interaction.options.getString("credits"); const credits = interaction.options.getString("credits").toLowerCase() === "all" ? data.memberData.money : interaction.options.getString("credits");
if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL"); if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL");
if (data.memberData.money < credits) return interaction.error("economy/bank:NOT_ENOUGH_CREDIT", { money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` }); if (data.memberData.money < credits)
return interaction.error("economy/bank:NOT_ENOUGH_CREDIT", {
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
});
data.memberData.money -= credits; data.memberData.money -= credits;
data.memberData.bankSold += credits; data.memberData.bankSold += credits;
@ -80,7 +86,10 @@ class Bank extends BaseCommand {
} else { } else {
const credits = interaction.options.getString("credits") === "all" ? data.memberData.bankSold : interaction.options.getString("credits"); const credits = interaction.options.getString("credits") === "all" ? data.memberData.bankSold : interaction.options.getString("credits");
if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL"); if (isNaN(credits) || credits < 1) return interaction.error("misc:OPTION_NAN_ALL");
if (data.memberData.bankSold < credits) return interaction.error("economy/bank:NOT_ENOUGH_BANK", { money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` }); if (data.memberData.bankSold < credits)
return interaction.error("economy/bank:NOT_ENOUGH_BANK", {
money: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
});
const info = { const info = {
user: interaction.translate("economy/transactions:BANK"), user: interaction.translate("economy/transactions:BANK"),

View file

@ -12,22 +12,27 @@ class Birthdate extends BaseCommand {
.setName("birthdate") .setName("birthdate")
.setDescription(client.translate("economy/birthdate:DESCRIPTION")) .setDescription(client.translate("economy/birthdate:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/birthdate:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/birthdate:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/birthdate:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/birthdate:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addIntegerOption(option => option.setName("day") .addIntegerOption(option =>
option
.setName("day")
.setDescription(client.translate("economy/birthdate:DAY")) .setDescription(client.translate("economy/birthdate:DAY"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/birthdate:DAY", null, "uk-UA"), uk: client.translate("economy/birthdate:DAY", null, "uk-UA"),
"ru": client.translate("economy/birthdate:DAY", null, "ru-RU"), ru: client.translate("economy/birthdate:DAY", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addIntegerOption(option => option.setName("month") )
.addIntegerOption(option =>
option
.setName("month")
.setDescription(client.translate("economy/birthdate:MONTH")) .setDescription(client.translate("economy/birthdate:MONTH"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/birthdate:MONTH", null, "uk-UA"), uk: client.translate("economy/birthdate:MONTH", null, "uk-UA"),
"ru": client.translate("economy/birthdate:MONTH", null, "ru-RU"), ru: client.translate("economy/birthdate:MONTH", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setChoices( .setChoices(
@ -43,14 +48,18 @@ class Birthdate extends BaseCommand {
{ name: client.translate("economy/birthdate:OCTOBER"), value: 10 }, { name: client.translate("economy/birthdate:OCTOBER"), value: 10 },
{ name: client.translate("economy/birthdate:NOVEMBER"), value: 11 }, { name: client.translate("economy/birthdate:NOVEMBER"), value: 11 },
{ name: client.translate("economy/birthdate:DECEMBER"), value: 12 }, { name: client.translate("economy/birthdate:DECEMBER"), value: 12 },
)) ),
.addIntegerOption(option => option.setName("year") )
.addIntegerOption(option =>
option
.setName("year")
.setDescription(client.translate("economy/birthdate:YEAR")) .setDescription(client.translate("economy/birthdate:YEAR"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/birthdate:YEAR", null, "uk-UA"), uk: client.translate("economy/birthdate:YEAR", null, "uk-UA"),
"ru": client.translate("economy/birthdate:YEAR", null, "ru-RU"), ru: client.translate("economy/birthdate:YEAR", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -77,7 +86,7 @@ class Birthdate extends BaseCommand {
if (!(day == d.getDate() && month - 1 == d.getMonth() && year == d.getFullYear())) return interaction.error("economy/birthdate:INVALID_DATE"); if (!(day == d.getDate() && month - 1 == d.getMonth() && year == d.getFullYear())) return interaction.error("economy/birthdate:INVALID_DATE");
if (d.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH"); if (d.getTime() > Date.now()) return interaction.error("economy/birthdate:DATE_TOO_HIGH");
if (d.getTime() < (Date.now() - 2.523e+12)) return interaction.error("economy/birthdate:DATE_TOO_LOW"); if (d.getTime() < Date.now() - 2.523e12) return interaction.error("economy/birthdate:DATE_TOO_LOW");
data.userData.birthdate = d; data.userData.birthdate = d;
data.userData.markModified("birthdate"); data.userData.markModified("birthdate");

View file

@ -12,8 +12,8 @@ class Divorce extends BaseCommand {
.setName("divorce") .setName("divorce")
.setDescription(client.translate("economy/divorce:DESCRIPTION")) .setDescription(client.translate("economy/divorce:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/divorce:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/divorce:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/divorce:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/divorce:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -36,7 +36,7 @@ class Divorce extends BaseCommand {
*/ */
async execute(client, interaction, data) { async execute(client, interaction, data) {
if (!data.userData.lover) return interaction.error("economy/divorce:NOT_MARRIED"); if (!data.userData.lover) return interaction.error("economy/divorce:NOT_MARRIED");
const user = client.users.cache.get(data.userData.lover) || await client.users.fetch(data.userData.lover); const user = client.users.cache.get(data.userData.lover) || (await client.users.fetch(data.userData.lover));
data.userData.lover = null; data.userData.lover = null;
data.user.markModified("lover"); data.user.markModified("lover");

View file

@ -12,22 +12,21 @@ class Leaderboard extends BaseCommand {
.setName("leaderboard") .setName("leaderboard")
.setDescription(client.translate("economy/leaderboard:DESCRIPTION")) .setDescription(client.translate("economy/leaderboard:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/leaderboard:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/leaderboard:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/leaderboard:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/leaderboard:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addStringOption(option => option.setName("type") .addStringOption(option =>
option
.setName("type")
.setDescription(client.translate("owner/debug:TYPE")) .setDescription(client.translate("owner/debug:TYPE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/debug:TYPE", null, "uk-UA"), uk: client.translate("owner/debug:TYPE", null, "uk-UA"),
"ru": client.translate("owner/debug:TYPE", null, "ru-RU"), ru: client.translate("owner/debug:TYPE", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setChoices( .setChoices({ name: client.translate("common:LEVEL"), value: "level" }, { name: client.translate("common:MONEY"), value: "money" }, { name: client.translate("common:REP"), value: "rep" }),
{ name: client.translate("common:LEVEL"), value: "level" }, ),
{ name: client.translate("common:MONEY"), value: "money" },
{ name: client.translate("common:REP"), value: "rep" },
)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -51,7 +50,8 @@ class Leaderboard extends BaseCommand {
const type = interaction.options.getString("type"); const type = interaction.options.getString("type");
const isOnMobile = JSON.stringify(Object.keys(interaction.member.presence.clientStatus)) === JSON.stringify(["mobile"]); const isOnMobile = JSON.stringify(Object.keys(interaction.member.presence.clientStatus)) === JSON.stringify(["mobile"]);
if (isOnMobile) interaction.followUp({ if (isOnMobile)
interaction.followUp({
content: interaction.translate("economy/leaderboard:MOBILE"), content: interaction.translate("economy/leaderboard:MOBILE"),
ephemeral: true, ephemeral: true,
}); });
@ -86,15 +86,18 @@ class Leaderboard extends BaseCommand {
iconURL: interaction.guild.iconURL(), iconURL: interaction.guild.iconURL(),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.addFields({ .addFields(
{
name: interaction.translate("common:USER"), name: interaction.translate("common:USER"),
value: userNames, value: userNames,
inline: true, inline: true,
}, { },
{
name: interaction.translate("common:CREDITS"), name: interaction.translate("common:CREDITS"),
value: money, value: money,
inline: true, inline: true,
}); },
);
interaction.editReply({ interaction.editReply({
embeds: [embed], embeds: [embed],
@ -183,15 +186,18 @@ class Leaderboard extends BaseCommand {
iconURL: interaction.guild.iconURL(), iconURL: interaction.guild.iconURL(),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.addFields({ .addFields(
{
name: interaction.translate("common:USER"), name: interaction.translate("common:USER"),
value: userNames, value: userNames,
inline: true, inline: true,
}, { },
{
name: interaction.translate("common:REP"), name: interaction.translate("common:REP"),
value: rep, value: rep,
inline: true, inline: true,
}); },
);
interaction.editReply({ interaction.editReply({
embeds: [embed], embeds: [embed],

View file

@ -13,17 +13,20 @@ class Marry extends BaseCommand {
.setName("marry") .setName("marry")
.setDescription(client.translate("economy/marry:DESCRIPTION")) .setDescription(client.translate("economy/marry:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/marry:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/marry:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/marry:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/marry:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -58,23 +61,27 @@ class Marry extends BaseCommand {
const receiver = pendings[requester]; const receiver = pendings[requester];
if (requester === interaction.author.id) { if (requester === interaction.author.id) {
const user = client.users.cache.get(receiver) || await client.users.fetch(receiver); const user = client.users.cache.get(receiver) || (await client.users.fetch(receiver));
return interaction.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", { return interaction.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", {
user: user.toString, user: user.toString,
}); });
} else if (receiver === interaction.member.id) { } else if (receiver === interaction.member.id) {
const user = client.users.cache.get(requester) || await client.users.fetch(requester); const user = client.users.cache.get(requester) || (await client.users.fetch(requester));
return interaction.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", { return interaction.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", {
user: user.toString(), user: user.toString(),
}); });
} else if (requester === member.id) { } else if (requester === member.id) {
const user = client.users.cache.get(receiver) || await client.users.fetch(receiver); const user = client.users.cache.get(receiver) || (await client.users.fetch(receiver));
return interaction.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", { return interaction.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", {
firstUser: member.toString(), firstUser: member.toString(),
secondUser: user.toString(), secondUser: user.toString(),
}); });
} else if (receiver === member.id) { } else if (receiver === member.id) {
const user = client.users.cache.get(requester) || await client.users.fetch(requester); const user = client.users.cache.get(requester) || (await client.users.fetch(requester));
return interaction.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", { return interaction.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", {
firstUser: member.toString(), firstUser: member.toString(),
secondUser: user.toString(), secondUser: user.toString(),
@ -84,16 +91,9 @@ class Marry extends BaseCommand {
pendings[interaction.member.id] = member.id; pendings[interaction.member.id] = member.id;
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(
.addComponents( new ButtonBuilder().setCustomId("marry_confirm_yes").setLabel(interaction.translate("common:ACCEPT")).setStyle(ButtonStyle.Success),
new ButtonBuilder() new ButtonBuilder().setCustomId("marry_confirm_no").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Danger),
.setCustomId("marry_confirm_yes")
.setLabel(interaction.translate("common:ACCEPT"))
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setCustomId("marry_confirm_no")
.setLabel(interaction.translate("common:CANCEL"))
.setStyle(ButtonStyle.Danger),
); );
await interaction.reply({ await interaction.reply({
@ -105,7 +105,7 @@ class Marry extends BaseCommand {
}); });
const filter = i => i.user.id === member.id; const filter = i => i.user.id === member.id;
const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (10 * 60 * 1000) }); const collector = interaction.channel.createMessageComponentCollector({ filter, idle: 10 * 60 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isButton()) { if (i.isButton()) {
@ -137,10 +137,12 @@ class Marry extends BaseCommand {
const messageOptions = { const messageOptions = {
content: `${member.toString()} :heart: ${interaction.member.toString()}`, content: `${member.toString()} :heart: ${interaction.member.toString()}`,
files: [{ files: [
{
name: "achievement_unlocked3.png", name: "achievement_unlocked3.png",
attachment: "./assets/img/achievements/achievement_unlocked3.png", attachment: "./assets/img/achievements/achievement_unlocked3.png",
}], },
],
}; };
let sent = false; let sent = false;

View file

@ -12,16 +12,19 @@ class Money extends BaseCommand {
.setName("money") .setName("money")
.setDescription(client.translate("economy/money:DESCRIPTION")) .setDescription(client.translate("economy/money:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/money:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/money:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/money:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/money:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
})), }),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -46,10 +49,7 @@ class Money extends BaseCommand {
const member = interaction.options.getMember("user") || interaction.member; const member = interaction.options.getMember("user") || interaction.member;
if (member.user.bot) return interaction.error("economy/money:BOT_USER"); if (member.user.bot) return interaction.error("economy/money:BOT_USER");
const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ id: member.id, guildId: interaction.guildId });
id: member.id,
guildId: interaction.guildId,
});
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id)); const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
let globalMoney = 0; let globalMoney = 0;

View file

@ -12,24 +12,30 @@ class Pay extends BaseCommand {
.setName("pay") .setName("pay")
.setDescription(client.translate("economy/pay:DESCRIPTION")) .setDescription(client.translate("economy/pay:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/pay:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/pay:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/pay:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/pay:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addIntegerOption(option => option.setName("amount") )
.addIntegerOption(option =>
option
.setName("amount")
.setDescription(client.translate("common:INT")) .setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:INT", null, "uk-UA"), uk: client.translate("common:INT", null, "uk-UA"),
"ru": client.translate("common:INT", null, "ru-RU"), ru: client.translate("common:INT", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -55,7 +61,8 @@ class Pay extends BaseCommand {
const amount = interaction.options.getInteger("amount"); const amount = interaction.options.getInteger("amount");
if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO"); if (amount <= 0) return interaction.error("misc:MORE_THAN_ZERO");
if (amount > data.memberData.money) return interaction.error("economy/pay:ENOUGH_MONEY", { if (amount > data.memberData.money)
return interaction.error("economy/pay:ENOUGH_MONEY", {
amount: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}`, amount: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}`,
}); });

View file

@ -12,16 +12,19 @@ class Profile extends BaseCommand {
.setName("profile") .setName("profile")
.setDescription(client.translate("economy/profile:DESCRIPTION")) .setDescription(client.translate("economy/profile:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/profile:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/profile:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/profile:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/profile:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
})), }),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -46,14 +49,8 @@ class Profile extends BaseCommand {
const member = interaction.options.getMember("user") || interaction.member; const member = interaction.options.getMember("user") || interaction.member;
if (member.user.bot) return interaction.error("economy/profile:BOT_USER"); if (member.user.bot) return interaction.error("economy/profile:BOT_USER");
const memberData = (member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ id: member.id, guildId: interaction.guildId });
id: member.id, const userData = member.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ id: member.id });
guildId: interaction.guildId,
}));
const userData = (member.id === interaction.user.id ? data.userData : await client.findOrCreateUser({
id: member.id,
}));
if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true); if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true);
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id)); const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
@ -107,7 +104,7 @@ class Profile extends BaseCommand {
}, },
{ {
name: interaction.translate("economy/profile:LEVEL"), name: interaction.translate("economy/profile:LEVEL"),
value:`**${memberData.level}**`, value: `**${memberData.level}**`,
inline: true, inline: true,
}, },
{ {
@ -122,12 +119,12 @@ class Profile extends BaseCommand {
}, },
{ {
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))), value: !userData.birthdate ? interaction.translate("common:NOT_DEFINED") : client.functions.printDate(client, new Date(userData.birthdate)),
inline: true, inline: true,
}, },
{ {
name: interaction.translate("economy/profile:LOVER"), name: interaction.translate("economy/profile:LOVER"),
value: (!userData.lover ? interaction.translate("common:NOT_DEFINED") : lover.getUsername()), value: !userData.lover ? interaction.translate("common:NOT_DEFINED") : lover.getUsername(),
inline: true, inline: true,
}, },
{ {
@ -145,10 +142,12 @@ class Profile extends BaseCommand {
interaction.editReply({ interaction.editReply({
embeds: [profileEmbed], embeds: [profileEmbed],
files: [{ files: [
{
name: "achievements.png", name: "achievements.png",
attachment: buffer, attachment: buffer,
}], },
],
}); });
} }
} }

View file

@ -12,17 +12,20 @@ class Rep extends BaseCommand {
.setName("rep") .setName("rep")
.setDescription(client.translate("economy/rep:DESCRIPTION")) .setDescription(client.translate("economy/rep:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/rep:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/rep:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/rep:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/rep:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -44,7 +47,8 @@ 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()) return interaction.error("economy/rep:COOLDOWN", { if (isInCooldown > Date.now())
return interaction.error("economy/rep:COOLDOWN", {
time: client.functions.convertTime(client, isInCooldown, true, true, data.guildData.language), time: client.functions.convertTime(client, isInCooldown, true, true, data.guildData.language),
}); });
} }
@ -67,15 +71,17 @@ class Rep extends BaseCommand {
userData.rep++; userData.rep++;
if (!userData.achievements.rep.achieved) { if (!userData.achievements.rep.achieved) {
userData.achievements.rep.progress.now = (userData.rep > userData.achievements.rep.progress.total ? userData.achievements.rep.progress.total : userData.rep); userData.achievements.rep.progress.now = userData.rep > userData.achievements.rep.progress.total ? userData.achievements.rep.progress.total : userData.rep;
if (userData.achievements.rep.progress.now >= userData.achievements.rep.progress.total) { if (userData.achievements.rep.progress.now >= userData.achievements.rep.progress.total) {
userData.achievements.rep.achieved = true; userData.achievements.rep.achieved = true;
interaction.followUp({ interaction.followUp({
content: `${user}`, content: `${user}`,
files: [{ files: [
{
name: "achievement_unlocked6.png", name: "achievement_unlocked6.png",
attachment: "./assets/img/achievements/achievement_unlocked6.png", attachment: "./assets/img/achievements/achievement_unlocked6.png",
}], },
],
}); });
} }
userData.markModified("achievements.rep"); userData.markModified("achievements.rep");

View file

@ -12,24 +12,30 @@ class Rob extends BaseCommand {
.setName("rob") .setName("rob")
.setDescription(client.translate("economy/rob:DESCRIPTION")) .setDescription(client.translate("economy/rob:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/rob:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/rob:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/rob:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/rob:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addIntegerOption(option => option.setName("amount") )
.addIntegerOption(option =>
option
.setName("amount")
.setDescription(client.translate("common:INT")) .setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:INT", null, "uk-UA"), uk: client.translate("common:INT", null, "uk-UA"),
"ru": client.translate("common:INT", null, "ru-RU"), ru: client.translate("common:INT", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -68,7 +74,8 @@ class Rob extends BaseCommand {
} }
const potentiallyLose = Math.floor(amount * 1.5); const potentiallyLose = Math.floor(amount * 1.5);
if (potentiallyLose > data.memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_AUTHOR", { if (potentiallyLose > data.memberData.money)
return interaction.error("economy/rob:NOT_ENOUGH_AUTHOR", {
moneyMin: `**${potentiallyLose}** ${client.functions.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, moneyMin: `**${potentiallyLose}** ${client.functions.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
moneyCurrent: `**${data.memberData.money}** ${client.functions.getNoun(data.memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, moneyCurrent: `**${data.memberData.money}** ${client.functions.getNoun(data.memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
}); });
@ -76,7 +83,7 @@ class Rob extends BaseCommand {
const itsAWon = Math.floor(client.functions.randomNum(0, 100) < 25); const itsAWon = Math.floor(client.functions.randomNum(0, 100) < 25);
if (itsAWon) { if (itsAWon) {
const toWait = Date.now() + (6 * 60 * 60 * 1000), const toWait = Date.now() + 6 * 60 * 60 * 1000,
randomNum = client.functions.randomNum(1, 2); randomNum = client.functions.randomNum(1, 2);
memberData.cooldowns.rob = toWait; memberData.cooldowns.rob = toWait;

View file

@ -12,17 +12,20 @@ class Setbio extends BaseCommand {
.setName("setbio") .setName("setbio")
.setDescription(client.translate("economy/setbio:DESCRIPTION")) .setDescription(client.translate("economy/setbio:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/setbio:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/setbio:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/setbio:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/setbio:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("text") .addStringOption(option =>
option
.setName("text")
.setDescription(client.translate("economy/profile:BIO")) .setDescription(client.translate("economy/profile:BIO"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/profile:BIO", null, "uk-UA"), uk: client.translate("economy/profile:BIO", null, "uk-UA"),
"ru": client.translate("economy/profile:BIO", null, "ru-RU"), ru: client.translate("economy/profile:BIO", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,17 +12,20 @@ class Slots extends BaseCommand {
.setName("slots") .setName("slots")
.setDescription(client.translate("economy/slots:DESCRIPTION")) .setDescription(client.translate("economy/slots:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/slots:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/slots:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/slots:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/slots:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addIntegerOption(option => option.setName("amount") .addIntegerOption(option =>
option
.setName("amount")
.setDescription(client.translate("common:INT")) .setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:INT", null, "uk-UA"), uk: client.translate("common:INT", null, "uk-UA"),
"ru": client.translate("common:INT", null, "ru-RU"), ru: client.translate("common:INT", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -45,19 +48,24 @@ class Slots extends BaseCommand {
await interaction.deferReply(); await interaction.deferReply();
const amount = interaction.options.getInteger("amount"); const amount = interaction.options.getInteger("amount");
if (amount > data.memberData.money) return interaction.error("economy/slots:NOT_ENOUGH", { money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` }, { edit: true }); if (amount > data.memberData.money)
return interaction.error("economy/slots:NOT_ENOUGH", {
money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
}, { edit: true });
const fruits = ["🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓"]; const fruits = ["🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓"];
let i1 = 0, j1 = 0, k1 = 0, let i1 = 0,
i2 = 1, j2 = 1, k2 = 1, j1 = 0,
i3 = 2, j3 = 2, k3 = 2; k1 = 0,
i2 = 1,
j2 = 1,
k2 = 1,
i3 = 2,
j3 = 2,
k3 = 2;
const colonnes = [ const colonnes = [client.functions.shuffle(fruits), client.functions.shuffle(fruits), client.functions.shuffle(fruits)];
client.functions.shuffle(fruits),
client.functions.shuffle(fruits),
client.functions.shuffle(fruits),
];
function getCredits(number, isJackpot) { function getCredits(number, isJackpot) {
if (!isJackpot) number = number * 1.5; if (!isJackpot) number = number * 1.5;
@ -78,29 +86,31 @@ class Slots extends BaseCommand {
async function end() { async function end() {
let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n"; let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n";
i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0; i1 = i1 < fruits.length - 1 ? i1 + 1 : 0;
i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0; i2 = i2 < fruits.length - 1 ? i2 + 1 : 0;
i3 = (i3 < fruits.length - 1) ? i3 + 1 : 0; i3 = i3 < fruits.length - 1 ? i3 + 1 : 0;
j1 = (j1 < fruits.length - 1) ? j1 + 1 : 0; j1 = j1 < fruits.length - 1 ? j1 + 1 : 0;
j2 = (j2 < fruits.length - 1) ? j2 + 1 : 0; j2 = j2 < fruits.length - 1 ? j2 + 1 : 0;
j3 = (j3 < fruits.length - 1) ? j3 + 1 : 0; j3 = j3 < fruits.length - 1 ? j3 + 1 : 0;
k1 = (k1 < fruits.length - 1) ? k1 + 1 : 0; k1 = k1 < fruits.length - 1 ? k1 + 1 : 0;
k2 = (k2 < fruits.length - 1) ? k2 + 1 : 0; k2 = k2 < fruits.length - 1 ? k2 + 1 : 0;
k3 = (k3 < fruits.length - 1) ? k3 + 1 : 0; k3 = k3 < fruits.length - 1 ? k3 + 1 : 0;
msg += colonnes[0][i1] + " : " + colonnes[1][j1] + " : " + colonnes[2][k1] + "\n"; msg += colonnes[0][i1] + " : " + colonnes[1][j1] + " : " + colonnes[2][k1] + "\n";
msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : " + colonnes[2][k2] + " **<**\n"; msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : " + colonnes[2][k2] + " **<**\n";
msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n------------------\n"; msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n------------------\n";
if ((colonnes[0][i2] == colonnes[1][j2]) && (colonnes[1][j2] == colonnes[2][k2])) { if (colonnes[0][i2] == colonnes[1][j2] && colonnes[1][j2] == colonnes[2][k2]) {
msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |"; msg += "| : : : **" + interaction.translate("common:VICTORY").toUpperCase() + "** : : : |";
await interaction.editReply({ await interaction.editReply({
content: msg, content: msg,
}); });
const credits = getCredits(amount, true); const credits = getCredits(amount, true);
interaction.followUp({ interaction.followUp({
content: "**!! ДЖЕКПОТ !!**\n" + interaction.translate("economy/slots:VICTORY", { content:
"**!! ДЖЕКПОТ !!**\n" +
interaction.translate("economy/slots:VICTORY", {
money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
won: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, won: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
user: interaction.member.toString(), user: interaction.member.toString(),
@ -127,10 +137,12 @@ class Slots extends BaseCommand {
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) { if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
data.userData.achievements.slots.achieved = true; data.userData.achievements.slots.achieved = true;
interaction.followUp({ interaction.followUp({
files: [{ files: [
{
name: "achievement_unlocked4.png", name: "achievement_unlocked4.png",
attachment: "./assets/img/achievements/achievement_unlocked4.png", attachment: "./assets/img/achievements/achievement_unlocked4.png",
}], },
],
}); });
} }
data.userData.markModified("achievements.slots"); data.userData.markModified("achievements.slots");
@ -142,7 +154,7 @@ class Slots extends BaseCommand {
} }
if (colonnes[0][i2] == colonnes[1][j2] || colonnes[1][j2] == colonnes[2][k2] || colonnes[0][i2] == colonnes[2][k2]) { if (colonnes[0][i2] == colonnes[1][j2] || colonnes[1][j2] == colonnes[2][k2] || colonnes[0][i2] == colonnes[2][k2]) {
msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |"; msg += "| : : : **" + interaction.translate("common:VICTORY").toUpperCase() + "** : : : |";
await interaction.editReply({ await interaction.editReply({
content: msg, content: msg,
}); });
@ -175,10 +187,12 @@ class Slots extends BaseCommand {
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) { if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
data.userData.achievements.slots.achieved = true; data.userData.achievements.slots.achieved = true;
interaction.followUp({ interaction.followUp({
files: [{ files: [
{
name: "achievement_unlocked4.png", name: "achievement_unlocked4.png",
attachment: "./assets/img/achievements/achievement_unlocked4.png", attachment: "./assets/img/achievements/achievement_unlocked4.png",
}], },
],
}); });
} }
data.userData.markModified("achievements.slots"); data.userData.markModified("achievements.slots");
@ -188,7 +202,7 @@ class Slots extends BaseCommand {
return; return;
} }
msg += "| : : : **" + (interaction.translate("common:DEFEAT").toUpperCase()) + "** : : : |"; msg += "| : : : **" + interaction.translate("common:DEFEAT").toUpperCase() + "** : : : |";
interaction.followUp({ interaction.followUp({
content: interaction.translate("economy/slots:DEFEAT", { content: interaction.translate("economy/slots:DEFEAT", {
money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
@ -221,15 +235,15 @@ class Slots extends BaseCommand {
async function editMsg() { async function editMsg() {
let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n"; let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n";
i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0; i1 = i1 < fruits.length - 1 ? i1 + 1 : 0;
i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0; i2 = i2 < fruits.length - 1 ? i2 + 1 : 0;
i3 = (i3 < fruits.length - 1) ? i3 + 1 : 0; i3 = i3 < fruits.length - 1 ? i3 + 1 : 0;
j1 = (j1 < fruits.length - 1) ? j1 + 1 : 0; j1 = j1 < fruits.length - 1 ? j1 + 1 : 0;
j2 = (j2 < fruits.length - 1) ? j2 + 1 : 0; j2 = j2 < fruits.length - 1 ? j2 + 1 : 0;
j3 = (j3 < fruits.length - 1) ? j3 + 1 : 0; j3 = j3 < fruits.length - 1 ? j3 + 1 : 0;
k1 = (k1 < fruits.length - 1) ? k1 + 1 : 0; k1 = k1 < fruits.length - 1 ? k1 + 1 : 0;
k2 = (k2 < fruits.length - 1) ? k2 + 1 : 0; k2 = k2 < fruits.length - 1 ? k2 + 1 : 0;
k3 = (k3 < fruits.length - 1) ? k3 + 1 : 0; k3 = k3 < fruits.length - 1 ? k3 + 1 : 0;
msg += colonnes[0][i1] + " : " + colonnes[1][j1] + " : " + colonnes[2][k1] + "\n"; msg += colonnes[0][i1] + " : " + colonnes[1][j1] + " : " + colonnes[2][k1] + "\n";
msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : " + colonnes[2][k2] + " **<**\n"; msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : " + colonnes[2][k2] + " **<**\n";

View file

@ -12,16 +12,19 @@ class Transactions extends BaseCommand {
.setName("transactions") .setName("transactions")
.setDescription(client.translate("economy/transactions:DESCRIPTION")) .setDescription(client.translate("economy/transactions:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/transactions:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/transactions:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/transactions:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/transactions:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addBooleanOption(option => option.setName("clear") .addBooleanOption(option =>
option
.setName("clear")
.setDescription(client.translate("economy/transactions:CLEAR")) .setDescription(client.translate("economy/transactions:CLEAR"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/transactions:CLEAR", null, "uk-UA"), uk: client.translate("economy/transactions:CLEAR", null, "uk-UA"),
"ru": client.translate("economy/transactions:CLEAR", null, "ru-RU"), ru: client.translate("economy/transactions:CLEAR", null, "ru-RU"),
})), }),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -60,24 +63,30 @@ class Transactions extends BaseCommand {
}); });
const transactions = data.memberData.transactions, const transactions = data.memberData.transactions,
sortedTransactions = [ [], [] ]; sortedTransactions = [[], []];
transactions.slice(-20).forEach(t => { transactions.slice(-20).forEach(t => {
const array = t.type === "got" ? sortedTransactions[0] : sortedTransactions[1]; const array = t.type === "got" ? sortedTransactions[0] : sortedTransactions[1];
array.push(`${interaction.translate("economy/transactions:T_USER_" + t.type.toUpperCase())}: ${t.user}\n${interaction.translate("economy/transactions:T_AMOUNT")}: ${t.amount}\n${interaction.translate("economy/transactions:T_DATE")}: ${client.functions.printDate(client, t.date, "Do MMMM YYYY, HH:mm", data.guildData.language)}\n`); array.push(
`${interaction.translate("economy/transactions:T_USER_" + t.type.toUpperCase())}: ${t.user}\n${interaction.translate("economy/transactions:T_AMOUNT")}: ${t.amount}\n${interaction.translate(
"economy/transactions:T_DATE",
)}: ${client.functions.printDate(client, t.date, "Do MMMM YYYY, HH:mm", data.guildData.language)}\n`,
);
}); });
if (transactions.length < 1) { if (transactions.length < 1) {
embed.setDescription(interaction.translate("economy/transactions:NO_TRANSACTIONS")); embed.setDescription(interaction.translate("economy/transactions:NO_TRANSACTIONS"));
} else { } else {
if (sortedTransactions[0].length > 0) embed.addFields([ if (sortedTransactions[0].length > 0)
embed.addFields([
{ {
name: interaction.translate("economy/transactions:T_GOT"), name: interaction.translate("economy/transactions:T_GOT"),
value: sortedTransactions[0].join("\n"), value: sortedTransactions[0].join("\n"),
inline: true, inline: true,
}, },
]); ]);
if (sortedTransactions[1].length > 0) embed.addFields([ if (sortedTransactions[1].length > 0)
embed.addFields([
{ {
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

@ -12,8 +12,8 @@ class Work extends BaseCommand {
.setName("work") .setName("work")
.setDescription(client.translate("economy/work:DESCRIPTION")) .setDescription(client.translate("economy/work:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("economy/work:DESCRIPTION", null, "uk-UA"), uk: client.translate("economy/work:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/work:DESCRIPTION", null, "ru-RU"), ru: client.translate("economy/work:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -37,13 +37,14 @@ 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()) return interaction.error("economy/work:COOLDOWN", { if (isInCooldown > Date.now())
return interaction.error("economy/work:COOLDOWN", {
time: client.functions.convertTime(client, isInCooldown, true, true, data.guildData.language), time: client.functions.convertTime(client, isInCooldown, true, true, data.guildData.language),
}); });
} }
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 = Date.now() + 24 * 60 * 60 * 1000; // 24 hours
data.memberData.cooldowns.work = toWait; data.memberData.cooldowns.work = toWait;
data.memberData.markModified("cooldowns"); data.memberData.markModified("cooldowns");
@ -57,13 +58,7 @@ class Work extends BaseCommand {
}) })
.setColor(client.config.embed.color); .setColor(client.config.embed.color);
const award = [ const award = [client.customEmojis.letters.a, client.customEmojis.letters.w, client.customEmojis.letters.a, client.customEmojis.letters.r, client.customEmojis.letters.d];
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) {
@ -117,13 +112,16 @@ class Work extends BaseCommand {
const messageOptions = { const messageOptions = {
embeds: [embed], embeds: [embed],
}; };
if (!data.userData.achievements.work.achieved) { if (!data.userData.achievements.work.achieved) {
data.userData.achievements.work.progress.now += 1; data.userData.achievements.work.progress.now += 1;
if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) { if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) {
messageOptions.files = [{ messageOptions.files = [
{
name: "unlocked.png", name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked1.png", attachment: "./assets/img/achievements/achievement_unlocked1.png",
}]; },
];
data.userData.achievements.work.achieved = true; data.userData.achievements.work.achieved = true;
} }
data.userData.markModified("achievements.work"); data.userData.markModified("achievements.work");

View file

@ -12,17 +12,20 @@ class Eightball extends BaseCommand {
.setName("8ball") .setName("8ball")
.setDescription(client.translate("fun/8ball:DESCRIPTION")) .setDescription(client.translate("fun/8ball:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/8ball:DESCRIPTION", null, "uk-UA"), uk: client.translate("fun/8ball:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("fun/8ball:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/8ball:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("question") .addStringOption(option =>
option
.setName("question")
.setDescription(client.translate("fun/8ball:QUESTION")) .setDescription(client.translate("fun/8ball:QUESTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/8ball:QUESTION", null, "uk-UA"), uk: client.translate("fun/8ball:QUESTION", null, "uk-UA"),
"ru": client.translate("fun/8ball:QUESTION", null, "ru-RU"), ru: client.translate("fun/8ball:QUESTION", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -13,8 +13,8 @@ class Cat extends BaseCommand {
.setName("cat") .setName("cat")
.setDescription(client.translate("fun/cat:DESCRIPTION")) .setDescription(client.translate("fun/cat:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/cat:DESCRIPTION", null, "uk-UA"), uk: client.translate("fun/cat:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("fun/cat:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/cat:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],

View file

@ -13,8 +13,8 @@ class Crab extends BaseCommand {
.setName("crab") .setName("crab")
.setDescription(client.translate("fun/crab:DESCRIPTION")) .setDescription(client.translate("fun/crab:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/crab:DESCRIPTION", null, "uk-UA"), uk: client.translate("fun/crab:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("fun/crab:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/crab:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],

View file

@ -13,8 +13,8 @@ class Dog extends BaseCommand {
.setName("dog") .setName("dog")
.setDescription(client.translate("fun/dog:DESCRIPTION")) .setDescription(client.translate("fun/dog:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/dog:DESCRIPTION", null, "uk-UA"), uk: client.translate("fun/dog:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("fun/dog:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/dog:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],

View file

@ -13,24 +13,30 @@ class LMGTFY extends BaseCommand {
.setName("lmgtfy") .setName("lmgtfy")
.setDescription(client.translate("fun/lmgtfy:DESCRIPTION")) .setDescription(client.translate("fun/lmgtfy:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/lmgtfy:DESCRIPTION", null, "uk-UA"), uk: client.translate("fun/lmgtfy:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("fun/lmgtfy:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/lmgtfy:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("query") .addStringOption(option =>
option
.setName("query")
.setDescription(client.translate("fun/lmgtfy:QUERY")) .setDescription(client.translate("fun/lmgtfy:QUERY"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/lmgtfy:QUERY", null, "uk-UA"), uk: client.translate("fun/lmgtfy:QUERY", null, "uk-UA"),
"ru": client.translate("fun/lmgtfy:QUERY", null, "ru-RU"), ru: client.translate("fun/lmgtfy:QUERY", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addBooleanOption(option => option.setName("short") )
.addBooleanOption(option =>
option
.setName("short")
.setDescription(client.translate("fun/lmgtfy:SHORT")) .setDescription(client.translate("fun/lmgtfy:SHORT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/lmgtfy:SHORT", null, "uk-UA"), uk: client.translate("fun/lmgtfy:SHORT", null, "uk-UA"),
"ru": client.translate("fun/lmgtfy:SHORT", null, "ru-RU"), ru: client.translate("fun/lmgtfy:SHORT", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -13,25 +13,29 @@ class Lovecalc extends BaseCommand {
.setName("lovecalc") .setName("lovecalc")
.setDescription(client.translate("fun/lovecalc:DESCRIPTION")) .setDescription(client.translate("fun/lovecalc:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/lovecalc:DESCRIPTION", null, "uk-UA"), uk: client.translate("fun/lovecalc:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("fun/lovecalc:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/lovecalc:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => .addUserOption(option =>
option.setName("first_member") option
.setName("first_member")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
)
.addUserOption(option => .addUserOption(option =>
option.setName("second_member") option
.setName("second_member")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
})), }),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -67,11 +71,13 @@ class Lovecalc extends BaseCommand {
.setAuthor({ .setAuthor({
name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}`, name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}`,
}) })
.setDescription(interaction.translate("fun/lovecalc:CONTENT", { .setDescription(
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) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer, text: client.config.embed.footer,

View file

@ -13,8 +13,8 @@ class Number extends BaseCommand {
.setName("number") .setName("number")
.setDescription(client.translate("fun/number:DESCRIPTION")) .setDescription(client.translate("fun/number:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/number:DESCRIPTION", null, "uk-UA"), uk: client.translate("fun/number:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("fun/number:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/number:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -48,7 +48,7 @@ class Number extends BaseCommand {
const filter = m => !m.author.bot; const filter = m => !m.author.bot;
const collector = new MessageCollector(interaction.channel, { const collector = new MessageCollector(interaction.channel, {
filter, filter,
time: (5 * 60 * 1000), time: 5 * 60 * 1000,
}); });
currentGames[interaction.guildId] = true; currentGames[interaction.guildId] = true;
@ -102,10 +102,12 @@ class Number extends BaseCommand {
collector.stop(); collector.stop();
} }
if (parseInt(msg.content) < number) msg.reply({ if (parseInt(msg.content) < number)
msg.reply({
content: interaction.translate("fun/number:TOO_BIG", { user: msg.author.toString(), number: parsedNumber }), content: interaction.translate("fun/number:TOO_BIG", { user: msg.author.toString(), number: parsedNumber }),
}); });
if (parseInt(msg.content) > number) msg.reply({ if (parseInt(msg.content) > number)
msg.reply({
content: interaction.translate("fun/number:TOO_SMALL", { user: msg.author.toString(), number: parsedNumber }), content: interaction.translate("fun/number:TOO_SMALL", { user: msg.author.toString(), number: parsedNumber }),
}); });
}); });

View file

@ -13,17 +13,20 @@ class TicTacToe extends BaseCommand {
.setName("tictactoe") .setName("tictactoe")
.setDescription(client.translate("fun/tictactoe:DESCRIPTION")) .setDescription(client.translate("fun/tictactoe:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("fun/tictactoe:DESCRIPTION", null, "uk-UA"), uk: client.translate("fun/tictactoe:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("fun/tictactoe:DESCRIPTION", null, "ru-RU"), ru: client.translate("fun/tictactoe:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,17 +12,20 @@ class Afk extends BaseCommand {
.setName("afk") .setName("afk")
.setDescription(client.translate("general/afk:DESCRIPTION")) .setDescription(client.translate("general/afk:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/afk:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/afk:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/afk:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/afk:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("message") .addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("common:MESSAGE")) .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("common:MESSAGE", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("common:MESSAGE", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,22 +12,28 @@ class Avatar extends BaseCommand {
.setName("avatar") .setName("avatar")
.setDescription(client.translate("general/avatar:DESCRIPTION")) .setDescription(client.translate("general/avatar:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/avatar:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/avatar:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/avatar:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/avatar:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
})) }),
.addBooleanOption(option => option.setName("server") )
.addBooleanOption(option =>
option
.setName("server")
.setDescription(client.translate("general/avatar:SERVER")) .setDescription(client.translate("general/avatar:SERVER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/avatar:SERVER", null, "uk-UA"), uk: client.translate("general/avatar:SERVER", null, "uk-UA"),
"ru": client.translate("general/avatar:SERVER", null, "ru-RU"), ru: client.translate("general/avatar:SERVER", null, "ru-RU"),
})), }),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -51,9 +57,11 @@ class Avatar extends BaseCommand {
const avatarURL = interaction.options.getBoolean("server") ? member.avatarURL({ size: 512 }) : member.user.avatarURL({ size: 512 }); const avatarURL = interaction.options.getBoolean("server") ? member.avatarURL({ size: 512 }) : member.user.avatarURL({ size: 512 });
interaction.reply({ interaction.reply({
files: [{ files: [
{
attachment: avatarURL, attachment: avatarURL,
}], },
],
}); });
} }
} }

View file

@ -12,8 +12,8 @@ class Boosters extends BaseCommand {
.setName("boosters") .setName("boosters")
.setDescription(client.translate("general/boosters:DESCRIPTION")) .setDescription(client.translate("general/boosters:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/boosters:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/boosters:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/boosters:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/boosters:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -43,24 +43,11 @@ class Boosters extends BaseCommand {
const embeds = generateBoostersEmbeds(client, interaction, boosters, data.guildData); const embeds = generateBoostersEmbeds(client, interaction, boosters, data.guildData);
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(
.addComponents( new ButtonBuilder().setCustomId("boosters_prev_page").setStyle(ButtonStyle.Primary).setEmoji("⬅️"),
new ButtonBuilder() new ButtonBuilder().setCustomId("boosters_next_page").setStyle(ButtonStyle.Primary).setEmoji("➡️"),
.setCustomId("boosters_prev_page") new ButtonBuilder().setCustomId("boosters_jump_page").setStyle(ButtonStyle.Secondary).setEmoji("↗️"),
.setStyle(ButtonStyle.Primary) new ButtonBuilder().setCustomId("boosters_stop").setStyle(ButtonStyle.Danger).setEmoji("⏹️"),
.setEmoji("⬅️"),
new ButtonBuilder()
.setCustomId("boosters_next_page")
.setStyle(ButtonStyle.Primary)
.setEmoji("➡️"),
new ButtonBuilder()
.setCustomId("boosters_jump_page")
.setStyle(ButtonStyle.Secondary)
.setEmoji("↗️"),
new ButtonBuilder()
.setCustomId("boosters_stop")
.setStyle(ButtonStyle.Danger)
.setEmoji("⏹️"),
); );
await interaction.editReply({ await interaction.editReply({
@ -70,7 +57,7 @@ class Boosters extends BaseCommand {
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
const collector = interaction.guild === null ? (await interaction.user.createDM()).createMessageComponentCollector({ filter, idle: (20 * 1000) }) : interaction.channel.createMessageComponentCollector({ filter, idle: (20 * 1000) }); const collector = interaction.guild === null ? (await interaction.user.createDM()).createMessageComponentCollector({ filter, idle: 20 * 1000 }) : interaction.channel.createMessageComponentCollector({ filter, idle: 20 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isButton()) { if (i.isButton()) {
@ -110,7 +97,7 @@ class Boosters extends BaseCommand {
return res.author.id === interaction.user.id && !isNaN(res.content); return res.author.id === interaction.user.id && !isNaN(res.content);
}; };
interaction.channel.awaitMessages({ filter, max: 1, time: (10 * 1000) }).then(collected => { interaction.channel.awaitMessages({ filter, max: 1, time: 10 * 1000 }).then(collected => {
if (embeds[collected.first().content - 1]) { if (embeds[collected.first().content - 1]) {
currentPage = collected.first().content - 1; currentPage = collected.first().content - 1;
interaction.editReply({ interaction.editReply({
@ -159,7 +146,10 @@ function generateBoostersEmbeds(client, interaction, boosters, guildData) {
let k = 10; let k = 10;
for (let i = 0; i < boosters.size; i += 10) { for (let i = 0; i < boosters.size; i += 10) {
const current = boosters.sort((a, b) => a.premiumSinceTimestamp - b.premiumSinceTimestamp).map(g => g).slice(i, k); const current = boosters
.sort((a, b) => a.premiumSinceTimestamp - b.premiumSinceTimestamp)
.map(g => g)
.slice(i, k);
let j = i; let j = i;
k += 10; k += 10;

View file

@ -12,17 +12,20 @@ class Emoji extends BaseCommand {
.setName("emoji") .setName("emoji")
.setDescription(client.translate("general/emoji:DESCRIPTION")) .setDescription(client.translate("general/emoji:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/emoji:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/emoji:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/emoji:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/emoji:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("emoji") .addStringOption(option =>
option
.setName("emoji")
.setDescription(client.translate("common:EMOJI")) .setDescription(client.translate("common:EMOJI"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("commom:EMOJI", null, "uk-UA"), uk: client.translate("commom:EMOJI", null, "uk-UA"),
"ru": client.translate("common:EMOJI", null, "ru-RU"), ru: client.translate("common:EMOJI", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,18 +12,20 @@ class Help extends BaseCommand {
.setName("help") .setName("help")
.setDescription(client.translate("general/help:DESCRIPTION")) .setDescription(client.translate("general/help:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/help:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/help:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/help:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/help:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => .addStringOption(option =>
option.setName("command") option
.setName("command")
.setDescription(client.translate("common:COMMAND")) .setDescription(client.translate("common:COMMAND"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:COMMAND", null, "uk-UA"), uk: client.translate("common:COMMAND", null, "uk-UA"),
"ru": client.translate("common:COMMAND", null, "ru-RU"), ru: client.translate("common:COMMAND", null, "ru-RU"),
}) })
.setAutocomplete(true)), .setAutocomplete(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -52,7 +54,7 @@ class Help extends BaseCommand {
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, ephemeral: true });
return interaction.editReply({ embeds: [ generateCommandHelp(interaction, command) ] }); return interaction.editReply({ embeds: [generateCommandHelp(interaction, command)] });
} }
commands.forEach(c => { commands.forEach(c => {
@ -72,13 +74,7 @@ class Help extends BaseCommand {
}; };
}); });
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(new StringSelectMenuBuilder().setCustomId("help_category_select").setPlaceholder(client.translate("common:NOTHING_SELECTED")).addOptions(categoriesRows));
.addComponents(
new StringSelectMenuBuilder()
.setCustomId("help_category_select")
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
.addOptions(categoriesRows),
);
const msg = await interaction.editReply({ const msg = await interaction.editReply({
content: interaction.translate("common:AVAILABLE_OPTIONS"), content: interaction.translate("common:AVAILABLE_OPTIONS"),
@ -87,14 +83,16 @@ class Help extends BaseCommand {
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
const collector = msg.createMessageComponentCollector({ filter, idle: (15 * 1000) }); const collector = msg.createMessageComponentCollector({ filter, idle: 15 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isStringSelectMenu() && i.customId === "help_category_select") { if (i.isStringSelectMenu() && i.customId === "help_category_select") {
i.deferUpdate(); i.deferUpdate();
const arg = i?.values[0]; const arg = i?.values[0];
const categoryCommands = commands.filter(cmd => cmd.category === arg).map(c => { const categoryCommands = commands
.filter(cmd => cmd.category === arg)
.map(c => {
return { return {
name: `**${c.command.name}**`, name: `**${c.command.name}**`,
value: interaction.translate(`${arg.toLowerCase()}/${c.command.name}:DESCRIPTION`), value: interaction.translate(`${arg.toLowerCase()}/${c.command.name}:DESCRIPTION`),
@ -146,14 +144,13 @@ class Help extends BaseCommand {
results.slice(0, 25).map(command => ({ results.slice(0, 25).map(command => ({
name: command.command.name, name: command.command.name,
value: command.command.name, value: command.command.name,
}), })),
)); );
} }
} }
function getPermName(bitfield = 0) { function getPermName(bitfield = 0) {
for (const key in PermissionsBitField.Flags) for (const key in PermissionsBitField.Flags) if (PermissionsBitField.Flags[key] === BigInt(bitfield)) return key;
if (PermissionsBitField.Flags[key] === BigInt(bitfield)) return key;
return null; return null;
} }
@ -161,9 +158,7 @@ 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`) === "" ? 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`);
interaction.translate("misc:NO_ARGS")
: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`);
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({

View file

@ -13,17 +13,20 @@ class Minecraft extends BaseCommand {
.setName("minecraft") .setName("minecraft")
.setDescription(client.translate("general/minecraft:DESCRIPTION")) .setDescription(client.translate("general/minecraft:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/minecraft:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/minecraft:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/minecraft:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/minecraft:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("ip") .addStringOption(option =>
option
.setName("ip")
.setDescription(client.translate("common:IP")) .setDescription(client.translate("common:IP"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:IP", null, "uk-UA"), uk: client.translate("common:IP", null, "uk-UA"),
"ru": client.translate("common:IP", null, "ru-RU"), ru: client.translate("common:IP", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -77,7 +80,17 @@ class Minecraft extends BaseCommand {
}, },
{ {
name: interaction.translate("general/minecraft:FIELD_CONNECTED"), name: interaction.translate("general/minecraft:FIELD_CONNECTED"),
value: `**${(res.raw.players ? res.raw.players.online : res.players.length)}** ${client.functions.getNoun((res.raw.players ? res.raw.players.online : res.players.length), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))} / **${(res.raw.players ? res.raw.players.max : res.maxplayers)}** ${client.functions.getNoun((res.raw.players ? res.raw.players.max : res.maxplayers), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))}`, value: `**${res.raw.players ? res.raw.players.online : res.players.length}** ${client.functions.getNoun(
res.raw.players ? res.raw.players.online : res.players.length,
interaction.translate("misc:NOUNS:PLAYERS:1"),
interaction.translate("misc:NOUNS:PLAYERS:2"),
interaction.translate("misc:NOUNS:PLAYERS:5"),
)} / **${res.raw.players ? res.raw.players.max : res.maxplayers}** ${client.functions.getNoun(
res.raw.players ? res.raw.players.max : res.maxplayers,
interaction.translate("misc:NOUNS:PLAYERS:1"),
interaction.translate("misc:NOUNS:PLAYERS:2"),
interaction.translate("misc:NOUNS:PLAYERS:5"),
)}`,
}, },
{ {
name: interaction.translate("general/minecraft:FIELD_IP"), name: interaction.translate("general/minecraft:FIELD_IP"),
@ -88,7 +101,6 @@ class Minecraft extends BaseCommand {
name: interaction.translate("general/minecraft:FIELD_VERSION"), name: interaction.translate("general/minecraft:FIELD_VERSION"),
value: res.raw.vanilla.raw.version.name, value: res.raw.vanilla.raw.version.name,
inline: true, inline: true,
}, },
{ {
name: interaction.translate("general/minecraft:FIELD_PING"), name: interaction.translate("general/minecraft:FIELD_PING"),

View file

@ -12,8 +12,8 @@ class Ping extends BaseCommand {
.setName("ping") .setName("ping")
.setDescription(client.translate("general/ping:DESCRIPTION")) .setDescription(client.translate("general/ping:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/ping:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/ping:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/ping:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/ping:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
@ -44,9 +44,11 @@ class Ping extends BaseCommand {
name: interaction.translate("general/ping:PONG"), name: interaction.translate("general/ping:PONG"),
iconURL: client.user.avatarURL(), iconURL: client.user.avatarURL(),
}) })
.setDescription(interaction.translate("general/ping:PING", { .setDescription(
interaction.translate("general/ping:PING", {
ping: Math.round(client.ws.ping), ping: Math.round(client.ws.ping),
})); }),
);
interaction.reply({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -14,24 +14,30 @@ class Remindme extends BaseCommand {
.setName("remindme") .setName("remindme")
.setDescription(client.translate("general/remindme:DESCRIPTION")) .setDescription(client.translate("general/remindme:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/remindme:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/remindme:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/remindme:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/remindme:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("time") .addStringOption(option =>
option
.setName("time")
.setDescription(client.translate("general/remindme:TIME")) .setDescription(client.translate("general/remindme:TIME"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/remindme:TIME", null, "uk-UA"), uk: client.translate("general/remindme:TIME", null, "uk-UA"),
"ru": client.translate("general/remindme:TIME", null, "ru-RU"), ru: client.translate("general/remindme:TIME", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addStringOption(option => option.setName("message") )
.addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("common:MESSAGE")) .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("common:MESSAGE", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("common:MESSAGE", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,24 +12,30 @@ class Report extends BaseCommand {
.setName("report") .setName("report")
.setDescription(client.translate("general/report:DESCRIPTION")) .setDescription(client.translate("general/report:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/report:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/report:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/report:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/report:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addStringOption(option => option.setName("message") )
.addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("common:MESSAGE")) .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("common:MESSAGE", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("common:MESSAGE", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,8 +12,8 @@ class Serverinfo extends BaseCommand {
.setName("serverinfo") .setName("serverinfo")
.setDescription(client.translate("general/serverinfo:DESCRIPTION")) .setDescription(client.translate("general/serverinfo:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/serverinfo:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/serverinfo:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/serverinfo:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/serverinfo:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -63,8 +63,20 @@ class Serverinfo extends BaseCommand {
}, },
{ {
name: client.customEmojis.users + interaction.translate("common:MEMBERS"), name: client.customEmojis.users + interaction.translate("common:MEMBERS"),
value: `${guild.members.cache.filter(m => !m.user.bot).size} ${client.functions.getNoun(guild.members.cache.filter(m => !m.user.bot).size, interaction.translate("misc:NOUNS:MEMBERS:1"), interaction.translate("misc:NOUNS:MEMBERS:2"), interaction.translate("misc:NOUNS:MEMBERS:5"))}` + value:
"\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${client.functions.getNoun(guild.members.cache.filter(m => m.user.bot).size, interaction.translate("misc:NOUNS:BOTS:1"), interaction.translate("misc:NOUNS:BOTS:2"), interaction.translate("misc:NOUNS:BOTS:5"))}`, `${guild.members.cache.filter(m => !m.user.bot).size} ${client.functions.getNoun(
guild.members.cache.filter(m => !m.user.bot).size,
interaction.translate("misc:NOUNS:MEMBERS:1"),
interaction.translate("misc:NOUNS:MEMBERS:2"),
interaction.translate("misc:NOUNS:MEMBERS:5"),
)}` +
"\n" +
`${guild.members.cache.filter(m => m.user.bot).size} ${client.functions.getNoun(
guild.members.cache.filter(m => m.user.bot).size,
interaction.translate("misc:NOUNS:BOTS:1"),
interaction.translate("misc:NOUNS:BOTS:2"),
interaction.translate("misc:NOUNS:BOTS:5"),
)}`,
inline: true, inline: true,
}, },
{ {
@ -89,9 +101,27 @@ class Serverinfo extends BaseCommand {
}, },
{ {
name: client.customEmojis.channels + interaction.translate("common:CHANNELS"), name: client.customEmojis.channels + interaction.translate("common:CHANNELS"),
value: `${guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size} ${client.functions.getNoun(guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size, interaction.translate("misc:NOUNS:TEXT:1"), interaction.translate("misc:NOUNS:TEXT:2"), interaction.translate("misc:NOUNS:TEXT:5"))}` + value:
"\n" + `${guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size} ${client.functions.getNoun(guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size, interaction.translate("misc:NOUNS:VOICE:1"), interaction.translate("misc:NOUNS:VOICE:2"), interaction.translate("misc:NOUNS:VOICE:5"))}` + `${guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size} ${client.functions.getNoun(
"\n" + `${guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size} ${client.functions.getNoun(guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size, interaction.translate("misc:NOUNS:CATEGORY:1"), interaction.translate("misc:NOUNS:CATEGORY:2"), interaction.translate("misc:NOUNS:CATEGORY:5"))}`, guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size,
interaction.translate("misc:NOUNS:TEXT:1"),
interaction.translate("misc:NOUNS:TEXT:2"),
interaction.translate("misc:NOUNS:TEXT:5"),
)}` +
"\n" +
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size} ${client.functions.getNoun(
guild.channels.cache.filter(c => c.type === ChannelType.GuildVoice).size,
interaction.translate("misc:NOUNS:VOICE:1"),
interaction.translate("misc:NOUNS:VOICE:2"),
interaction.translate("misc:NOUNS:VOICE:5"),
)}` +
"\n" +
`${guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size} ${client.functions.getNoun(
guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size,
interaction.translate("misc:NOUNS:CATEGORY:1"),
interaction.translate("misc:NOUNS:CATEGORY:2"),
interaction.translate("misc:NOUNS:CATEGORY:5"),
)}`,
inline: true, inline: true,
}, },
]) ])

View file

@ -13,17 +13,20 @@ class Shorturl extends BaseCommand {
.setName("shorturl") .setName("shorturl")
.setDescription(client.translate("general/shorturl:DESCRIPTION")) .setDescription(client.translate("general/shorturl:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/shorturl:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/shorturl:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/shorturl:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/shorturl:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("url") .addStringOption(option =>
option
.setName("url")
.setDescription(client.translate("common:URL")) .setDescription(client.translate("common:URL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:URL", null, "uk-UA"), uk: client.translate("common:URL", null, "uk-UA"),
"ru": client.translate("common:URL", null, "ru-RU"), ru: client.translate("common:URL", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,8 +12,8 @@ class Stats extends BaseCommand {
.setName("stats") .setName("stats")
.setDescription(client.translate("general/stats:DESCRIPTION")) .setDescription(client.translate("general/stats:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/stats:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/stats:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/stats:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/stats:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
@ -80,7 +80,12 @@ class Stats extends BaseCommand {
{ {
name: client.customEmojis.voice + " " + interaction.translate("general/stats:MUSIC_TITLE"), name: client.customEmojis.voice + " " + interaction.translate("general/stats:MUSIC_TITLE"),
value: interaction.translate("general/stats:MUSIC_CONTENT", { value: interaction.translate("general/stats:MUSIC_CONTENT", {
count: `${client.player.nodes.cache.size} ${client.functions.getNoun(client.player.nodes.cache.size, interaction.translate("misc:NOUNS:SERVERS:1"), interaction.translate("misc:NOUNS:SERVERS:2"), interaction.translate("misc:NOUNS:SERVERS:5"))}`, count: `${client.player.nodes.cache.size} ${client.functions.getNoun(
client.player.nodes.cache.size,
interaction.translate("misc:NOUNS:SERVERS:1"),
interaction.translate("misc:NOUNS:SERVERS:2"),
interaction.translate("misc:NOUNS:SERVERS:5"),
)}`,
}), }),
}, },
{ {
@ -92,7 +97,7 @@ class Stats extends BaseCommand {
value: interaction.translate("misc:STATS_FOOTER", { value: interaction.translate("misc:STATS_FOOTER", {
dashboardLink: client.config.dashboard.domain, dashboardLink: client.config.dashboard.domain,
supportLink: "https://discord.gg/Ptkj2n9nzZ", supportLink: "https://discord.gg/Ptkj2n9nzZ",
inviteLink: client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] }), inviteLink: client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [PermissionsBitField.Flags.Administrator] }),
donateLink: "https://www.donationalerts.com/r/jonny_bro", donateLink: "https://www.donationalerts.com/r/jonny_bro",
owner: client.config.owner.id, owner: client.config.owner.id,
}), }),

View file

@ -12,17 +12,20 @@ class Suggest extends BaseCommand {
.setName("suggest") .setName("suggest")
.setDescription(client.translate("general/suggest:DESCRIPTION")) .setDescription(client.translate("general/suggest:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/suggest:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/suggest:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/suggest:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/suggest:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addStringOption(option => option.setName("message") .addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("common:MESSAGE")) .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("common:MESSAGE", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("common:MESSAGE", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,16 +12,19 @@ class Userinfo extends BaseCommand {
.setName("userinfo") .setName("userinfo")
.setDescription(client.translate("general/userinfo:DESCRIPTION")) .setDescription(client.translate("general/userinfo:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/userinfo:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/userinfo:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/userinfo:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/userinfo:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
})), }),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -47,9 +50,11 @@ class Userinfo extends BaseCommand {
name: `${member.user.getUsername()} (${member.id})`, name: `${member.user.getUsername()} (${member.id})`,
iconURL: member.displayAvatarURL(), iconURL: member.displayAvatarURL(),
}) })
.setThumbnail(member.displayAvatarURL({ .setThumbnail(
member.displayAvatarURL({
size: 512, size: 512,
})) }),
)
.addFields([ .addFields([
{ {
name: ":man: " + interaction.translate("common:USERNAME"), name: ":man: " + interaction.translate("common:USERNAME"),
@ -88,9 +93,13 @@ class Userinfo extends BaseCommand {
}, },
{ {
name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"), name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"),
value: (member.roles.size > 10 ? member.roles.cache.map(r => r).slice(0, 10).join(", ") + " " + interaction.translate("general/userinfo:MORE_ROLES", { value:
member.roles.size > 10
? member.roles.cache.map(r => r).filter(r => r.id !== interaction.guild.roles.everyone.id).slice(0, 10).join(", ") + " " +
interaction.translate("general/userinfo:MORE_ROLES", {
count: member.roles.cache.size - 10, count: member.roles.cache.size - 10,
}) : (member.roles.cache.size < 1) ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map(r => r).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,
}, },
]) ])

View file

@ -13,17 +13,20 @@ class Whois extends BaseCommand {
.setName("whois") .setName("whois")
.setDescription(client.translate("general/whois:DESCRIPTION")) .setDescription(client.translate("general/whois:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("general/whois:DESCRIPTION", null, "uk-UA"), uk: client.translate("general/whois:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/whois:DESCRIPTION", null, "ru-RU"), ru: client.translate("general/whois:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("ip") .addStringOption(option =>
option
.setName("ip")
.setDescription(client.translate("common:IP")) .setDescription(client.translate("common:IP"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:IP", null, "uk-UA"), uk: client.translate("common:IP", null, "uk-UA"),
"ru": client.translate("common:IP", null, "ru-RU"), ru: client.translate("common:IP", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -51,9 +54,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 = new EmbedBuilder()
.setTitle(interaction.translate("general/whois:INFO_ABOUT", { .setTitle(
interaction.translate("general/whois:INFO_ABOUT", {
ip, ip,
})) }),
)
.setFooter({ .setFooter({
text: client.config.embed.footer, text: client.config.embed.footer,
}) })

View file

@ -14,8 +14,8 @@ class Checkjar extends BaseCommand {
.setName("checkjar") .setName("checkjar")
.setDescription(client.translate("iat/checkjar:DESCRIPTION")) .setDescription(client.translate("iat/checkjar:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("iat/checkjar:DESCRIPTION", null, "uk-UA"), uk: client.translate("iat/checkjar:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("iat/checkjar:DESCRIPTION", null, "ru-RU"), ru: client.translate("iat/checkjar:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -47,7 +47,7 @@ class Checkjar extends BaseCommand {
}, },
}).then(res => res.json()); }).then(res => res.json());
const jar = clientInfo.jars[1]; const jar = clientInfo.jars[1];
const jarTransactions = await fetch(`https://api.monobank.ua/personal/statement/${jar.id}/${Date.now() - (7 * 24 * 60 * 60 * 1000)}/${Date.now()}`, { const jarTransactions = await fetch(`https://api.monobank.ua/personal/statement/${jar.id}/${Date.now() - 7 * 24 * 60 * 60 * 1000}/${Date.now()}`, {
method: "GET", method: "GET",
headers: { headers: {
"X-Token": client.config.apiKeys.monobankApiKey, "X-Token": client.config.apiKeys.monobankApiKey,

View file

@ -12,30 +12,39 @@ class Clear extends BaseCommand {
.setName("clear") .setName("clear")
.setDescription(client.translate("moderation/clear:DESCRIPTION")) .setDescription(client.translate("moderation/clear:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/clear:DESCRIPTION", null, "uk-UA"), uk: client.translate("moderation/clear:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("moderation/clear:DESCRIPTION", null, "ru-RU"), ru: client.translate("moderation/clear:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
.addStringOption(option => option.setName("option") .addStringOption(option =>
option
.setName("option")
.setDescription(client.translate("moderation/clear:OPTION")) .setDescription(client.translate("moderation/clear:OPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/clear:OPTION", null, "uk-UA"), uk: client.translate("moderation/clear:OPTION", null, "uk-UA"),
"ru": client.translate("moderation/clear:OPTION", null, "ru-RU"), ru: client.translate("moderation/clear:OPTION", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addUserOption(option => option.setName("user") )
.addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
})) }),
.addStringOption(option => option.setName("id") )
.addStringOption(option =>
option
.setName("id")
.setDescription(client.translate("common:USER_ID")) .setDescription(client.translate("common:USER_ID"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER_ID", null, "uk-UA"), uk: client.translate("common:USER_ID", null, "uk-UA"),
"ru": client.translate("common:USER_ID", null, "ru-RU"), ru: client.translate("common:USER_ID", null, "ru-RU"),
})), }),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -62,16 +71,9 @@ class Clear extends BaseCommand {
user_id = interaction.options.getString("id"); user_id = interaction.options.getString("id");
if (option === "all") { if (option === "all") {
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(
.addComponents( new ButtonBuilder().setCustomId("clear_confirm_yes").setLabel(interaction.translate("common:ACCEPT")).setStyle(ButtonStyle.Danger),
new ButtonBuilder() new ButtonBuilder().setCustomId("clear_confirm_no").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Secondary),
.setCustomId("clear_confirm_yes")
.setLabel(interaction.translate("common:ACCEPT"))
.setStyle(ButtonStyle.Danger),
new ButtonBuilder()
.setCustomId("clear_confirm_no")
.setLabel(interaction.translate("common:CANCEL"))
.setStyle(ButtonStyle.Secondary),
); );
await interaction.editReply({ await interaction.editReply({
@ -80,7 +82,7 @@ class Clear extends BaseCommand {
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (15 * 1000) }); const collector = interaction.channel.createMessageComponentCollector({ filter, idle: 15 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isButton()) { if (i.isButton()) {
@ -132,12 +134,15 @@ class Clear extends BaseCommand {
if (user_id && member) return interaction.replyT("moderation/clear:REQUIRE_ID_USER", null, { edit: true }); if (user_id && member) return interaction.replyT("moderation/clear:REQUIRE_ID_USER", null, { edit: true });
if (user_id || member) messages = messages.filter(m => m.author.id === (user_id || member.id)); if (user_id || member) messages = messages.filter(m => m.author.id === (user_id || member.id));
interaction.channel.bulkDelete(messages.filter(m => !m.pinned), true); interaction.channel.bulkDelete(
messages.filter(m => !m.pinned),
true,
);
if (member || user_id) { if (member || user_id) {
interaction.replyT("moderation/clear:CLEARED_MEMBER", { interaction.replyT("moderation/clear:CLEARED_MEMBER", {
amount: `**${option}** ${client.functions.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`, amount: `**${option}** ${client.functions.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`,
user: member && member.user.getUsername() || user_id, user: (member && member.user.getUsername()) || user_id,
}, { edit: true }); }, { edit: true });
} else { } else {
interaction.replyT("moderation/clear:CLEARED", { interaction.replyT("moderation/clear:CLEARED", {

View file

@ -12,18 +12,21 @@ class Clearwarns extends BaseCommand {
.setName("clearwarns") .setName("clearwarns")
.setDescription(client.translate("moderation/clearwarns:DESCRIPTION")) .setDescription(client.translate("moderation/clearwarns:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/clearwarns:DESCRIPTION", null, "uk-UA"), uk: client.translate("moderation/clearwarns:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("moderation/clearwarns:DESCRIPTION", null, "ru-RU"), ru: client.translate("moderation/clearwarns:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -13,87 +13,116 @@ class Giveaway extends BaseCommand {
.setName("giveaway") .setName("giveaway")
.setDescription(client.translate("moderation/giveaway:DESCRIPTION")) .setDescription(client.translate("moderation/giveaway:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:DESCRIPTION", null, "uk-UA"), uk: client.translate("moderation/giveaway:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:DESCRIPTION", null, "ru-RU"), ru: client.translate("moderation/giveaway:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
.addSubcommand(subcommand => subcommand.setName("create") .addSubcommand(subcommand =>
subcommand
.setName("create")
.setDescription(client.translate("moderation/giveaway:CREATE")) .setDescription(client.translate("moderation/giveaway:CREATE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:CREATE", null, "uk-UA"), uk: client.translate("moderation/giveaway:CREATE", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:CREATE", null, "ru-RU"), ru: client.translate("moderation/giveaway:CREATE", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("duration") .addStringOption(option =>
option
.setName("duration")
.setDescription(client.translate("common:DURATION")) .setDescription(client.translate("common:DURATION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:DURATION", null, "uk-UA"), uk: client.translate("common:DURATION", null, "uk-UA"),
"ru": client.translate("common:DURATION", null, "ru-RU"), ru: client.translate("common:DURATION", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addIntegerOption(option => option.setName("winners_count") )
.addIntegerOption(option =>
option
.setName("winners_count")
.setDescription(client.translate("moderation/giveaway:WINNERS_COUNT")) .setDescription(client.translate("moderation/giveaway:WINNERS_COUNT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:WINNERS_COUNT", null, "uk-UA"), uk: client.translate("moderation/giveaway:WINNERS_COUNT", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:WINNERS_COUNT", null, "ru-RU"), ru: client.translate("moderation/giveaway:WINNERS_COUNT", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addStringOption(option => option.setName("prize") )
.addStringOption(option =>
option
.setName("prize")
.setDescription(client.translate("moderation/giveaway:PRIZE")) .setDescription(client.translate("moderation/giveaway:PRIZE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:PRIZE", null, "uk-UA"), uk: client.translate("moderation/giveaway:PRIZE", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:PRIZE", null, "ru-RU"), ru: client.translate("moderation/giveaway:PRIZE", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addBooleanOption(option => option.setName("isdrop") )
.addBooleanOption(option =>
option
.setName("isdrop")
.setDescription(client.translate("moderation/giveaway:ISDROP")) .setDescription(client.translate("moderation/giveaway:ISDROP"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:ISDROP", null, "uk-UA"), uk: client.translate("moderation/giveaway:ISDROP", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:ISDROP", null, "ru-RU"), ru: client.translate("moderation/giveaway:ISDROP", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("reroll") .addSubcommand(subcommand =>
subcommand
.setName("reroll")
.setDescription(client.translate("moderation/giveaway:REROLL")) .setDescription(client.translate("moderation/giveaway:REROLL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:REROLL", null, "uk-UA"), uk: client.translate("moderation/giveaway:REROLL", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:REROLL", null, "ru-RU"), ru: client.translate("moderation/giveaway:REROLL", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("giveaway_id") .addStringOption(option =>
option
.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID")) .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"), uk: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"), ru: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("end") .addSubcommand(subcommand =>
subcommand
.setName("end")
.setDescription(client.translate("moderation/giveaway:END")) .setDescription(client.translate("moderation/giveaway:END"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:END", null, "uk-UA"), uk: client.translate("moderation/giveaway:END", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:END", null, "ru-RU"), ru: client.translate("moderation/giveaway:END", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("giveaway_id") .addStringOption(option =>
option
.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID")) .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"), uk: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"), ru: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("delete") .addSubcommand(subcommand =>
subcommand
.setName("delete")
.setDescription(client.translate("moderation/giveaway:DELETE")) .setDescription(client.translate("moderation/giveaway:DELETE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:DELETE", null, "uk-UA"), uk: client.translate("moderation/giveaway:DELETE", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:DELETE", null, "ru-RU"), ru: client.translate("moderation/giveaway:DELETE", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("giveaway_id") .addStringOption(option =>
option
.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID")) .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"), uk: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"), ru: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
@ -129,7 +158,8 @@ class Giveaway extends BaseCommand {
const prize = interaction.options.getString("prize"); const prize = interaction.options.getString("prize");
const isdrop = interaction.options.getBoolean("isdrop"); const isdrop = interaction.options.getBoolean("isdrop");
client.giveawaysManager.start(interaction.channel, { client.giveawaysManager
.start(interaction.channel, {
duration: ms(duration), duration: ms(duration),
winnerCount: winnersCount, winnerCount: winnersCount,
prize: prize, prize: prize,
@ -149,20 +179,24 @@ class Giveaway extends BaseCommand {
endedAt: interaction.translate("moderation/giveaway:END_AT"), endedAt: interaction.translate("moderation/giveaway:END_AT"),
hostedBy: interaction.translate("moderation/giveaway:HOSTED_BY"), hostedBy: interaction.translate("moderation/giveaway:HOSTED_BY"),
}, },
}).then(() => { })
.then(() => {
return interaction.success("moderation/giveaway:GIVEAWAY_CREATED", null, { ephemeral: true }); return interaction.success("moderation/giveaway:GIVEAWAY_CREATED", null, { ephemeral: true });
}); });
} else if (command === "reroll") { } else if (command === "reroll") {
const giveaway_id = interaction.options.getString("giveaway_id"); const giveaway_id = interaction.options.getString("giveaway_id");
client.giveawaysManager.reroll(giveaway_id, { client.giveawaysManager
.reroll(giveaway_id, {
messages: { messages: {
congrat: interaction.translate("moderation/giveaway:REROLL_CONGRAT"), congrat: interaction.translate("moderation/giveaway:REROLL_CONGRAT"),
error: interaction.translate("moderation/giveaway:REROLL_ERROR"), error: interaction.translate("moderation/giveaway:REROLL_ERROR"),
}, },
}).then(() => { })
.then(() => {
return interaction.success("moderation/giveaway:GIVEAWAY_REROLLED"); return interaction.success("moderation/giveaway:GIVEAWAY_REROLLED");
}).catch(() => { })
.catch(() => {
return interaction.error("moderation/giveaway:NOT_FOUND_ENDED", { return interaction.error("moderation/giveaway:NOT_FOUND_ENDED", {
messageId: giveaway_id, messageId: giveaway_id,
}, { ephemeral: true }); }, { ephemeral: true });
@ -181,9 +215,12 @@ class Giveaway extends BaseCommand {
} else if (command === "delete") { } else if (command === "delete") {
const giveaway_id = interaction.options.getString("giveaway_id"); const giveaway_id = interaction.options.getString("giveaway_id");
client.giveawaysManager.delete(giveaway_id).then(() => { client.giveawaysManager
.delete(giveaway_id)
.then(() => {
return interaction.success("moderation/giveaway:GIVEAWAY_DELETED"); return interaction.success("moderation/giveaway:GIVEAWAY_DELETED");
}).catch(() => { })
.catch(() => {
return interaction.error("moderation/giveaway:NOT_FOUND", { return interaction.error("moderation/giveaway:NOT_FOUND", {
messageId: giveaway_id, messageId: giveaway_id,
}, { ephemeral: true }); }, { ephemeral: true });

View file

@ -12,18 +12,21 @@ class Poll extends BaseCommand {
.setName("poll") .setName("poll")
.setDescription(client.translate("moderation/poll:DESCRIPTION")) .setDescription(client.translate("moderation/poll:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/poll:DESCRIPTION", null, "uk-UA"), uk: client.translate("moderation/poll:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("moderation/poll:DESCRIPTION", null, "ru-RU"), ru: client.translate("moderation/poll:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
.addStringOption(option => option.setName("question") .addStringOption(option =>
option
.setName("question")
.setDescription(client.translate("moderation/poll:QUESTION")) .setDescription(client.translate("moderation/poll:QUESTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/poll:QUESTION", null, "uk-UA"), uk: client.translate("moderation/poll:QUESTION", null, "uk-UA"),
"ru": client.translate("moderation/poll:QUESTION", null, "ru-RU"), ru: client.translate("moderation/poll:QUESTION", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -45,27 +48,13 @@ class Poll extends BaseCommand {
async execute(client, interaction) { async execute(client, interaction) {
const question = interaction.options.getString("question"); const question = interaction.options.getString("question");
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(
.addComponents( new ButtonBuilder().setCustomId("poll_everyone").setLabel("@everyone").setStyle(ButtonStyle.Primary),
new ButtonBuilder() new ButtonBuilder().setCustomId("poll_here").setLabel("@here").setStyle(ButtonStyle.Primary),
.setCustomId("poll_everyone") new ButtonBuilder().setCustomId("poll_nothing").setLabel(interaction.translate("moderation/poll:NOTHING")).setStyle(ButtonStyle.Primary),
.setLabel("@everyone") new ButtonBuilder().setCustomId("poll_cancel").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Danger),
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId("poll_here")
.setLabel("@here")
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId("poll_nothing")
.setLabel(interaction.translate("moderation/poll:NOTHING"))
.setStyle(ButtonStyle.Primary),
new ButtonBuilder()
.setCustomId("poll_cancel")
.setLabel(interaction.translate("common:CANCEL"))
.setStyle(ButtonStyle.Danger),
); );
await interaction.reply({ await interaction.reply({
content: interaction.translate("moderation/poll:SELECT_MENTION"), content: interaction.translate("moderation/poll:SELECT_MENTION"),
ephemeral: true, ephemeral: true,
@ -74,7 +63,7 @@ class Poll extends BaseCommand {
let mention = null; let mention = null;
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (15 * 1000) }); const collector = interaction.channel.createMessageComponentCollector({ filter, idle: 15 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isButton()) { if (i.isButton()) {

View file

@ -12,18 +12,21 @@ class Unban extends BaseCommand {
.setName("unban") .setName("unban")
.setDescription(client.translate("moderation/unban:DESCRIPTION")) .setDescription(client.translate("moderation/unban:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/unban:DESCRIPTION", null, "uk-UA"), uk: client.translate("moderation/unban:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("moderation/unban:DESCRIPTION", null, "ru-RU"), ru: client.translate("moderation/unban:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
.addStringOption(option => option.setName("user_id") .addStringOption(option =>
option
.setName("user_id")
.setDescription(client.translate("common:USER_ID")) .setDescription(client.translate("common:USER_ID"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER_ID", null, "uk-UA"), uk: client.translate("common:USER_ID", null, "uk-UA"),
"ru": client.translate("common:USER_ID", null, "ru-RU"), ru: client.translate("common:USER_ID", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -8,11 +8,7 @@ class Warn extends BaseCommand {
*/ */
constructor() { constructor() {
super({ super({
command: new ContextMenuCommandBuilder() command: new ContextMenuCommandBuilder().setName("warn").setType(ApplicationCommandType.User).setDMPermission(false).setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages),
.setName("warn")
.setType(ApplicationCommandType.User)
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -47,7 +43,9 @@ class Warn extends BaseCommand {
const modal = new ModalBuilder() const modal = new ModalBuilder()
.setCustomId("warn_modal") .setCustomId("warn_modal")
.setTitle(interaction.translate("moderation/warn:MODAL_TITLE", { nickname: member.user.getUsername() }).normalize("NFKD")); .setTitle(interaction.translate("moderation/warn:MODAL_TITLE", {
nickname: member.user.getUsername(),
}).normalize("NFKD"));
const reasonInput = new TextInputBuilder() const reasonInput = new TextInputBuilder()
.setCustomId("warn_reason") .setCustomId("warn_reason")
@ -61,10 +59,12 @@ class Warn extends BaseCommand {
await interaction.showModal(modal); await interaction.showModal(modal);
const submitted = await interaction.awaitModalSubmit({ const submitted = await interaction
time: (2 * 60 * 1000), .awaitModalSubmit({
time: 2 * 60 * 1000,
filter: i => i.user.id === interaction.member.id && i.customId === "warn_modal", filter: i => i.user.id === interaction.member.id && i.customId === "warn_modal",
}).catch(() => { })
.catch(() => {
interaction.followUp({ interaction.followUp({
content: interaction.translate("misc:TIMED_OUT"), content: interaction.translate("misc:TIMED_OUT"),
ephemeral: true, ephemeral: true,
@ -85,8 +85,7 @@ class Warn extends BaseCommand {
reason, reason,
}; };
const embed = new EmbedBuilder() const embed = new EmbedBuilder().addFields([
.addFields([
{ {
name: interaction.translate("common:USER"), name: interaction.translate("common:USER"),
value: `\`${member.user.getUsername()}\` (${member.user.toString()})`, value: `\`${member.user.getUsername()}\` (${member.user.toString()})`,

View file

@ -12,18 +12,21 @@ class Warns extends BaseCommand {
.setName("warns") .setName("warns")
.setDescription(client.translate("moderation/warns:DESCRIPTION")) .setDescription(client.translate("moderation/warns:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("moderation/warns:DESCRIPTION", null, "uk-UA"), uk: client.translate("moderation/warns:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("moderation/warns:DESCRIPTION", null, "ru-RU"), ru: client.translate("moderation/warns:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages) .setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
.addUserOption(option => option.setName("user") .addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -56,10 +59,7 @@ class Warns extends BaseCommand {
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(),
extension: "png",
size: 512,
}),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
@ -67,9 +67,11 @@ class Warns extends BaseCommand {
}); });
if (memberData.sanctions.length === 0) { if (memberData.sanctions.length === 0) {
embed.setDescription(interaction.translate("moderation/warns:NO_SANCTIONS", { embed.setDescription(
interaction.translate("moderation/warns:NO_SANCTIONS", {
member: member.user.getUsername(), member: member.user.getUsername(),
})); }),
);
return interaction.reply({ return interaction.reply({
embeds: [embed], embeds: [embed],
}); });
@ -84,6 +86,7 @@ class Warns extends BaseCommand {
]); ]);
}); });
} }
interaction.reply({ interaction.reply({
embeds: [embed], embeds: [embed],
}); });

View file

@ -12,8 +12,8 @@ class Back extends BaseCommand {
.setName("back") .setName("back")
.setDescription(client.translate("music/back:DESCRIPTION")) .setDescription(client.translate("music/back:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/back:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/back:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/back:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/back:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],

View file

@ -14,18 +14,21 @@ class Clips extends BaseCommand {
.setName("clips") .setName("clips")
.setDescription(client.translate("music/clips:DESCRIPTION")) .setDescription(client.translate("music/clips:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/clips:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/clips:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/clips:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/clips:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addStringOption(option => option.setName("query") .addStringOption(option =>
option
.setName("query")
.setDescription(client.translate("music/clips:QUERY")) .setDescription(client.translate("music/clips:QUERY"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/clips:QUERY", null, "uk-UA"), uk: client.translate("music/clips:QUERY", null, "uk-UA"),
"ru": client.translate("music/clips:QUERY", null, "ru-RU"), ru: client.translate("music/clips:QUERY", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setAutocomplete(true)), .setAutocomplete(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -92,8 +95,8 @@ class Clips extends BaseCommand {
results.slice(0, 25).map(file => ({ results.slice(0, 25).map(file => ({
name: file.substring(0, file.length - 4), name: file.substring(0, file.length - 4),
value: `./clips/${file}`, value: `./clips/${file}`,
}), })),
)); );
} }
} }

View file

@ -13,15 +13,17 @@ class Loop extends BaseCommand {
.setName("loop") .setName("loop")
.setDescription(client.translate("music/loop:DESCRIPTION")) .setDescription(client.translate("music/loop:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/loop:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/loop:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/loop:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/loop:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addStringOption(option => option.setName("option") .addStringOption(option =>
option
.setName("option")
.setDescription(client.translate("music/loop:OPTION")) .setDescription(client.translate("music/loop:OPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/loop:OPTION", null, "uk-UA"), uk: client.translate("music/loop:OPTION", null, "uk-UA"),
"ru": client.translate("music/loop:OPTION", null, "ru-RU"), ru: client.translate("music/loop:OPTION", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setChoices( .setChoices(
@ -29,7 +31,8 @@ class Loop extends BaseCommand {
{ name: client.translate("music/loop:QUEUE"), value: "2" }, { name: client.translate("music/loop:QUEUE"), value: "2" },
{ name: client.translate("music/loop:TRACK"), value: "1" }, { name: client.translate("music/loop:TRACK"), value: "1" },
{ name: client.translate("music/loop:DISABLE"), value: "0" }, { name: client.translate("music/loop:DISABLE"), value: "0" },
)), ),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -56,17 +59,11 @@ class Loop extends BaseCommand {
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true }); if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true });
const type = interaction.options.getString("option"), const type = interaction.options.getString("option"),
mode = type === "3" ? QueueRepeatMode.AUTOPLAY : mode = type === "3" ? QueueRepeatMode.AUTOPLAY : type === "2" ? QueueRepeatMode.QUEUE : type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
type === "2" ? QueueRepeatMode.QUEUE :
type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
queue.setRepeatMode(mode); queue.setRepeatMode(mode);
interaction.success(`music/loop:${ interaction.success(`music/loop:${type === "3" ? "AUTOPLAY_ENABLED" : type === "2" ? "QUEUE_ENABLED" : type === "1" ? "TRACK_ENABLED" : "LOOP_DISABLED"}`);
type === "3" ? "AUTOPLAY_ENABLED" :
type === "2" ? "QUEUE_ENABLED" :
type === "1" ? "TRACK_ENABLED" : "LOOP_DISABLED"
}`);
} }
} }

View file

@ -13,8 +13,8 @@ class Nowplaying extends BaseCommand {
.setName("nowplaying") .setName("nowplaying")
.setDescription(client.translate("music/nowplaying:DESCRIPTION")) .setDescription(client.translate("music/nowplaying:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/nowplaying:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/nowplaying:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/nowplaying:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/nowplaying:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -77,9 +77,13 @@ class Nowplaying extends BaseCommand {
{ {
name: "\u200b", name: "\u200b",
value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${ value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${
queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") : queue.repeatMode === QueueRepeatMode.AUTOPLAY
queue.repeatMode === QueueRepeatMode.QUEUE ? interaction.translate("music/nowplaying:QUEUE") : ? interaction.translate("music/nowplaying:AUTOPLAY")
queue.repeatMode === QueueRepeatMode.TRACK ? interaction.translate("music/nowplaying:TRACK") : interaction.translate("common:DISABLED") : queue.repeatMode === QueueRepeatMode.QUEUE
? interaction.translate("music/nowplaying:QUEUE")
: queue.repeatMode === QueueRepeatMode.TRACK
? interaction.translate("music/nowplaying:TRACK")
: interaction.translate("common:DISABLED")
}\``, }\``,
}, },
]) ])

View file

@ -12,18 +12,21 @@ class Play extends BaseCommand {
.setName("play") .setName("play")
.setDescription(client.translate("music/play:DESCRIPTION")) .setDescription(client.translate("music/play:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/play:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/play:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/play:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/play:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addStringOption(option => option.setName("query") .addStringOption(option =>
option
.setName("query")
.setDescription(client.translate("music/play:QUERY")) .setDescription(client.translate("music/play:QUERY"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/play:QUERY", null, "uk-UA"), uk: client.translate("music/play:QUERY", null, "uk-UA"),
"ru": client.translate("music/play:QUERY", null, "ru-RU"), ru: client.translate("music/play:QUERY", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setAutocomplete(true)), .setAutocomplete(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -96,10 +99,10 @@ class Play extends BaseCommand {
return interaction.respond( return interaction.respond(
results.tracks.slice(0, 10).map(track => ({ results.tracks.slice(0, 10).map(track => ({
name: (`${track.author} - ${track.title}`.length >= 100 & `${track.author} - ${track.title}`.slice(0, 90) + "...") || `${track.author} - ${track.title}`, name: (`${track.author} - ${track.title}`.length >= 100) & (`${track.author} - ${track.title}`.slice(0, 90) + "...") || `${track.author} - ${track.title}`,
value: track.url, value: track.url,
}), })),
)); );
} }
} }

View file

@ -13,8 +13,8 @@ class Queue extends BaseCommand {
.setName("queue") .setName("queue")
.setDescription(client.translate("music/queue:DESCRIPTION")) .setDescription(client.translate("music/queue:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/queue:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/queue:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/queue:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/queue:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
@ -42,28 +42,11 @@ class Queue extends BaseCommand {
let currentPage = 0; let currentPage = 0;
let embeds = generateQueueEmbeds(interaction, queue); let embeds = generateQueueEmbeds(interaction, queue);
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(
.addComponents( new ButtonBuilder().setCustomId("queue_prev_page").setLabel(interaction.translate("music/queue:PREV_PAGE")).setStyle(ButtonStyle.Primary).setEmoji("⬅️"),
new ButtonBuilder() new ButtonBuilder().setCustomId("queue_next_page").setLabel(interaction.translate("music/queue:NEXT_PAGE")).setStyle(ButtonStyle.Primary).setEmoji("➡️"),
.setCustomId("queue_prev_page") new ButtonBuilder().setCustomId("queue_jump_page").setLabel(interaction.translate("music/queue:JUMP_PAGE")).setStyle(ButtonStyle.Secondary).setEmoji("↗️"),
.setLabel(interaction.translate("music/queue:PREV_PAGE")) new ButtonBuilder().setCustomId("queue_stop").setLabel(interaction.translate("common:CANCEL")).setStyle(ButtonStyle.Danger).setEmoji("⏹️"),
.setStyle(ButtonStyle.Primary)
.setEmoji("⬅️"),
new ButtonBuilder()
.setCustomId("queue_next_page")
.setLabel(interaction.translate("music/queue:NEXT_PAGE"))
.setStyle(ButtonStyle.Primary)
.setEmoji("➡️"),
new ButtonBuilder()
.setCustomId("queue_jump_page")
.setLabel(interaction.translate("music/queue:JUMP_PAGE"))
.setStyle(ButtonStyle.Secondary)
.setEmoji("↗️"),
new ButtonBuilder()
.setCustomId("queue_stop")
.setLabel(interaction.translate("common:CANCEL"))
.setStyle(ButtonStyle.Danger)
.setEmoji("⏹️"),
); );
await interaction.reply({ await interaction.reply({
@ -73,7 +56,7 @@ class Queue extends BaseCommand {
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
const collector = interaction.channel.createMessageComponentCollector({ filter, idle: (20 * 1000) }); const collector = interaction.channel.createMessageComponentCollector({ filter, idle: 20 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isButton()) { if (i.isButton()) {
@ -116,7 +99,7 @@ class Queue extends BaseCommand {
return res.author.id === interaction.user.id && !isNaN(res.content); return res.author.id === interaction.user.id && !isNaN(res.content);
}; };
interaction.channel.awaitMessages({ filter, max: 1, time: (10 * 1000) }).then(collected => { interaction.channel.awaitMessages({ filter, max: 1, time: 10 * 1000 }).then(collected => {
if (embeds[collected.first().content - 1]) { if (embeds[collected.first().content - 1]) {
currentPage = collected.first().content - 1; currentPage = collected.first().content - 1;
interaction.editReply({ interaction.editReply({
@ -168,11 +151,19 @@ function generateQueueEmbeds(interaction, queue) {
.setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING")) .setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING"))
.setThumbnail(currentTrack.thumbnail) .setThumbnail(currentTrack.thumbnail)
.setColor(interaction.client.config.embed.color) .setColor(interaction.client.config.embed.color)
.setDescription(`${interaction.translate("music/nowplaying:REPEAT")}: \`${ .setDescription(
queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") : `${interaction.translate("music/nowplaying:REPEAT")}: \`${
queue.repeatMode === QueueRepeatMode.QUEUE ? interaction.translate("music/nowplaying:QUEUE") : queue.repeatMode === QueueRepeatMode.AUTOPLAY
queue.repeatMode === QueueRepeatMode.TRACK ? interaction.translate("music/nowplaying:TRACK") : interaction.translate("common:DISABLED") ? interaction.translate("music/nowplaying:AUTOPLAY")
}\`\n${currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`}\n> ${interaction.translate("music/queue:ADDED")} ${currentTrack.requestedBy}\n\n**${interaction.translate("music/queue:NEXT")}**\n${interaction.translate("music/queue:NO_QUEUE")}`) : queue.repeatMode === QueueRepeatMode.QUEUE
? interaction.translate("music/nowplaying:QUEUE")
: queue.repeatMode === QueueRepeatMode.TRACK
? interaction.translate("music/nowplaying:TRACK")
: interaction.translate("common:DISABLED")
}\`\n${currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`}\n> ${interaction.translate("music/queue:ADDED")} ${
currentTrack.requestedBy
}\n\n**${interaction.translate("music/queue:NEXT")}**\n${interaction.translate("music/queue:NO_QUEUE")}`,
)
.setTimestamp(); .setTimestamp();
embeds.push(embed); embeds.push(embed);
@ -190,11 +181,19 @@ function generateQueueEmbeds(interaction, queue) {
.setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING")) .setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING"))
.setThumbnail(currentTrack.thumbnail) .setThumbnail(currentTrack.thumbnail)
.setColor(interaction.client.config.embed.color) .setColor(interaction.client.config.embed.color)
.setDescription(`${interaction.translate("music/nowplaying:REPEAT")}: \`${ .setDescription(
queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") : `${interaction.translate("music/nowplaying:REPEAT")}: \`${
queue.repeatMode === QueueRepeatMode.QUEUE ? interaction.translate("music/nowplaying:QUEUE") : queue.repeatMode === QueueRepeatMode.AUTOPLAY
queue.repeatMode === QueueRepeatMode.TRACK ? interaction.translate("music/nowplaying:TRACK") : interaction.translate("common:DISABLED") ? interaction.translate("music/nowplaying:AUTOPLAY")
}\`\n${currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`}\n> ${interaction.translate("music/queue:ADDED")} ${currentTrack.requestedBy}\n\n**${interaction.translate("music/queue:NEXT")}**\n${info}`) : queue.repeatMode === QueueRepeatMode.QUEUE
? interaction.translate("music/nowplaying:QUEUE")
: queue.repeatMode === QueueRepeatMode.TRACK
? interaction.translate("music/nowplaying:TRACK")
: interaction.translate("common:DISABLED")
}\`\n${currentTrack.url.startsWith("./clips") ? `${currentTrack.title} (clips)` : `[${currentTrack.title}](${currentTrack.url})`}\n> ${interaction.translate("music/queue:ADDED")} ${
currentTrack.requestedBy
}\n\n**${interaction.translate("music/queue:NEXT")}**\n${info}`,
)
.setTimestamp(); .setTimestamp();
embeds.push(embed); embeds.push(embed);
} }

View file

@ -12,16 +12,19 @@ class Seek extends BaseCommand {
.setName("seek") .setName("seek")
.setDescription(client.translate("music/seek:DESCRIPTION")) .setDescription(client.translate("music/seek:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/seek:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/seek:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/seek:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/seek:DESCRIPTION", null, "ru-RU"),
}) })
.addIntegerOption(option => option.setName("time") .addIntegerOption(option =>
option
.setName("time")
.setDescription(client.translate("music/seek:TIME")) .setDescription(client.translate("music/seek:TIME"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/seek:TIME", null, "uk-UA"), uk: client.translate("music/seek:TIME", null, "uk-UA"),
"ru": client.translate("music/seek:TIME", null, "ru-RU"), ru: client.translate("music/seek:TIME", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,8 +12,8 @@ class Shuffle extends BaseCommand {
.setName("shuffle") .setName("shuffle")
.setDescription(client.translate("music/shuffle:DESCRIPTION")) .setDescription(client.translate("music/shuffle:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/shuffle:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/shuffle:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/shuffle:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/shuffle:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],

View file

@ -12,8 +12,8 @@ class Skip extends BaseCommand {
.setName("skip") .setName("skip")
.setDescription(client.translate("music/skip:DESCRIPTION")) .setDescription(client.translate("music/skip:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/skip:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/skip:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/skip:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/skip:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],

View file

@ -12,17 +12,20 @@ class Skipto extends BaseCommand {
.setName("skipto") .setName("skipto")
.setDescription(client.translate("music/skipto:DESCRIPTION")) .setDescription(client.translate("music/skipto:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/skipto:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/skipto:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/skipto:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/skipto:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addIntegerOption(option => option.setName("position") .addIntegerOption(option =>
option
.setName("position")
.setDescription(client.translate("music/skipto:POSITION")) .setDescription(client.translate("music/skipto:POSITION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/skipto:POSITION", null, "uk-UA"), uk: client.translate("music/skipto:POSITION", null, "uk-UA"),
"ru": client.translate("music/skipto:POSITION", null, "ru-RU"), ru: client.translate("music/skipto:POSITION", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,8 +12,8 @@ class Stop extends BaseCommand {
.setName("stop") .setName("stop")
.setDescription(client.translate("music/stop:DESCRIPTION")) .setDescription(client.translate("music/stop:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/stop:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/stop:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/stop:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/stop:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],

View file

@ -12,18 +12,21 @@ class Volume extends BaseCommand {
.setName("volume") .setName("volume")
.setDescription(client.translate("music/volume:DESCRIPTION")) .setDescription(client.translate("music/volume:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("music/volume:DESCRIPTION", null, "uk-UA"), uk: client.translate("music/volume:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/volume:DESCRIPTION", null, "ru-RU"), ru: client.translate("music/volume:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addIntegerOption(option => option.setName("int") .addIntegerOption(option =>
option
.setName("int")
.setDescription(client.translate("common:INT")) .setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:INT", null, "uk-UA"), uk: client.translate("common:INT", null, "uk-UA"),
"ru": client.translate("common:INT", null, "ru-RU"), ru: client.translate("common:INT", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setAutocomplete(true)), .setAutocomplete(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -72,8 +75,8 @@ class Volume extends BaseCommand {
results.slice(0, 25).map(i => ({ results.slice(0, 25).map(i => ({
name: i, name: i,
value: i, value: i,
}), })),
)); );
} }
} }

View file

@ -13,8 +13,8 @@ class NSFW extends BaseCommand {
.setName("nsfw") .setName("nsfw")
.setDescription(client.translate("nsfw/nsfw:DESCRIPTION")) .setDescription(client.translate("nsfw/nsfw:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("nsfw/nsfw:DESCRIPTION", null, "uk-UA"), uk: client.translate("nsfw/nsfw:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("nsfw/nsfw:DESCRIPTION", null, "ru-RU"), ru: client.translate("nsfw/nsfw:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
@ -41,19 +41,15 @@ class NSFW extends BaseCommand {
if (interaction.guildId && !interaction.channel.nsfw) return interaction.replyT("misc:NSFW_COMMAND", null, { edit: true }); if (interaction.guildId && !interaction.channel.nsfw) return interaction.replyT("misc:NSFW_COMMAND", null, { edit: true });
const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag => const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag =>
JSON.parse(JSON.stringify({ JSON.parse(
JSON.stringify({
label: tag, label: tag,
value: tag, value: tag,
})), }),
),
); );
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(new StringSelectMenuBuilder().setCustomId("nsfw_select").setPlaceholder(client.translate("common:NOTHING_SELECTED")).addOptions(tags));
.addComponents(
new StringSelectMenuBuilder()
.setCustomId("nsfw_select")
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
.addOptions(tags),
);
const msg = await interaction.editReply({ const msg = await interaction.editReply({
content: interaction.translate("common:AVAILABLE_OPTIONS"), content: interaction.translate("common:AVAILABLE_OPTIONS"),
@ -63,7 +59,7 @@ class NSFW extends BaseCommand {
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
const collector = msg.createMessageComponentCollector({ filter, idle: (2 * 60 * 1000) }); const collector = msg.createMessageComponentCollector({ filter, idle: 2 * 60 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isStringSelectMenu() && i.customId === "nsfw_select") { if (i.isStringSelectMenu() && i.customId === "nsfw_select") {

View file

@ -12,21 +12,25 @@ class Debug extends BaseCommand {
.setName("debug") .setName("debug")
.setDescription(client.translate("owner/debug:DESCRIPTION")) .setDescription(client.translate("owner/debug:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/debug:DESCRIPTION", null, "uk-UA"), uk: client.translate("owner/debug:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("owner/debug:DESCRIPTION", null, "ru-RU"), ru: client.translate("owner/debug:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addSubcommand(subcommand => subcommand.setName("set") .addSubcommand(subcommand =>
subcommand
.setName("set")
.setDescription(client.translate("owner/debug:SET")) .setDescription(client.translate("owner/debug:SET"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/debug:SET", null, "uk-UA"), uk: client.translate("owner/debug:SET", null, "uk-UA"),
"ru": client.translate("owner/debug:SET", null, "ru-RU"), ru: client.translate("owner/debug:SET", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("type") .addStringOption(option =>
option
.setName("type")
.setDescription(client.translate("owner/debug:TYPE")) .setDescription(client.translate("owner/debug:TYPE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/debug:TYPE", null, "uk-UA"), uk: client.translate("owner/debug:TYPE", null, "uk-UA"),
"ru": client.translate("owner/debug:TYPE", null, "ru-RU"), ru: client.translate("owner/debug:TYPE", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setChoices( .setChoices(
@ -35,33 +39,44 @@ class Debug extends BaseCommand {
{ name: client.translate("common:CREDITS"), value: "credits" }, { name: client.translate("common:CREDITS"), value: "credits" },
{ name: client.translate("economy/transactions:BANK"), value: "bank" }, { name: client.translate("economy/transactions:BANK"), value: "bank" },
{ name: client.translate("common:REP"), value: "rep" }, { name: client.translate("common:REP"), value: "rep" },
)) ),
.addUserOption(option => option.setName("user") )
.addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addIntegerOption(option => option.setName("int") )
.addIntegerOption(option =>
option
.setName("int")
.setDescription(client.translate("common:INT")) .setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:INT", null, "uk-UA"), uk: client.translate("common:INT", null, "uk-UA"),
"ru": client.translate("common:INT", null, "ru-RU"), ru: client.translate("common:INT", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("add") .addSubcommand(subcommand =>
subcommand
.setName("add")
.setDescription(client.translate("owner/debug:ADD")) .setDescription(client.translate("owner/debug:ADD"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/debug:ADD", null, "uk-UA"), uk: client.translate("owner/debug:ADD", null, "uk-UA"),
"ru": client.translate("owner/debug:ADD", null, "ru-RU"), ru: client.translate("owner/debug:ADD", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("type") .addStringOption(option =>
option
.setName("type")
.setDescription(client.translate("owner/debug:TYPE")) .setDescription(client.translate("owner/debug:TYPE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/debug:TYPE", null, "uk-UA"), uk: client.translate("owner/debug:TYPE", null, "uk-UA"),
"ru": client.translate("owner/debug:TYPE", null, "ru-RU"), ru: client.translate("owner/debug:TYPE", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setChoices( .setChoices(
@ -70,21 +85,28 @@ class Debug extends BaseCommand {
{ name: client.translate("common:CREDITS"), value: "credits" }, { name: client.translate("common:CREDITS"), value: "credits" },
{ name: client.translate("economy/transactions:BANK"), value: "bank" }, { name: client.translate("economy/transactions:BANK"), value: "bank" },
{ name: client.translate("common:REP"), value: "rep" }, { name: client.translate("common:REP"), value: "rep" },
)) ),
.addUserOption(option => option.setName("user") )
.addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"), uk: client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"), ru: client.translate("common:USER", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addIntegerOption(option => option.setName("int") )
.addIntegerOption(option =>
option
.setName("int")
.setDescription(client.translate("common:INT")) .setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:INT", null, "uk-UA"), uk: client.translate("common:INT", null, "uk-UA"),
"ru": client.translate("common:INT", null, "ru-RU"), ru: client.translate("common:INT", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
@ -122,7 +144,6 @@ class Debug extends BaseCommand {
guildId: interaction.guildId, guildId: interaction.guildId,
}); });
switch (type) { switch (type) {
case "level": { case "level": {
memberData.level = int; memberData.level = int;

View file

@ -12,17 +12,20 @@ class Eval extends BaseCommand {
.setName("eval") .setName("eval")
.setDescription(client.translate("owner/eval:DESCRIPTION")) .setDescription(client.translate("owner/eval:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/eval:DESCRIPTION", null, "uk-UA"), uk: client.translate("owner/eval:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("owner/eval:DESCRIPTION", null, "ru-RU"), ru: client.translate("owner/eval:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("code") .addStringOption(option =>
option
.setName("code")
.setDescription(client.translate("owner/eval:CODE")) .setDescription(client.translate("owner/eval:CODE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/eval:CODE", null, "uk-UA"), uk: client.translate("owner/eval:CODE", null, "uk-UA"),
"ru": client.translate("owner/eval:CODE", null, "ru-RU"), ru: client.translate("owner/eval:CODE", null, "ru-RU"),
}) })
.setRequired(true)), .setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true, ownerOnly: true,
@ -48,14 +51,16 @@ class Eval extends BaseCommand {
const code = interaction.options.getString("code"); const code = interaction.options.getString("code");
const result = new Promise(resolve => resolve(eval(code))); const result = new Promise(resolve => resolve(eval(code)));
return result.then(output => { return result
.then(output => {
if (typeof output !== "string") output = require("util").inspect(output); if (typeof output !== "string") output = require("util").inspect(output);
if (output.includes(client.token)) output = output.replace(client.token, "T0K3N"); if (output.includes(client.token)) output = output.replace(client.token, "T0K3N");
interaction.editReply({ interaction.editReply({
content: "```js\n" + output + "```", content: "```js\n" + output + "```",
}); });
}).catch(err => { })
.catch(err => {
console.log(err); console.log(err);
err = err.toString(); err = err.toString();
if (err.includes(client.token)) err = err.replace(client.token, "T0K3N"); if (err.includes(client.token)) err = err.replace(client.token, "T0K3N");

View file

@ -1,7 +1,7 @@
const { SlashCommandBuilder } = require("discord.js"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"), const BaseCommand = require("../../base/BaseCommand"),
i18next = require("i18next"); i18next = require("i18next");
// autoUpdateDocs = require("../../helpers/autoUpdateDocs"); // autoUpdateDocs = require("../../helpers/autoUpdateDocs");
class Reload extends BaseCommand { class Reload extends BaseCommand {
/** /**
@ -14,18 +14,21 @@ class Reload extends BaseCommand {
.setName("reload") .setName("reload")
.setDescription(client.translate("owner/reload:DESCRIPTION")) .setDescription(client.translate("owner/reload:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/reload:DESCRIPTION", null, "uk-UA"), uk: client.translate("owner/reload:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("owner/reload:DESCRIPTION", null, "ru-RU"), ru: client.translate("owner/reload:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addStringOption(option => option.setName("command") .addStringOption(option =>
option
.setName("command")
.setDescription(client.translate("common:COMMAND")) .setDescription(client.translate("common:COMMAND"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:COMMAND", null, "uk-UA"), uk: client.translate("common:COMMAND", null, "uk-UA"),
"ru": client.translate("common:COMMAND", null, "ru-RU"), ru: client.translate("common:COMMAND", null, "ru-RU"),
}) })
.setRequired(true) .setRequired(true)
.setAutocomplete(true)), .setAutocomplete(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true, ownerOnly: true,
@ -71,11 +74,14 @@ class Reload extends BaseCommand {
results = client.commands.filter(c => c.command.name.includes(command)); results = client.commands.filter(c => c.command.name.includes(command));
return interaction.respond( return interaction.respond(
results.map(c => c).slice(0, 25).map(c => ({ results
.map(c => c)
.slice(0, 25)
.map(c => ({
name: c.command.name, name: c.command.name,
value: c.command.name, value: c.command.name,
}), })),
)); );
} }
} }

View file

@ -12,23 +12,38 @@ class Say extends BaseCommand {
.setName("say") .setName("say")
.setDescription(client.translate("owner/say:DESCRIPTION")) .setDescription(client.translate("owner/say:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/say:DESCRIPTION", null, "uk-UA"), uk: client.translate("owner/say:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("owner/say:DESCRIPTION", null, "ru-RU"), ru: client.translate("owner/say:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(false) .setDMPermission(false)
.addStringOption(option => option.setName("message") .addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("common:MESSAGE")) .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("common:MESSAGE", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("common:MESSAGE", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addChannelOption(option => option.setName("channel") )
.addChannelOption(option =>
option
.setName("channel")
.setDescription(client.translate("common:CHANNEL")) .setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:CHANNEL", null, "uk-UA"), uk: client.translate("common:CHANNEL", null, "uk-UA"),
"ru": client.translate("common:CHANNEL", null, "ru-RU"), ru: client.translate("common:CHANNEL", null, "ru-RU"),
})), }),
)
.addAttachmentOption(option =>
option
.setName("attachment")
.setDescription(client.translate("common:ATTACHMENT"))
.setDescriptionLocalizations({
uk: client.translate("common:ATTACHMENT", null, "uk-UA"),
ru: client.translate("common:ATTACHMENT", null, "ru-RU"),
}),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true, ownerOnly: true,
@ -51,6 +66,7 @@ class Say extends BaseCommand {
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const message = interaction.options.getString("message"), const message = interaction.options.getString("message"),
attachment = interaction.options.getAttachment("attachment"),
channel = interaction.options.getChannel("channel"); channel = interaction.options.getChannel("channel");
if (!channel) { if (!channel) {
@ -59,6 +75,10 @@ class Say extends BaseCommand {
setTimeout(function () { setTimeout(function () {
interaction.channel.send({ interaction.channel.send({
content: message, content: message,
files: attachment ? [{
name: attachment.name,
attachment: attachment.url,
}] : null,
}); });
interaction.replyT("owner/say:DONE", { interaction.replyT("owner/say:DONE", {
@ -72,6 +92,10 @@ class Say extends BaseCommand {
setTimeout(function () { setTimeout(function () {
channel.send({ channel.send({
content: message, content: message,
files: attachment ? [{
name: attachment.name,
attachment: attachment.url,
}] : null,
}); });
interaction.replyT("owner/say:DONE", { interaction.replyT("owner/say:DONE", {

View file

@ -12,8 +12,8 @@ class Servers extends BaseCommand {
.setName("servers") .setName("servers")
.setDescription(client.translate("owner/servers:DESCRIPTION")) .setDescription(client.translate("owner/servers:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/servers:DESCRIPTION", null, "uk-UA"), uk: client.translate("owner/servers:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("owner/servers:DESCRIPTION", null, "ru-RU"), ru: client.translate("owner/servers:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
@ -40,20 +40,10 @@ class Servers extends BaseCommand {
let currentPage = 0; let currentPage = 0;
const embeds = generateServersEmbeds(interaction, client.guilds.cache); const embeds = generateServersEmbeds(interaction, client.guilds.cache);
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(
.addComponents( new ButtonBuilder().setCustomId("servers_prev_page").setStyle(ButtonStyle.Primary).setEmoji("⬅️"),
new ButtonBuilder() new ButtonBuilder().setCustomId("servers_next_page").setStyle(ButtonStyle.Primary).setEmoji("➡️"),
.setCustomId("servers_prev_page") new ButtonBuilder().setCustomId("servers_stop").setStyle(ButtonStyle.Danger).setEmoji("⏹️"),
.setStyle(ButtonStyle.Primary)
.setEmoji("⬅️"),
new ButtonBuilder()
.setCustomId("servers_next_page")
.setStyle(ButtonStyle.Primary)
.setEmoji("➡️"),
new ButtonBuilder()
.setCustomId("servers_stop")
.setStyle(ButtonStyle.Danger)
.setEmoji("⏹️"),
); );
await interaction.editReply({ await interaction.editReply({
@ -63,7 +53,7 @@ class Servers extends BaseCommand {
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
const collector = interaction.guild === null ? (await interaction.user.createDM()).createMessageComponentCollector({ filter, idle: (20 * 1000) }) : interaction.channel.createMessageComponentCollector({ filter, idle: (20 * 1000) }); const collector = interaction.guild === null ? (await interaction.user.createDM()).createMessageComponentCollector({ filter, idle: 20 * 1000 }) : interaction.channel.createMessageComponentCollector({ filter, idle: 20 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isButton()) { if (i.isButton()) {
@ -119,11 +109,24 @@ function generateServersEmbeds(interaction, servers) {
let k = 10; let k = 10;
for (let i = 0; i < servers.size; i += 10) { for (let i = 0; i < servers.size; i += 10) {
const current = servers.sort((a, b) => b.memberCount - a.memberCount).map(g => g).slice(i, k); const current = servers
.sort((a, b) => b.memberCount - a.memberCount)
.map(g => g)
.slice(i, k);
let j = i; let j = i;
k += 10; k += 10;
const info = current.map(server => `${++j}. ${server.name} | ${server.memberCount} ${interaction.client.functions.getNoun(server.memberCount, interaction.translate("misc:NOUNS:MEMBERS:1"), interaction.translate("misc:NOUNS:MEMBERS:2"), interaction.translate("misc:NOUNS:MEMBERS:5"))}`).join("\n"); const info = current
.map(
server =>
`${++j}. ${server.name} | ${server.memberCount} ${interaction.client.functions.getNoun(
server.memberCount,
interaction.translate("misc:NOUNS:MEMBERS:1"),
interaction.translate("misc:NOUNS:MEMBERS:2"),
interaction.translate("misc:NOUNS:MEMBERS:5"),
)}`,
)
.join("\n");
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(interaction.client.config.embed.color) .setColor(interaction.client.config.embed.color)

View file

@ -12,56 +12,75 @@ class Sendmessage extends BaseCommand {
.setName("sendmessage") .setName("sendmessage")
.setDescription(client.translate("suncountry/sendmessage:DESCRIPTION")) .setDescription(client.translate("suncountry/sendmessage:DESCRIPTION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("suncountry/sendmessage:DESCRIPTION", null, "uk-UA"), uk: client.translate("suncountry/sendmessage:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("suncountry/sendmessage:DESCRIPTION", null, "ru-RU"), ru: client.translate("suncountry/sendmessage:DESCRIPTION", null, "ru-RU"),
}) })
.setDMPermission(true) .setDMPermission(true)
.addSubcommand(subcommand => subcommand.setName("rpinfo") .addSubcommand(subcommand =>
subcommand
.setName("rpinfo")
.setDescription(client.translate("suncountry/sendmessage:RPINFO")) .setDescription(client.translate("suncountry/sendmessage:RPINFO"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("suncountry/sendmessage:RPINFO", null, "uk-UA"), uk: client.translate("suncountry/sendmessage:RPINFO", null, "uk-UA"),
"ru": client.translate("suncountry/sendmessage:RPINFO", null, "ru-RU"), ru: client.translate("suncountry/sendmessage:RPINFO", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("text") .addStringOption(option =>
option
.setName("text")
.setDescription(client.translate("common:MESSAGE")) .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("common:MESSAGE", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("common:MESSAGE", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addAttachmentOption(option => option.setName("attachment") )
.addAttachmentOption(option =>
option
.setName("attachment")
.setDescription(client.translate("common:ATTACHMENT")) .setDescription(client.translate("common:ATTACHMENT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:ATTACHMENT", null, "uk-UA"), uk: client.translate("common:ATTACHMENT", null, "uk-UA"),
"ru": client.translate("common:ATTACHMENT", null, "ru-RU"), ru: client.translate("common:ATTACHMENT", null, "ru-RU"),
})), }),
),
) )
.addSubcommand(subcommand => subcommand.setName("instalife") .addSubcommand(subcommand =>
subcommand
.setName("instalife")
.setDescription(client.translate("suncountry/sendmessage:INSTALIFE")) .setDescription(client.translate("suncountry/sendmessage:INSTALIFE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("suncountry/sendmessage:INSTALIFE", null, "uk-UA"), uk: client.translate("suncountry/sendmessage:INSTALIFE", null, "uk-UA"),
"ru": client.translate("suncountry/sendmessage:INSTALIFE", null, "ru-RU"), ru: client.translate("suncountry/sendmessage:INSTALIFE", null, "ru-RU"),
}) })
.addStringOption(option => option.setName("name") .addStringOption(option =>
option
.setName("name")
.setDescription(client.translate("common:USERNAME")) .setDescription(client.translate("common:USERNAME"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USERNAME", null, "uk-UA"), uk: client.translate("common:USERNAME", null, "uk-UA"),
"ru": client.translate("common:USERNAME", null, "ru-RU"), ru: client.translate("common:USERNAME", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addStringOption(option => option.setName("text") )
.addStringOption(option =>
option
.setName("text")
.setDescription(client.translate("common:MESSAGE")) .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("common:MESSAGE", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("common:MESSAGE", null, "ru-RU"),
}) })
.setRequired(true)) .setRequired(true),
.addAttachmentOption(option => option.setName("attachment") )
.addAttachmentOption(option =>
option
.setName("attachment")
.setDescription(client.translate("common:ATTACHMENT")) .setDescription(client.translate("common:ATTACHMENT"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:ATTACHMENT", null, "uk-UA"), uk: client.translate("common:ATTACHMENT", null, "uk-UA"),
"ru": client.translate("common:ATTACHMENT", null, "ru-RU"), ru: client.translate("common:ATTACHMENT", null, "ru-RU"),
})), }),
),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
@ -101,14 +120,18 @@ class Sendmessage extends BaseCommand {
.setImage(attachment ? attachment.url : null) .setImage(attachment ? attachment.url : null)
.setDescription(text); .setDescription(text);
channel.send({ const content = command === "rpinfo" ? text : null,
content: command === "rpinfo" ? text : null, files = command === "rpinfo" ? (attachment ? [{
files: command === "rpinfo" ? (attachment ? [{
name: attachment.name, name: attachment.name,
attachment: attachment.url, attachment: attachment.url,
}] : null) : null, }] : null) : null,
embeds: command === "instalife" ? [embed] : null, embeds = command === "instalife" ? [embed] : null;
}).then(message => {
channel.send({
content,
files,
embeds,
}) .then(message => {
interaction.success("suncountry/sendmessage:MESSAGE_SENT", { interaction.success("suncountry/sendmessage:MESSAGE_SENT", {
message: message.url, message: message.url,
}, { edit: true }); }, { edit: true });

View file

@ -2,7 +2,7 @@ module.exports = {
/* The token of your Discord Bot */ /* The token of your Discord Bot */
token: "XXXXXXXXXXX", token: "XXXXXXXXXXX",
/* ID of Bot's user */ /* ID of Bot's user */
user: "XXXXXXXXXXX", userId: "XXXXXXXXXXX",
/* Set to true for production */ /* Set to true for production */
production: true, production: true,
/* For the support server */ /* For the support server */

@ -1 +1 @@
Subproject commit b9ef79e4bfd01e89ed8b5eb0a083ff2d759bce23 Subproject commit f18f32bc4d4dbb066c8ec24d6f6a648b51a92ddf

View file

@ -41,7 +41,7 @@ module.exports.load = async client => {
const Dashboard = new DBD.Dashboard({ const Dashboard = new DBD.Dashboard({
port: client.config.dashboard.port, port: client.config.dashboard.port,
client: { client: {
id: client.config.user, id: client.config.userId,
secret: client.config.dashboard.secret, secret: client.config.dashboard.secret,
}, },
SSL: { SSL: {
@ -57,7 +57,7 @@ module.exports.load = async client => {
requiredPermissions: PermissionsBitField.Flags.ViewChannel, requiredPermissions: PermissionsBitField.Flags.ViewChannel,
minimizedConsoleLogs: true, minimizedConsoleLogs: true,
invite: { invite: {
clientId: client.config.user, clientId: client.config.userId,
scopes: ["bot", "applications.commands"], scopes: ["bot", "applications.commands"],
permissions: "8", permissions: "8",
redirectUri: `${client.config.dashboard.domain}${client.config.dashboard.port !== 80 ? `:${client.config.dashboard.port}` : ""}`, redirectUri: `${client.config.dashboard.domain}${client.config.dashboard.port !== 80 ? `:${client.config.dashboard.port}` : ""}`,

View file

@ -40,10 +40,12 @@ class CommandHandler extends BaseEvent {
if (!userData.achievements.firstCommand.achieved) { if (!userData.achievements.firstCommand.achieved) {
const args = { const args = {
content: interaction.user.toString(), content: interaction.user.toString(),
files: [{ files: [
{
name: "achievement_unlocked2.png", name: "achievement_unlocked2.png",
attachment: "./assets/img/achievements/achievement_unlocked2.png", attachment: "./assets/img/achievements/achievement_unlocked2.png",
}], },
],
}; };
userData.achievements.firstCommand.progress.now = 1; userData.achievements.firstCommand.progress.now = 1;
@ -54,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.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");
return command.execute(client, interaction, data); return command.execute(client, interaction, data);
} }

View file

@ -15,9 +15,7 @@ class GuildCreate extends BaseEvent {
* @param {import("discord.js").Guild} guild * @param {import("discord.js").Guild} guild
*/ */
async execute(client, guild) { async execute(client, guild) {
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({ id: guild.ownerId });
id: guild.ownerId,
});
if (!userData.achievements.invite.achieved) { if (!userData.achievements.invite.achieved) {
userData.achievements.invite.progress.now = 1; userData.achievements.invite.progress.now = 1;
@ -39,10 +37,12 @@ class GuildCreate extends BaseEvent {
const owner = await guild.fetchOwner(); const owner = await guild.fetchOwner();
owner.send({ owner.send({
files: [{ files: [
{
name: "unlocked.png", name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked7.png", attachment: "./assets/img/achievements/achievement_unlocked7.png",
}], },
],
embeds: [thanks], embeds: [thanks],
}); });

View file

@ -79,13 +79,23 @@ class GuildMemberAdd extends BaseEvent {
ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250); ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250);
// Draw server name // Draw server name
ctx.font = applyText(canvas, client.translate("administration/welcome:IMG_WELCOME", { ctx.font = applyText(
canvas,
client.translate("administration/welcome:IMG_WELCOME", {
server: member.guild.name, server: member.guild.name,
}, guildData.language), 53, 625, "RubikMonoOne"); }, guildData.language),
53,
625,
"RubikMonoOne",
);
ctx.fillText(client.translate("administration/welcome:IMG_WELCOME", { ctx.fillText(
client.translate("administration/welcome:IMG_WELCOME", {
server: member.guild.name, server: member.guild.name,
}, guildData.language), canvas.width - 700, canvas.height - 70); }, guildData.language),
canvas.width - 700,
canvas.height - 70,
);
// Draw discriminator // Draw discriminator
ctx.font = "35px RubikMonoOne"; ctx.font = "35px RubikMonoOne";
@ -117,9 +127,11 @@ class GuildMemberAdd extends BaseEvent {
ctx.closePath(); ctx.closePath();
ctx.clip(); ctx.clip();
const avatar = await Canvas.loadImage(member.displayAvatarURL({ const avatar = await Canvas.loadImage(
member.displayAvatarURL({
extension: "jpg", extension: "jpg",
})); }),
);
ctx.drawImage(avatar, 45, 90, 270, 270); ctx.drawImage(avatar, 45, 90, 270, 270);
const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "welcome-image.png" }); const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "welcome-image.png" });
@ -128,8 +140,7 @@ class GuildMemberAdd extends BaseEvent {
content: message, content: message,
files: [attachment], files: [attachment],
}); });
} else } else channel.send({ content: message });
channel.send({ content: message });
} }
} }
} }

View file

@ -77,13 +77,23 @@ class GuildMemberRemove extends BaseEvent {
ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250); ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250);
// Draw server name // Draw server name
ctx.font = applyText(canvas, client.translate("administration/goodbye:IMG_GOODBYE", { ctx.font = applyText(
canvas,
client.translate("administration/goodbye:IMG_GOODBYE", {
server: member.guild.name, server: member.guild.name,
}, guildData.language), 53, 625, "RubikMonoOne"); }, guildData.language),
53,
625,
"RubikMonoOne",
);
ctx.fillText(client.translate("administration/goodbye:IMG_GOODBYE", { ctx.fillText(
client.translate("administration/goodbye:IMG_GOODBYE", {
server: member.guild.name, server: member.guild.name,
}, guildData.language), canvas.width - 700, canvas.height - 70); }, guildData.language),
canvas.width - 700,
canvas.height - 70,
);
// Draw discriminator // Draw discriminator
ctx.font = "35px RubikMonoOne"; ctx.font = "35px RubikMonoOne";
@ -91,7 +101,11 @@ class GuildMemberRemove extends BaseEvent {
// Draw membercount // Draw membercount
ctx.font = "22px RubikMonoOne"; ctx.font = "22px RubikMonoOne";
ctx.fillText(`${member.guild.memberCount} ${client.functions.getNoun(member.guild.memberCount, client.translate("misc:NOUNS:MEMBERS:1", null, guildData.language), client.translate("misc:NOUNS:MEMBERS:2", null, guildData.language), client.translate("misc:NOUNS:MEMBERS:5", null, guildData.language))}`, 40, canvas.height - 35); ctx.fillText(
`${member.guild.memberCount} ${client.functions.getNoun(member.guild.memberCount, client.translate("misc:NOUNS:MEMBERS:1", null, guildData.language), client.translate("misc:NOUNS:MEMBERS:2", null, guildData.language), client.translate("misc:NOUNS:MEMBERS:5", null, guildData.language))}`,
40,
canvas.height - 35,
);
// Draw # for discriminator // Draw # for discriminator
ctx.fillStyle = "#FFFFFF"; ctx.fillStyle = "#FFFFFF";
@ -115,10 +129,12 @@ class GuildMemberRemove extends BaseEvent {
ctx.closePath(); ctx.closePath();
ctx.clip(); ctx.clip();
const avatar = await Canvas.loadImage(member.displayAvatarURL({ const avatar = await Canvas.loadImage(
member.displayAvatarURL({
extension: "png", extension: "png",
size: 512, size: 512,
})); }),
);
ctx.drawImage(avatar, 45, 90, 270, 270); ctx.drawImage(avatar, 45, 90, 270, 270);
const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "goodbye-image.png" }); const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "goodbye-image.png" });
@ -127,8 +143,7 @@ class GuildMemberRemove extends BaseEvent {
content: message, content: message,
files: [attachment], files: [attachment],
}); });
} else } else channel.send({ content: message });
channel.send({ content: message });
} }
} }
} }

View file

@ -20,9 +20,7 @@ class GuildMemberUpdate extends BaseEvent {
if (oldMember.roles.cache.some(r => r.id === "940149470975365191")) return; if (oldMember.roles.cache.some(r => r.id === "940149470975365191")) return;
if (newMember?.roles.cache.some(r => r.id === "940149470975365191")) { if (newMember?.roles.cache.some(r => r.id === "940149470975365191")) {
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({ id: newMember.id });
id: newMember.id,
});
userData.achievements.tip.progress.now = 1; userData.achievements.tip.progress.now = 1;
userData.achievements.tip.achieved = true; userData.achievements.tip.achieved = true;
@ -30,10 +28,12 @@ class GuildMemberUpdate extends BaseEvent {
await userData.save(); await userData.save();
newMember.send({ newMember.send({
files: [{ files: [
{
name: "achievement_unlocked5.png", name: "achievement_unlocked5.png",
attachment: "./assets/img/achievements/achievement_unlocked5.png", attachment: "./assets/img/achievements/achievement_unlocked5.png",
}], },
],
}); });
} }
} }

View file

@ -58,9 +58,14 @@ class MessageCreate extends BaseEvent {
.addFields([ .addFields([
{ {
name: message.translate("misc:QUOTE_ATTACHED"), name: message.translate("misc:QUOTE_ATTACHED"),
value: msg.attachments.size > 0 ? msg.attachments.map(a => { value:
msg.attachments.size > 0
? msg.attachments
.map(a => {
return `[${a.name}](${a.url})`; return `[${a.name}](${a.url})`;
}).join("\n") : `*${message.translate("common:MISSING")}*`, })
.join("\n")
: `*${message.translate("common:MISSING")}*`,
}, },
]) ])
.setFooter({ .setFooter({
@ -69,16 +74,9 @@ class MessageCreate extends BaseEvent {
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setTimestamp(msg.createdTimestamp); .setTimestamp(msg.createdTimestamp);
const row = new ActionRowBuilder() const row = new ActionRowBuilder().addComponents(
.addComponents( new ButtonBuilder().setLabel(message.translate("misc:QUOTE_JUMP")).setStyle(ButtonStyle.Link).setURL(msg.url),
new ButtonBuilder() new ButtonBuilder().setCustomId("quote_delete").setEmoji("1102200816582000750").setStyle(ButtonStyle.Danger),
.setLabel(message.translate("misc:QUOTE_JUMP"))
.setStyle(ButtonStyle.Link)
.setURL(msg.url),
new ButtonBuilder()
.setCustomId("quote_delete")
.setEmoji("1102200816582000750")
.setStyle(ButtonStyle.Danger),
); );
const reply = await message.reply({ const reply = await message.reply({
@ -87,18 +85,17 @@ class MessageCreate extends BaseEvent {
}); });
const filter = i => i.user.id === message.author.id; const filter = i => i.user.id === message.author.id;
const collector = message.channel.createMessageComponentCollector({ filter, time: (60 * 1000) }); const collector = message.channel.createMessageComponentCollector({ filter, time: 60 * 1000 });
collector.on("collect", async i => { collector.on("collect", async i => {
if (i.isButton() && i.customId === "quote_delete") if (i.isButton() && i.customId === "quote_delete") if (reply.deletable) reply.delete();
if (reply.deletable) await reply.delete();
}); });
} }
if (data.guildData.plugins.automod.enabled && !data.guildData.plugins.automod.ignored.includes(message.channel.id)) if (data.guildData.plugins.automod.enabled && !data.guildData.plugins.automod.ignored.includes(message.channel.id))
if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content)) if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content))
if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ManageMessages)) { if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ManageMessages)) {
await message.error("administration/automod:DELETED"); await message.error("administration/automod:DELETED", null, { mention: true });
message.delete(); message.delete();
} }
@ -114,9 +111,7 @@ class MessageCreate extends BaseEvent {
} }
message.mentions.users.forEach(async u => { message.mentions.users.forEach(async u => {
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({ id: u.id });
id: u.id,
});
if (userData.afk) message.replyT("general/afk:IS_AFK", { user: u.getUsername(), reason: userData.afk }, { ephemeral: true }); if (userData.afk) message.replyT("general/afk:IS_AFK", { user: u.getUsername(), reason: userData.afk }, { ephemeral: true });
}); });
@ -138,10 +133,9 @@ async function updateXp(client, msg, memberData) {
level = parseInt(memberData.level), level = parseInt(memberData.level),
isInCooldown = xpCooldown[msg.author.id]; isInCooldown = xpCooldown[msg.author.id];
if (isInCooldown) if (isInCooldown) if (isInCooldown > Date.now()) return;
if (isInCooldown > Date.now()) return;
const toWait = Date.now() + (60 * 1000); // 1 min const toWait = Date.now() + 60 * 1000; // 1 min
xpCooldown[msg.author.id] = toWait; xpCooldown[msg.author.id] = toWait;
const won = client.functions.randomNum(1, 2); const won = client.functions.randomNum(1, 2);

View file

@ -38,7 +38,6 @@ class messageUpdate extends BaseEvent {
embeds: [embed], embeds: [embed],
}); });
} }
} }
} }

View file

@ -33,7 +33,7 @@ class Ready extends BaseEvent {
client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready"); client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready");
client.logger.log(`${client.user.getUsername()}, ready to serve ${tUsers} members in ${tServers} servers.`, "ready"); client.logger.log(`${client.user.getUsername()}, ready to serve ${tUsers} members in ${tServers} servers.`, "ready");
client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] })}`, "ready"); client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [PermissionsBitField.Flags.Administrator] })}`, "ready");
console.timeEnd("botReady"); console.timeEnd("botReady");

View file

@ -24,9 +24,7 @@ module.exports.update = function (client) {
// }) // })
categories.sort().forEach(cat => { categories.sort().forEach(cat => {
const categoriesArray = [ const categoriesArray = [["Название", "Описание", "Использование", "Разрешено использование"]];
["Название", "Описание", "Использование", "Разрешено использование"],
];
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()];
text += `### ${cat} (${cmds.length} ${client.functions.getNoun(cmds.length, "команда", "команды", "команд")})\n\n`; text += `### ${cat} (${cmds.length} ${client.functions.getNoun(cmds.length, "команда", "команды", "команд")})\n\n`;

View file

@ -13,15 +13,12 @@ module.exports.init = async function (client) {
currentYear = date.getFullYear(); currentYear = date.getFullYear();
client.guilds.cache.forEach(async guild => { client.guilds.cache.forEach(async guild => {
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({ id: guild.id });
id: guild.id,
});
if (guildData.plugins.birthdays) { if (guildData.plugins.birthdays) {
const channel = client.channels.cache.get(guildData.plugins.birthdays); const channel = client.channels.cache.get(guildData.plugins.birthdays);
if (channel) { if (channel) {
client.usersData.find({ birthdate: { $gt: 1 } }) client.usersData.find({ birthdate: { $gt: 1 } }).then(async users => {
.then(async users => {
for (const user of users) { for (const user of users) {
if (guild.members.cache.find(m => m.id === user.id)) { if (guild.members.cache.find(m => m.id === user.id)) {
const userDate = new Date(user.birthdate); const userDate = new Date(user.birthdate);
@ -34,10 +31,7 @@ module.exports.init = async function (client) {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: client.user.username, name: client.user.username,
iconURL: client.user.displayAvatarURL({ iconURL: client.user.displayAvatarURL(),
extension: "png",
size: 512,
}),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
@ -65,5 +59,9 @@ module.exports.init = async function (client) {
} }
} }
}); });
}, null, true, "Europe/Moscow"); },
null,
true,
"Europe/Moscow",
);
}; };

View file

@ -6,9 +6,7 @@ const moment = require("moment");
* @param {import("../base/JaBa")} client * @param {import("../base/JaBa")} client
*/ */
module.exports.init = function (client) { module.exports.init = function (client) {
client.usersData client.usersData.find({ reminds: { $gt: [] } }).then(users => {
.find({ reminds: { $gt: [] } })
.then(users => {
for (const user of users) { for (const user of users) {
if (!client.users.cache.has(user.id)) client.users.fetch(user.id); if (!client.users.cache.has(user.id)) client.users.fetch(user.id);
client.databaseCache.usersReminds.set(user.id, user); client.databaseCache.usersReminds.set(user.id, user);
@ -30,9 +28,11 @@ module.exports.init = function (client) {
.setAuthor({ .setAuthor({
name: client.translate("general/remindme:TITLE"), name: client.translate("general/remindme:TITLE"),
}) })
.setDescription(client.translate("general/remindme:CREATED", { .setDescription(
client.translate("general/remindme:CREATED", {
time: moment(r.createdAt).locale(client.defaultLanguage).format("dddd, Do MMMM YYYY, HH:mm:ss"), time: moment(r.createdAt).locale(client.defaultLanguage).format("dddd, Do MMMM YYYY, HH:mm:ss"),
})) }),
)
.addFields([ .addFields([
{ {
name: client.translate("common:MESSAGE"), name: client.translate("common:MESSAGE"),
@ -49,7 +49,7 @@ module.exports.init = function (client) {
}); });
user.reminds = user.reminds.filter(r => r.sendAt >= dateNow); user.reminds = user.reminds.filter(r => r.sendAt >= dateNow);
user.markModified("reminds"); user.markModified("reminds");
user.save(); await user.save();
if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id); if (user.reminds.length === 0) client.databaseCache.usersReminds.delete(user.id);
} }

View file

@ -20,7 +20,7 @@ function setDaysTimeout(callback, days) {
*/ */
module.exports.init = async function (client) { module.exports.init = async function (client) {
setDaysTimeout(async () => { setDaysTimeout(async () => {
const timestamp = Date.now() + (29 * 24 * 60 * 60 * 1000); // 29 days const timestamp = Date.now() + 29 * 24 * 60 * 60 * 1000; // 29 days
const members = client.membersData.find({ transactions: { $gt: [] } }); const members = client.membersData.find({ transactions: { $gt: [] } });
for (const member of members) { for (const member of members) {

View file

@ -18,7 +18,7 @@ module.exports = {
async createInvite(client, guildId) { async createInvite(client, guildId) {
const guild = client.guilds.cache.get(guildId); const guild = client.guilds.cache.get(guildId);
const member = guild.members.me; const member = guild.members.me;
const channel = guild.channels.cache.find(ch => ch.permissionsFor(member.id).has(PermissionsBitField.Flags.CreateInstantInvite) && ch.type === ChannelType.GuildText || ch.type === "GUILD_VOICE"); const 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"; if (channel) return (await channel.createInvite()).url || "No channels found or missing permissions";
}, },
@ -46,7 +46,7 @@ module.exports = {
return array.sort(function (a, b) { return array.sort(function (a, b) {
const x = a[key]; const x = a[key];
const y = b[key]; const y = b[key];
return ((x < y) ? 1 : ((x > y) ? -1 : 0)); return x < y ? 1 : x > y ? -1 : 0;
}); });
}, },
@ -59,7 +59,8 @@ module.exports = {
const array = []; const array = [];
pArray.forEach(element => array.push(element)); pArray.forEach(element => array.push(element));
let currentIndex = array.length, let currentIndex = array.length,
temporaryValue, randomIndex; temporaryValue,
randomIndex;
while (currentIndex !== 0) { while (currentIndex !== 0) {
randomIndex = Math.floor(Math.random() * currentIndex); randomIndex = Math.floor(Math.random() * currentIndex);
@ -82,7 +83,6 @@ module.exports = {
randomNum(min, max) { randomNum(min, max) {
min = Math.ceil(min); min = Math.ceil(min);
max = Math.floor(max); max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1) + min); return Math.floor(Math.random() * (max - min + 1) + min);
}, },
@ -97,10 +97,7 @@ module.exports = {
printDate(client, date, format = "", locale = client.defaultLanguage) { printDate(client, date, format = "", locale = client.defaultLanguage) {
const languageData = client.languages.find(language => language.name === locale); const languageData = client.languages.find(language => language.name === locale);
if (format === "" || format === null) format = languageData.defaultMomentFormat; if (format === "" || format === null) format = languageData.defaultMomentFormat;
return moment(new Date(date)).locale(languageData.moment).format(format);
return moment(new Date(date))
.locale(languageData.moment)
.format(format);
}, },
/** /**
@ -115,8 +112,7 @@ module.exports = {
convertTime(client, time, type = false, noPrefix = false, locale = this.defaultLanguage) { convertTime(client, time, type = false, noPrefix = false, locale = this.defaultLanguage) {
const languageData = client.languages.find(language => language.name === locale); const languageData = client.languages.find(language => language.name === locale);
const m = moment(time).locale(languageData.moment); const m = moment(time).locale(languageData.moment);
return type ? m.toNow(noPrefix) : m.fromNow(noPrefix);
return (type ? m.toNow(noPrefix) : m.fromNow(noPrefix));
}, },
/** /**

View file

@ -8,13 +8,21 @@ function dateTimePad(value, digits) {
} }
function format(tDate) { function format(tDate) {
return (dateTimePad((tDate.getDate()), 2) + "-" + return (
dateTimePad((tDate.getMonth() + 1), 2) + "-" + dateTimePad(tDate.getDate(), 2) +
dateTimePad(tDate.getFullYear(), 2) + " " + "-" +
dateTimePad(tDate.getHours(), 2) + ":" + dateTimePad(tDate.getMonth() + 1, 2) +
dateTimePad(tDate.getMinutes(), 2) + ":" + "-" +
dateTimePad(tDate.getSeconds(), 2) + "." + dateTimePad(tDate.getFullYear(), 2) +
dateTimePad(tDate.getMilliseconds(), 3)); " " +
dateTimePad(tDate.getHours(), 2) +
":" +
dateTimePad(tDate.getMinutes(), 2) +
":" +
dateTimePad(tDate.getSeconds(), 2) +
"." +
dateTimePad(tDate.getMilliseconds(), 3)
);
} }
module.exports = class Logger { module.exports = class Logger {

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