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,40 +9,43 @@ 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: {
welcome: { type: Object,
enabled: false, default: {
message: null, welcome: {
channel: null, enabled: false,
withImage: null, message: null,
channel: null,
withImage: null,
},
goodbye: {
enabled: false,
message: null,
channel: null,
withImage: null,
},
autorole: {
enabled: false,
role: null,
},
automod: {
enabled: false,
ignored: [],
},
warnsSanctions: {
kick: null,
ban: null,
},
monitoring: {
memberAdd: null,
memberLeave: null,
memberUpdate: null,
messageUpdate: null,
},
suggestions: null,
reports: null,
birthdays: null,
modlogs: null,
}, },
goodbye: { },
enabled: false,
message: null,
channel: null,
withImage: null,
},
autorole: {
enabled: false,
role: null,
},
automod: {
enabled: false,
ignored: [],
},
warnsSanctions: {
kick: null,
ban: null,
},
monitoring: {
memberAdd: null,
memberLeave: null,
memberUpdate: null,
messageUpdate: null,
},
suggestions: null,
reports: null,
birthdays: 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,14 +76,17 @@ class JaBa extends Client {
async init() { async init() {
this.login(this.config.token); this.login(this.config.token);
mongoose.connect(this.config.mongoDB, { mongoose
useNewUrlParser: true, .connect(this.config.mongoDB, {
useUnifiedTopology: true, useNewUrlParser: true,
}).then(() => { useUnifiedTopology: true,
this.logger.log("Connected to the Mongodb database.", "log"); })
}).catch(err => { .then(() => {
this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error"); this.logger.log("Connected to the Mongodb database.", "log");
}); })
.catch(err => {
this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error");
});
await this.player.extractors.loadDefault(); await this.player.extractors.loadDefault();
@ -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: {
work: 0, type: Object,
rob: 0, default: {
} }, work: 0,
rob: 0,
},
},
sanctions: { type: Array, default: [] }, sanctions: { type: Array, default: [] },
mute: { type: Object, default: { mute: {
muted: false, type: Object,
case: null, default: {
endDate: null, muted: false,
} }, case: 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,61 +19,67 @@ const userSchema = new mongoose.Schema({
registeredAt: { type: Number, default: Date.now() }, registeredAt: { type: Number, default: Date.now() },
achievements: { type: Object, default: { achievements: {
married: { type: Object,
achieved: false, default: {
progress: { married: {
now: 0, achieved: false,
total: 1, progress: {
now: 0,
total: 1,
},
},
work: {
achieved: false,
progress: {
now: 0,
total: 10,
},
},
firstCommand: {
achieved: false,
progress: {
now: 0,
total: 1,
},
},
slots: {
achieved: false,
progress: {
now: 0,
total: 3,
},
},
tip: {
achieved: false,
progress: {
now: 0,
total: 1,
},
},
rep: {
achieved: false,
progress: {
now: 0,
total: 20,
},
},
invite: {
achieved: false,
progress: {
now: 0,
total: 1,
},
}, },
}, },
work: { },
achieved: false,
progress: {
now: 0,
total: 10,
},
},
firstCommand: {
achieved: false,
progress: {
now: 0,
total: 1,
},
},
slots: {
achieved: false,
progress: {
now: 0,
total: 3,
},
},
tip: {
achieved: false,
progress: {
now: 0,
total: 1,
},
},
rep: {
achieved: false,
progress: {
now: 0,
total: 20,
},
},
invite: {
achieved: false,
progress: {
now: 0,
total: 1,
},
},
} },
cooldowns: { type: Object, default: { cooldowns: {
rep: 0, type: Object,
} }, default: {
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,19 +39,20 @@ 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(
label: tag, JSON.stringify({
value: tag, label: 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")) .addOptions(tags),
.addOptions(tags), );
);
const msg = await interaction.editReply({ const msg = await interaction.editReply({
content: interaction.translate("common:AVAILABLE_OPTIONS"), content: interaction.translate("common:AVAILABLE_OPTIONS"),
@ -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 =>
.setDescription(client.translate("common:STATE")) option
.setDescriptionLocalizations({ .setName("state")
"uk": client.translate("common:STATE", null, "uk-UA"), .setDescription(client.translate("common:STATE"))
"ru": client.translate("common:STATE", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:STATE", null, "uk-UA"),
.setRequired(true)) ru: client.translate("common:STATE", null, "ru-RU"),
.addChannelOption(option => option.setName("channel") })
.setDescription(client.translate("common:CHANNEL")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("common:CHANNEL", null, "uk-UA"), .addChannelOption(option =>
"ru": client.translate("common:CHANNEL", null, "ru-RU"), option
}) .setName("channel")
.addChannelTypes(ChannelType.GuildText)), .setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({
uk: client.translate("common:CHANNEL", null, "uk-UA"),
ru: client.translate("common:CHANNEL", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:STATE")) option
.setDescriptionLocalizations({ .setName("state")
"uk": client.translate("common:STATE", null, "uk-UA"), .setDescription(client.translate("common:STATE"))
"ru": client.translate("common:STATE", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:STATE", null, "uk-UA"),
.setRequired(true)) ru: client.translate("common:STATE", null, "ru-RU"),
.addRoleOption(option => option.setName("role") })
.setDescription(client.translate("common:ROLE")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("common:ROLE", null, "uk-UA"), .addRoleOption(option =>
"ru": client.translate("common:ROLE", null, "ru-RU"), option
})), .setName("role")
.setDescription(client.translate("common:ROLE"))
.setDescriptionLocalizations({
uk: client.translate("common:ROLE", null, "uk-UA"),
ru: client.translate("common:ROLE", null, "ru-RU"),
}),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,

View file

@ -12,51 +12,64 @@ 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 =>
.setDescription(client.translate("administration/config:LIST")) subcommand
.setDescriptionLocalizations({ .setName("list")
"uk": client.translate("administration/config:LIST", null, "uk-UA"), .setDescription(client.translate("administration/config:LIST"))
"ru": client.translate("administration/config:LIST", null, "ru-RU"), .setDescriptionLocalizations({
}), uk: client.translate("administration/config:LIST", null, "uk-UA"),
ru: client.translate("administration/config:LIST", null, "ru-RU"),
}),
) )
.addSubcommand(subcommand => subcommand.setName("set") .addSubcommand(subcommand =>
.setDescription(client.translate("administration/config:SET")) subcommand
.setDescriptionLocalizations({ .setName("set")
"uk": client.translate("administration/config:SET", null, "uk-UA"), .setDescription(client.translate("administration/config:SET"))
"ru": client.translate("administration/config:SET", null, "ru-RU"),
})
.addStringOption(option => option.setName("setting")
.setDescription(client.translate("administration/config:SETTING"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("administration/config:SETTING", null, "uk-UA"), uk: client.translate("administration/config:SET", null, "uk-UA"),
"ru": client.translate("administration/config:SETTING", null, "ru-RU"), ru: client.translate("administration/config:SET", null, "ru-RU"),
}) })
.setChoices( .addStringOption(option =>
{ name: client.translate("administration/config:BIRTHDAYS"), value: "birthdays" }, option
{ name: client.translate("administration/config:MODLOGS"), value: "modlogs" }, .setName("setting")
{ name: client.translate("administration/config:REPORTS"), value: "reports" }, .setDescription(client.translate("administration/config:SETTING"))
{ name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" }, .setDescriptionLocalizations({
{ name: client.translate("administration/config:MESSAGEUPDATE"), value: "monitoring.messageUpdate" }, uk: client.translate("administration/config:SETTING", null, "uk-UA"),
ru: client.translate("administration/config:SETTING", null, "ru-RU"),
})
.setChoices(
{ name: client.translate("administration/config:BIRTHDAYS"), value: "birthdays" },
{ name: client.translate("administration/config:MODLOGS"), value: "modlogs" },
{ name: client.translate("administration/config:REPORTS"), value: "reports" },
{ name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" },
{ name: client.translate("administration/config:MESSAGEUPDATE"), value: "monitoring.messageUpdate" },
)
.setRequired(true),
) )
.setRequired(true)) .addBooleanOption(option =>
.addBooleanOption(option => option.setName("state") option
.setDescription(client.translate("common:STATE")) .setName("state")
.setDescriptionLocalizations({ .setDescription(client.translate("common:STATE"))
"uk": client.translate("common:STATE", null, "uk-UA"), .setDescriptionLocalizations({
"ru": client.translate("common:STATE", null, "ru-RU"), uk: client.translate("common:STATE", null, "uk-UA"),
}) ru: client.translate("common:STATE", null, "ru-RU"),
.setRequired(true)) })
.addChannelOption(option => option.setName("channel") .setRequired(true),
.setDescription(client.translate("common:CHANNEL")) )
.setDescriptionLocalizations({ .addChannelOption(option =>
"uk": client.translate("common:CHANNEL", null, "uk-UA"), option
"ru": client.translate("common:CHANNEL", null, "ru-RU"), .setName("channel")
})), .setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({
uk: client.translate("common:CHANNEL", null, "uk-UA"),
ru: client.translate("common:CHANNEL", null, "ru-RU"),
}),
),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
@ -94,38 +107,45 @@ 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
channel: `<#${guildData.plugins.welcome.channel}>`, ? interaction.translate("administration/config:WELCOME_CONTENT", {
withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), channel: `<#${guildData.plugins.welcome.channel}>`,
}) : interaction.translate("common:DISABLED"), withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"),
}) : interaction.translate("common:DISABLED"),
inline: true, inline: true,
}, },
{ {
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
channel: `<#${guildData.plugins.goodbye.channel}>`, ? interaction.translate("administration/config:GOODBYE_CONTENT", {
withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"), channel: `<#${guildData.plugins.goodbye.channel}>`,
}) : interaction.translate("common:DISABLED"), withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"),
}) : interaction.translate("common:DISABLED"),
inline: true, inline: true,
}, },
{ {
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:
count: guildData.plugins.warnsSanctions.kick, (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_CONTENT", {
count: guildData.plugins.warnsSanctions.ban, count: guildData.plugins.warnsSanctions.kick,
}) : interaction.translate("administration/config:BAN_NOT_DEFINED")), }) : interaction.translate("administration/config:KICK_NOT_DEFINED")) +
"\n" +
(guildData.plugins.warnsSanctions.ban
? interaction.translate("administration/config:BAN_CONTENT", {
count: guildData.plugins.warnsSanctions.ban,
}) : 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
channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`), ? interaction.translate("administration/config:AUTOMOD_CONTENT", {
}) : interaction.translate("common:DISABLED"), channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`),
}) : interaction.translate("common:DISABLED"),
}, },
{ {
name: interaction.translate("administration/config:MONITORING_CHANNELS"), name: interaction.translate("administration/config:MONITORING_CHANNELS"),
@ -189,10 +209,13 @@ 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({
ephemeral: true, content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${
}); guildData.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${guildData.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`
}`,
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 =>
.setDescription(client.translate("administration/goodbye:TEST")) subcommand
.setDescriptionLocalizations({ .setName("test")
"uk": client.translate("administration/goodbye:TEST", null, "uk-UA"), .setDescription(client.translate("administration/goodbye:TEST"))
"ru": client.translate("administration/goodbye:TEST", null, "ru-RU"), .setDescriptionLocalizations({
}), uk: client.translate("administration/goodbye:TEST", null, "uk-UA"),
ru: client.translate("administration/goodbye:TEST", null, "ru-RU"),
}),
) )
.addSubcommand(subcommand => subcommand.setName("config") .addSubcommand(subcommand =>
.setDescription(client.translate("administration/goodbye:CONFIG")) subcommand
.setDescriptionLocalizations({ .setName("config")
"uk": client.translate("administration/goodbye:CONFIG", null, "uk-UA"), .setDescription(client.translate("administration/goodbye:CONFIG"))
"ru": client.translate("administration/goodbye:CONFIG", null, "ru-RU"),
})
.addBooleanOption(option => option.setName("state")
.setDescription(client.translate("common:STATE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:STATE", null, "uk-UA"), uk: client.translate("administration/goodbye:CONFIG", null, "uk-UA"),
"ru": client.translate("common:STATE", null, "ru-RU"), ru: client.translate("administration/goodbye:CONFIG", null, "ru-RU"),
}) })
.setRequired(true)) .addBooleanOption(option =>
.addChannelOption(option => option.setName("channel") option
.setDescription(client.translate("common:CHANNEL")) .setName("state")
.setDescriptionLocalizations({ .setDescription(client.translate("common:STATE"))
"uk": client.translate("common:CHANNEL", null, "uk-UA"), .setDescriptionLocalizations({
"ru": client.translate("common:CHANNEL", null, "ru-RU"), uk: client.translate("common:STATE", null, "uk-UA"),
})) ru: client.translate("common:STATE", null, "ru-RU"),
.addStringOption(option => option.setName("message") })
.setDescription(client.translate("administration/goodbye:MESSAGE")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("administration/goodbye:MESSAGE", null, "uk-UA"), .addChannelOption(option =>
"ru": client.translate("administration/goodbye:MESSAGE", null, "ru-RU"), option
})) .setName("channel")
.addBooleanOption(option => option.setName("image") .setDescription(client.translate("common:CHANNEL"))
.setDescription(client.translate("administration/goodbye:IMAGE")) .setDescriptionLocalizations({
.setDescriptionLocalizations({ uk: client.translate("common:CHANNEL", null, "uk-UA"),
"uk": client.translate("administration/goodbye:IMAGE", null, "uk-UA"), ru: client.translate("common:CHANNEL", null, "ru-RU"),
"ru": client.translate("administration/goodbye:IMAGE", null, "ru-RU"), }),
})), )
.addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("administration/goodbye:MESSAGE"))
.setDescriptionLocalizations({
uk: client.translate("administration/goodbye:MESSAGE", null, "uk-UA"),
ru: client.translate("administration/goodbye:MESSAGE", null, "ru-RU"),
}),
)
.addBooleanOption(option =>
option
.setName("image")
.setDescription(client.translate("administration/goodbye:IMAGE"))
.setDescriptionLocalizations({
uk: client.translate("administration/goodbye:IMAGE", null, "uk-UA"),
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 =>
.setDescription(client.translate("administration/selectroles:MESSAGE")) subcommand
.setDescriptionLocalizations({ .setName("message")
"uk": client.translate("administration/selectroles:MESSAGE", null, "uk-UA"), .setDescription(client.translate("administration/selectroles:MESSAGE"))
"ru": client.translate("administration/selectroles:MESSAGE", null, "ru-RU"),
})
.addStringOption(option => option.setName("text")
.setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("administration/selectroles:MESSAGE", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("administration/selectroles:MESSAGE", null, "ru-RU"),
}) })
.setRequired(true)), .addStringOption(option =>
option
.setName("text")
.setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({
uk: client.translate("common:MESSAGE", null, "uk-UA"),
ru: client.translate("common:MESSAGE", null, "ru-RU"),
})
.setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("addrole") .addSubcommand(subcommand =>
.setDescription(client.translate("administration/selectroles:ADDROLE")) subcommand
.setDescriptionLocalizations({ .setName("addrole")
"uk": client.translate("administration/selectroles:ADDROLE", null, "uk-UA"), .setDescription(client.translate("administration/selectroles:ADDROLE"))
"ru": client.translate("administration/selectroles:ADDROLE", null, "ru-RU"),
})
.addChannelOption(option => option.setName("channel")
.setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:CHANNEL", null, "uk-UA"), uk: client.translate("administration/selectroles:ADDROLE", null, "uk-UA"),
"ru": client.translate("common:CHANNEL", null, "ru-RU"), ru: client.translate("administration/selectroles:ADDROLE", null, "ru-RU"),
}) })
.setRequired(true)) .addChannelOption(option =>
.addStringOption(option => option.setName("message_id") option
.setDescription(client.translate("common:MESSAGE_ID")) .setName("channel")
.setDescriptionLocalizations({ .setDescription(client.translate("common:CHANNEL"))
"uk": client.translate("common:MESSAGE_ID", null, "uk-UA"), .setDescriptionLocalizations({
"ru": client.translate("common:MESSAGE_ID", null, "ru-RU"), uk: client.translate("common:CHANNEL", null, "uk-UA"),
}) ru: client.translate("common:CHANNEL", null, "ru-RU"),
.setRequired(true)) })
.addRoleOption(option => option.setName("role") .setRequired(true),
.setDescription(client.translate("common:ROLE")) )
.setDescriptionLocalizations({ .addStringOption(option =>
"uk": client.translate("common:ROLE", null, "uk-UA"), option
"ru": client.translate("common:ROLE", null, "ru-RU"), .setName("message_id")
}) .setDescription(client.translate("common:MESSAGE_ID"))
.setRequired(true)), .setDescriptionLocalizations({
uk: client.translate("common:MESSAGE_ID", null, "uk-UA"),
ru: client.translate("common:MESSAGE_ID", null, "ru-RU"),
})
.setRequired(true),
)
.addRoleOption(option =>
option
.setName("role")
.setDescription(client.translate("common:ROLE"))
.setDescriptionLocalizations({
uk: client.translate("common:ROLE", null, "uk-UA"),
ru: client.translate("common:ROLE", null, "ru-RU"),
})
.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, {
value: role.id, label: role.name,
}]; 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)
.setMaxValues(menu.options.length + 1)
.addOptions(option),
);
} else {
row.addComponents(
new StringSelectMenuBuilder()
.setCustomId("auto_roles")
.setMinValues(0) .setMinValues(0)
.setMaxValues(1) .setMaxValues(menu.options.length + 1)
.setPlaceholder(interaction.translate("common:AVAILABLE_OPTIONS"))
.addOptions(option), .addOptions(option),
); );
} else {
row.addComponents(new StringSelectMenuBuilder().setCustomId("auto_roles").setMinValues(0).setMaxValues(1).setPlaceholder(interaction.translate("common:AVAILABLE_OPTIONS")).addOptions(option));
} }
message.edit({ message.edit({

View file

@ -12,38 +12,47 @@ 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 =>
.setDescription(client.translate("owner/debug:TYPE")) option
.setDescriptionLocalizations({ .setName("type")
"uk": client.translate("owner/debug:TYPE", null, "uk-UA"), .setDescription(client.translate("owner/debug:TYPE"))
"ru": client.translate("owner/debug:TYPE", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("owner/debug:TYPE", null, "uk-UA"),
.setRequired(true) ru: client.translate("owner/debug:TYPE", null, "ru-RU"),
.setChoices( })
{ name: client.translate("common:LEVEL"), value: "level" }, .setRequired(true)
{ name: client.translate("common:XP"), value: "xp" }, .setChoices(
{ name: client.translate("common:CREDITS"), value: "credits" }, { name: client.translate("common:LEVEL"), value: "level" },
{ name: client.translate("economy/transactions:BANK"), value: "bank" }, { name: client.translate("common:XP"), value: "xp" },
)) { name: client.translate("common:CREDITS"), value: "credits" },
.addUserOption(option => option.setName("user") { name: client.translate("economy/transactions:BANK"), value: "bank" },
.setDescription(client.translate("common:USER")) ),
.setDescriptionLocalizations({ )
"uk": client.translate("common:USER", null, "uk-UA"), .addUserOption(option =>
"ru": client.translate("common:USER", null, "ru-RU"), option
}) .setName("user")
.setRequired(true)) .setDescription(client.translate("common:USER"))
.addIntegerOption(option => option.setName("int") .setDescriptionLocalizations({
.setDescription(client.translate("common:INT")) uk: client.translate("common:USER", null, "uk-UA"),
.setDescriptionLocalizations({ ru: client.translate("common:USER", null, "ru-RU"),
"uk": client.translate("common:INT", null, "uk-UA"), })
"ru": client.translate("common:INT", null, "ru-RU"), .setRequired(true),
}) )
.setRequired(true)), .addIntegerOption(option =>
option
.setName("int")
.setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({
uk: client.translate("common:INT", null, "uk-UA"),
ru: client.translate("common:INT", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:LANGUAGE")) option
.setDescriptionLocalizations({ .setName("language")
"uk": client.translate("common:LANGUAGE", null, "uk-UA"), .setDescription(client.translate("common:LANGUAGE"))
"ru": client.translate("common:LANGUAGE", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:LANGUAGE", null, "uk-UA"),
.setRequired(true) ru: client.translate("common:LANGUAGE", null, "ru-RU"),
.setChoices( })
{ name: "English", value: "en-US" }, .setRequired(true)
{ name: "Русский", value: "ru-RU" }, .setChoices({ name: "English", value: "en-US" }, { name: "Русский", value: "ru-RU" }, { name: "Українська", value: "uk-UA" }),
{ 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 =>
.setDescription(client.translate("common:EMOJI")) option
.setDescriptionLocalizations({ .setName("emoji")
"uk": client.translate("common:EMOJI", null, "uk-UA"), .setDescription(client.translate("common:EMOJI"))
"ru": client.translate("common:EMOJI", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:EMOJI", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:EMOJI", null, "ru-RU"),
})
.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 =>
emoji: emoji.name, interaction.success("administration/stealemoji:SUCCESS", {
}, { ephemeral: true })) emoji: emoji.name,
}, { 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 =>
.setDescription(client.translate("administration/goodbye:TEST")) subcommand
.setDescriptionLocalizations({ .setName("test")
"uk": client.translate("administration/goodbye:TEST", null, "uk-UA"), .setDescription(client.translate("administration/goodbye:TEST"))
"ru": client.translate("administration/goodbye:TEST", null, "ru-RU"), .setDescriptionLocalizations({
}), uk: client.translate("administration/goodbye:TEST", null, "uk-UA"),
ru: client.translate("administration/goodbye:TEST", null, "ru-RU"),
}),
) )
.addSubcommand(subcommand => subcommand.setName("config") .addSubcommand(subcommand =>
.setDescription(client.translate("administration/goodbye:CONFIG")) subcommand
.setDescriptionLocalizations({ .setName("config")
"uk": client.translate("administration/goodbye:CONFIG", null, "uk-UA"), .setDescription(client.translate("administration/goodbye:CONFIG"))
"ru": client.translate("administration/goodbye:CONFIG", null, "ru-RU"),
})
.addBooleanOption(option => option.setName("state")
.setDescription(client.translate("common:STATE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:STATE", null, "uk-UA"), uk: client.translate("administration/goodbye:CONFIG", null, "uk-UA"),
"ru": client.translate("common:STATE", null, "ru-RU"), ru: client.translate("administration/goodbye:CONFIG", null, "ru-RU"),
}) })
.setRequired(true)) .addBooleanOption(option =>
.addChannelOption(option => option.setName("channel") option
.setDescription(client.translate("common:CHANNEL")) .setName("state")
.setDescriptionLocalizations({ .setDescription(client.translate("common:STATE"))
"uk": client.translate("common:CHANNEL", null, "uk-UA"), .setDescriptionLocalizations({
"ru": client.translate("common:CHANNEL", null, "ru-RU"), uk: client.translate("common:STATE", null, "uk-UA"),
})) ru: client.translate("common:STATE", null, "ru-RU"),
.addStringOption(option => option.setName("message") })
.setDescription(client.translate("administration/goodbye:MESSAGE")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("administration/goodbye:MESSAGE", null, "uk-UA"), .addChannelOption(option =>
"ru": client.translate("administration/goodbye:MESSAGE", null, "ru-RU"), option
})) .setName("channel")
.addBooleanOption(option => option.setName("image") .setDescription(client.translate("common:CHANNEL"))
.setDescription(client.translate("administration/goodbye:IMAGE")) .setDescriptionLocalizations({
.setDescriptionLocalizations({ uk: client.translate("common:CHANNEL", null, "uk-UA"),
"uk": client.translate("administration/goodbye:IMAGE", null, "uk-UA"), ru: client.translate("common:CHANNEL", null, "ru-RU"),
"ru": client.translate("administration/goodbye:IMAGE", null, "ru-RU"), }),
})), )
.addStringOption(option =>
option
.setName("message")
.setDescription(client.translate("administration/goodbye:MESSAGE"))
.setDescriptionLocalizations({
uk: client.translate("administration/goodbye:MESSAGE", null, "uk-UA"),
ru: client.translate("administration/goodbye:MESSAGE", null, "ru-RU"),
}),
)
.addBooleanOption(option =>
option
.setName("image")
.setDescription(client.translate("administration/goodbye:IMAGE"))
.setDescriptionLocalizations({
uk: client.translate("administration/goodbye:IMAGE", null, "uk-UA"),
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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
})), uk: client.translate("common:USER", null, "uk-UA"),
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 =>
.setDescription(client.translate("economy/bank:OPTION")) option
.setDescriptionLocalizations({ .setName("option")
"uk": client.translate("economy/bank:OPTION", null, "uk-UA"), .setDescription(client.translate("economy/bank:OPTION"))
"ru": client.translate("economy/bank:OPTION", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("economy/bank:OPTION", null, "uk-UA"),
.setRequired(true) ru: client.translate("economy/bank:OPTION", null, "ru-RU"),
.setChoices( })
{ name: client.translate("economy/bank:DEPOSIT"), value: "deposit" }, .setRequired(true)
{ name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" }, .setChoices({ name: client.translate("economy/bank:DEPOSIT"), value: "deposit" }, { name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" }),
)) )
.addStringOption(option => option.setName("credits") .addStringOption(option =>
.setDescription(client.translate("misc:OPTION_NAN_ALL")) option
.setDescriptionLocalizations({ .setName("credits")
"uk": client.translate("misc:OPTION_NAN_ALL", null, "uk-UA"), .setDescription(client.translate("misc:OPTION_NAN_ALL"))
"ru": client.translate("misc:OPTION_NAN_ALL", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("misc:OPTION_NAN_ALL", null, "uk-UA"),
.setRequired(true)), ru: client.translate("misc:OPTION_NAN_ALL", null, "ru-RU"),
})
.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,45 +12,54 @@ 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 =>
.setDescription(client.translate("economy/birthdate:DAY")) option
.setDescriptionLocalizations({ .setName("day")
"uk": client.translate("economy/birthdate:DAY", null, "uk-UA"), .setDescription(client.translate("economy/birthdate:DAY"))
"ru": client.translate("economy/birthdate:DAY", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("economy/birthdate:DAY", null, "uk-UA"),
.setRequired(true)) ru: client.translate("economy/birthdate:DAY", null, "ru-RU"),
.addIntegerOption(option => option.setName("month") })
.setDescription(client.translate("economy/birthdate:MONTH")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("economy/birthdate:MONTH", null, "uk-UA"), .addIntegerOption(option =>
"ru": client.translate("economy/birthdate:MONTH", null, "ru-RU"), option
}) .setName("month")
.setRequired(true) .setDescription(client.translate("economy/birthdate:MONTH"))
.setChoices( .setDescriptionLocalizations({
{ name: client.translate("economy/birthdate:JANUARY"), value: 1 }, uk: client.translate("economy/birthdate:MONTH", null, "uk-UA"),
{ name: client.translate("economy/birthdate:FEBRUARY"), value: 2 }, ru: client.translate("economy/birthdate:MONTH", null, "ru-RU"),
{ name: client.translate("economy/birthdate:MARCH"), value: 3 }, })
{ name: client.translate("economy/birthdate:APRIL"), value: 4 }, .setRequired(true)
{ name: client.translate("economy/birthdate:MAY"), value: 5 }, .setChoices(
{ name: client.translate("economy/birthdate:JUNE"), value: 6 }, { name: client.translate("economy/birthdate:JANUARY"), value: 1 },
{ name: client.translate("economy/birthdate:JULY"), value: 7 }, { name: client.translate("economy/birthdate:FEBRUARY"), value: 2 },
{ name: client.translate("economy/birthdate:AUGUST"), value: 8 }, { name: client.translate("economy/birthdate:MARCH"), value: 3 },
{ name: client.translate("economy/birthdate:SEPTEMBER"), value: 9 }, { name: client.translate("economy/birthdate:APRIL"), value: 4 },
{ name: client.translate("economy/birthdate:OCTOBER"), value: 10 }, { name: client.translate("economy/birthdate:MAY"), value: 5 },
{ name: client.translate("economy/birthdate:NOVEMBER"), value: 11 }, { name: client.translate("economy/birthdate:JUNE"), value: 6 },
{ name: client.translate("economy/birthdate:DECEMBER"), value: 12 }, { name: client.translate("economy/birthdate:JULY"), value: 7 },
)) { name: client.translate("economy/birthdate:AUGUST"), value: 8 },
.addIntegerOption(option => option.setName("year") { name: client.translate("economy/birthdate:SEPTEMBER"), value: 9 },
.setDescription(client.translate("economy/birthdate:YEAR")) { name: client.translate("economy/birthdate:OCTOBER"), value: 10 },
.setDescriptionLocalizations({ { name: client.translate("economy/birthdate:NOVEMBER"), value: 11 },
"uk": client.translate("economy/birthdate:YEAR", null, "uk-UA"), { name: client.translate("economy/birthdate:DECEMBER"), value: 12 },
"ru": client.translate("economy/birthdate:YEAR", null, "ru-RU"), ),
}) )
.setRequired(true)), .addIntegerOption(option =>
option
.setName("year")
.setDescription(client.translate("economy/birthdate:YEAR"))
.setDescriptionLocalizations({
uk: client.translate("economy/birthdate:YEAR", null, "uk-UA"),
ru: client.translate("economy/birthdate:YEAR", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("owner/debug:TYPE")) option
.setDescriptionLocalizations({ .setName("type")
"uk": client.translate("owner/debug:TYPE", null, "uk-UA"), .setDescription(client.translate("owner/debug:TYPE"))
"ru": client.translate("owner/debug:TYPE", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("owner/debug:TYPE", null, "uk-UA"),
.setRequired(true) ru: client.translate("owner/debug:TYPE", null, "ru-RU"),
.setChoices( })
{ name: client.translate("common:LEVEL"), value: "level" }, .setRequired(true)
{ name: client.translate("common:MONEY"), value: "money" }, .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:REP"), value: "rep" }, ),
)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -51,10 +50,11 @@ 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)
content: interaction.translate("economy/leaderboard:MOBILE"), interaction.followUp({
ephemeral: true, content: interaction.translate("economy/leaderboard:MOBILE"),
}); ephemeral: true,
});
if (type === "money") { if (type === "money") {
const membersLeaderboard = [], const membersLeaderboard = [],
@ -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"), {
value: userNames, name: interaction.translate("common:USER"),
inline: true, value: userNames,
}, { inline: true,
name: interaction.translate("common:CREDITS"), },
value: money, {
inline: true, name: interaction.translate("common:CREDITS"),
}); value: money,
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"), {
value: userNames, name: interaction.translate("common:USER"),
inline: true, value: userNames,
}, { inline: true,
name: interaction.translate("common:REP"), },
value: rep, {
inline: true, name: interaction.translate("common:REP"),
}); value: rep,
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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:USER", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:USER", null, "ru-RU"),
})
.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,17 +91,10 @@ 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({
content: interaction.translate("economy/marry:REQUEST", { content: interaction.translate("economy/marry:REQUEST", {
@ -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", {
attachment: "./assets/img/achievements/achievement_unlocked3.png", name: "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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
})), uk: client.translate("common:USER", null, "uk-UA"),
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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:USER", null, "uk-UA"),
.setRequired(true)) ru: client.translate("common:USER", null, "ru-RU"),
.addIntegerOption(option => option.setName("amount") })
.setDescription(client.translate("common:INT")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("common:INT", null, "uk-UA"), .addIntegerOption(option =>
"ru": client.translate("common:INT", null, "ru-RU"), option
}) .setName("amount")
.setRequired(true)), .setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({
uk: client.translate("common:INT", null, "uk-UA"),
ru: client.translate("common:INT", null, "ru-RU"),
})
.setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -55,9 +61,10 @@ 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)
amount: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}`, 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"))}`,
});
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,

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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
})), uk: client.translate("common:USER", null, "uk-UA"),
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", {
attachment: buffer, name: "achievements.png",
}], 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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:USER", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:USER", null, "ru-RU"),
})
.setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -44,9 +47,10 @@ 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())
time: client.functions.convertTime(client, isInCooldown, true, true, data.guildData.language), return interaction.error("economy/rep:COOLDOWN", {
}); time: client.functions.convertTime(client, isInCooldown, true, true, data.guildData.language),
});
} }
const user = interaction.options.getUser("user"); const user = interaction.options.getUser("user");
@ -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", {
attachment: "./assets/img/achievements/achievement_unlocked6.png", name: "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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:USER", null, "uk-UA"),
.setRequired(true)) ru: client.translate("common:USER", null, "ru-RU"),
.addIntegerOption(option => option.setName("amount") })
.setDescription(client.translate("common:INT")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("common:INT", null, "uk-UA"), .addIntegerOption(option =>
"ru": client.translate("common:INT", null, "ru-RU"), option
}) .setName("amount")
.setRequired(true)), .setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({
uk: client.translate("common:INT", null, "uk-UA"),
ru: client.translate("common:INT", null, "ru-RU"),
})
.setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -68,15 +74,16 @@ 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)
moneyMin: `**${potentiallyLose}** ${client.functions.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, return interaction.error("economy/rob:NOT_ENOUGH_AUTHOR", {
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"))}`, 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"))}`,
});
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 =>
.setDescription(client.translate("economy/profile:BIO")) option
.setDescriptionLocalizations({ .setName("text")
"uk": client.translate("economy/profile:BIO", null, "uk-UA"), .setDescription(client.translate("economy/profile:BIO"))
"ru": client.translate("economy/profile:BIO", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("economy/profile:BIO", null, "uk-UA"),
.setRequired(true)), ru: client.translate("economy/profile:BIO", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:INT")) option
.setDescriptionLocalizations({ .setName("amount")
"uk": client.translate("common:INT", null, "uk-UA"), .setDescription(client.translate("common:INT"))
"ru": client.translate("common:INT", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:INT", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:INT", null, "ru-RU"),
})
.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,33 +86,35 @@ 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:
money: `**${amount}** ${client.functions.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, "**!! ДЖЕКПОТ !!**\n" +
won: `**${credits}** ${client.functions.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, interaction.translate("economy/slots:VICTORY", {
user: interaction.member.toString(), 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"))}`,
user: interaction.member.toString(),
}),
}); });
const toAdd = credits - amount; const toAdd = credits - amount;
@ -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", {
attachment: "./assets/img/achievements/achievement_unlocked4.png", name: "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", {
attachment: "./assets/img/achievements/achievement_unlocked4.png", name: "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 =>
.setDescription(client.translate("economy/transactions:CLEAR")) option
.setDescriptionLocalizations({ .setName("clear")
"uk": client.translate("economy/transactions:CLEAR", null, "uk-UA"), .setDescription(client.translate("economy/transactions:CLEAR"))
"ru": client.translate("economy/transactions:CLEAR", null, "ru-RU"), .setDescriptionLocalizations({
})), uk: client.translate("economy/transactions:CLEAR", null, "uk-UA"),
ru: client.translate("economy/transactions:CLEAR", null, "ru-RU"),
}),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -60,30 +63,36 @@ 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"), {
value: sortedTransactions[0].join("\n"), name: interaction.translate("economy/transactions:T_GOT"),
inline: true, value: sortedTransactions[0].join("\n"),
}, inline: true,
]); },
if (sortedTransactions[1].length > 0) embed.addFields([ ]);
{ if (sortedTransactions[1].length > 0)
name: interaction.translate("economy/transactions:T_SEND"), embed.addFields([
value: sortedTransactions[1].join("\n"), {
inline: true, name: interaction.translate("economy/transactions:T_SEND"),
}, value: sortedTransactions[1].join("\n"),
]); inline: true,
},
]);
} }
interaction.reply({ interaction.reply({

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())
time: client.functions.convertTime(client, isInCooldown, true, true, data.guildData.language), return interaction.error("economy/work:COOLDOWN", {
}); 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", {
attachment: "./assets/img/achievements/achievement_unlocked1.png", name: "unlocked.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 =>
.setDescription(client.translate("fun/8ball:QUESTION")) option
.setDescriptionLocalizations({ .setName("question")
"uk": client.translate("fun/8ball:QUESTION", null, "uk-UA"), .setDescription(client.translate("fun/8ball:QUESTION"))
"ru": client.translate("fun/8ball:QUESTION", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("fun/8ball:QUESTION", null, "uk-UA"),
.setRequired(true)), ru: client.translate("fun/8ball:QUESTION", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("fun/lmgtfy:QUERY")) option
.setDescriptionLocalizations({ .setName("query")
"uk": client.translate("fun/lmgtfy:QUERY", null, "uk-UA"), .setDescription(client.translate("fun/lmgtfy:QUERY"))
"ru": client.translate("fun/lmgtfy:QUERY", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("fun/lmgtfy:QUERY", null, "uk-UA"),
.setRequired(true)) ru: client.translate("fun/lmgtfy:QUERY", null, "ru-RU"),
.addBooleanOption(option => option.setName("short") })
.setDescription(client.translate("fun/lmgtfy:SHORT")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("fun/lmgtfy:SHORT", null, "uk-UA"), .addBooleanOption(option =>
"ru": client.translate("fun/lmgtfy:SHORT", null, "ru-RU"), option
}) .setName("short")
.setRequired(true)), .setDescription(client.translate("fun/lmgtfy:SHORT"))
.setDescriptionLocalizations({
uk: client.translate("fun/lmgtfy:SHORT", null, "uk-UA"),
ru: client.translate("fun/lmgtfy:SHORT", null, "ru-RU"),
})
.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(
percent, interaction.translate("fun/lovecalc:CONTENT", {
firstMember: firstMember.user.toString(), percent,
secondMember: secondMember.user.toString(), firstMember: firstMember.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,12 +102,14 @@ class Number extends BaseCommand {
collector.stop(); collector.stop();
} }
if (parseInt(msg.content) < number) msg.reply({ if (parseInt(msg.content) < number)
content: interaction.translate("fun/number:TOO_BIG", { user: msg.author.toString(), number: parsedNumber }), msg.reply({
}); content: interaction.translate("fun/number:TOO_BIG", { user: msg.author.toString(), number: parsedNumber }),
if (parseInt(msg.content) > number) msg.reply({ });
content: interaction.translate("fun/number:TOO_SMALL", { user: msg.author.toString(), number: parsedNumber }), if (parseInt(msg.content) > number)
}); msg.reply({
content: interaction.translate("fun/number:TOO_SMALL", { user: msg.author.toString(), number: parsedNumber }),
});
}); });
collector.on("end", (_, reason) => { collector.on("end", (_, reason) => {

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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:USER", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:USER", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:MESSAGE")) option
.setDescriptionLocalizations({ .setName("message")
"uk": client.translate("common:MESSAGE", null, "uk-UA"), .setDescription(client.translate("common:MESSAGE"))
"ru": client.translate("common:MESSAGE", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:MESSAGE", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:MESSAGE", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
})) uk: client.translate("common:USER", null, "uk-UA"),
.addBooleanOption(option => option.setName("server") ru: client.translate("common:USER", null, "ru-RU"),
.setDescription(client.translate("general/avatar:SERVER")) }),
.setDescriptionLocalizations({ )
"uk": client.translate("general/avatar:SERVER", null, "uk-UA"), .addBooleanOption(option =>
"ru": client.translate("general/avatar:SERVER", null, "ru-RU"), option
})), .setName("server")
.setDescription(client.translate("general/avatar:SERVER"))
.setDescriptionLocalizations({
uk: client.translate("general/avatar:SERVER", null, "uk-UA"),
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,25 +43,12 @@ 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({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
@ -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 =>
.setDescription(client.translate("common:EMOJI")) option
.setDescriptionLocalizations({ .setName("emoji")
"uk": client.translate("commom:EMOJI", null, "uk-UA"), .setDescription(client.translate("common:EMOJI"))
"ru": client.translate("common:EMOJI", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("commom:EMOJI", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:EMOJI", null, "ru-RU"),
})
.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,19 +83,21 @@ 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
return { .filter(cmd => cmd.category === arg)
name: `**${c.command.name}**`, .map(c => {
value: interaction.translate(`${arg.toLowerCase()}/${c.command.name}:DESCRIPTION`), return {
}; name: `**${c.command.name}**`,
}); value: interaction.translate(`${arg.toLowerCase()}/${c.command.name}:DESCRIPTION`),
};
});
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
@ -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 =>
.setDescription(client.translate("common:IP")) option
.setDescriptionLocalizations({ .setName("ip")
"uk": client.translate("common:IP", null, "uk-UA"), .setDescription(client.translate("common:IP"))
"ru": client.translate("common:IP", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:IP", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:IP", null, "ru-RU"),
})
.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(
ping: Math.round(client.ws.ping), interaction.translate("general/ping:PING", {
})); ping: Math.round(client.ws.ping),
}),
);
interaction.reply({ interaction.reply({
embeds: [embed], embeds: [embed],

View file

@ -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 =>
.setDescription(client.translate("general/remindme:TIME")) option
.setDescriptionLocalizations({ .setName("time")
"uk": client.translate("general/remindme:TIME", null, "uk-UA"), .setDescription(client.translate("general/remindme:TIME"))
"ru": client.translate("general/remindme:TIME", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("general/remindme:TIME", null, "uk-UA"),
.setRequired(true)) ru: client.translate("general/remindme:TIME", null, "ru-RU"),
.addStringOption(option => option.setName("message") })
.setDescription(client.translate("common:MESSAGE")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("common:MESSAGE", null, "uk-UA"), .addStringOption(option =>
"ru": client.translate("common:MESSAGE", null, "ru-RU"), option
}) .setName("message")
.setRequired(true)), .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({
uk: client.translate("common:MESSAGE", null, "uk-UA"),
ru: client.translate("common:MESSAGE", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:USER", null, "uk-UA"),
.setRequired(true)) ru: client.translate("common:USER", null, "ru-RU"),
.addStringOption(option => option.setName("message") })
.setDescription(client.translate("common:MESSAGE")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("common:MESSAGE", null, "uk-UA"), .addStringOption(option =>
"ru": client.translate("common:MESSAGE", null, "ru-RU"), option
}) .setName("message")
.setRequired(true)), .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({
uk: client.translate("common:MESSAGE", null, "uk-UA"),
ru: client.translate("common:MESSAGE", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:URL")) option
.setDescriptionLocalizations({ .setName("url")
"uk": client.translate("common:URL", null, "uk-UA"), .setDescription(client.translate("common:URL"))
"ru": client.translate("common:URL", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:URL", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:URL", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:MESSAGE")) option
.setDescriptionLocalizations({ .setName("message")
"uk": client.translate("common:MESSAGE", null, "uk-UA"), .setDescription(client.translate("common:MESSAGE"))
"ru": client.translate("common:MESSAGE", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:MESSAGE", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:MESSAGE", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
})), uk: client.translate("common:USER", null, "uk-UA"),
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(
size: 512, member.displayAvatarURL({
})) 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:
count: member.roles.cache.size - 10, member.roles.size > 10
}) : (member.roles.cache.size < 1) ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map(r => r).join(", ")), ? 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,
})
: 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 =>
.setDescription(client.translate("common:IP")) option
.setDescriptionLocalizations({ .setName("ip")
"uk": client.translate("common:IP", null, "uk-UA"), .setDescription(client.translate("common:IP"))
"ru": client.translate("common:IP", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:IP", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:IP", null, "ru-RU"),
})
.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(
ip, interaction.translate("general/whois:INFO_ABOUT", {
})) 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 =>
.setDescription(client.translate("moderation/clear:OPTION")) option
.setDescriptionLocalizations({ .setName("option")
"uk": client.translate("moderation/clear:OPTION", null, "uk-UA"), .setDescription(client.translate("moderation/clear:OPTION"))
"ru": client.translate("moderation/clear:OPTION", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("moderation/clear:OPTION", null, "uk-UA"),
.setRequired(true)) ru: client.translate("moderation/clear:OPTION", null, "ru-RU"),
.addUserOption(option => option.setName("user") })
.setDescription(client.translate("common:USER")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("common:USER", null, "uk-UA"), .addUserOption(option =>
"ru": client.translate("common:USER", null, "ru-RU"), option
})) .setName("user")
.addStringOption(option => option.setName("id") .setDescription(client.translate("common:USER"))
.setDescription(client.translate("common:USER_ID")) .setDescriptionLocalizations({
.setDescriptionLocalizations({ uk: client.translate("common:USER", null, "uk-UA"),
"uk": client.translate("common:USER_ID", null, "uk-UA"), ru: client.translate("common:USER", null, "ru-RU"),
"ru": client.translate("common:USER_ID", null, "ru-RU"), }),
})), )
.addStringOption(option =>
option
.setName("id")
.setDescription(client.translate("common:USER_ID"))
.setDescriptionLocalizations({
uk: client.translate("common:USER_ID", null, "uk-UA"),
ru: client.translate("common:USER_ID", null, "ru-RU"),
}),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -62,17 +71,10 @@ 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({
content: interaction.translate("moderation/clear:ALL_CONFIRM"), content: interaction.translate("moderation/clear:ALL_CONFIRM"),
@ -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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:USER", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:USER", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("moderation/giveaway:CREATE")) subcommand
.setDescriptionLocalizations({ .setName("create")
"uk": client.translate("moderation/giveaway:CREATE", null, "uk-UA"), .setDescription(client.translate("moderation/giveaway:CREATE"))
"ru": client.translate("moderation/giveaway:CREATE", null, "ru-RU"),
})
.addStringOption(option => option.setName("duration")
.setDescription(client.translate("common:DURATION"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:DURATION", null, "uk-UA"), uk: client.translate("moderation/giveaway:CREATE", null, "uk-UA"),
"ru": client.translate("common:DURATION", null, "ru-RU"), ru: client.translate("moderation/giveaway:CREATE", null, "ru-RU"),
}) })
.setRequired(true)) .addStringOption(option =>
.addIntegerOption(option => option.setName("winners_count") option
.setDescription(client.translate("moderation/giveaway:WINNERS_COUNT")) .setName("duration")
.setDescriptionLocalizations({ .setDescription(client.translate("common:DURATION"))
"uk": client.translate("moderation/giveaway:WINNERS_COUNT", null, "uk-UA"), .setDescriptionLocalizations({
"ru": client.translate("moderation/giveaway:WINNERS_COUNT", null, "ru-RU"), uk: client.translate("common:DURATION", null, "uk-UA"),
}) ru: client.translate("common:DURATION", null, "ru-RU"),
.setRequired(true)) })
.addStringOption(option => option.setName("prize") .setRequired(true),
.setDescription(client.translate("moderation/giveaway:PRIZE")) )
.setDescriptionLocalizations({ .addIntegerOption(option =>
"uk": client.translate("moderation/giveaway:PRIZE", null, "uk-UA"), option
"ru": client.translate("moderation/giveaway:PRIZE", null, "ru-RU"), .setName("winners_count")
}) .setDescription(client.translate("moderation/giveaway:WINNERS_COUNT"))
.setRequired(true)) .setDescriptionLocalizations({
.addBooleanOption(option => option.setName("isdrop") uk: client.translate("moderation/giveaway:WINNERS_COUNT", null, "uk-UA"),
.setDescription(client.translate("moderation/giveaway:ISDROP")) ru: client.translate("moderation/giveaway:WINNERS_COUNT", null, "ru-RU"),
.setDescriptionLocalizations({ })
"uk": client.translate("moderation/giveaway:ISDROP", null, "uk-UA"), .setRequired(true),
"ru": client.translate("moderation/giveaway:ISDROP", null, "ru-RU"), )
}) .addStringOption(option =>
.setRequired(true)), option
.setName("prize")
.setDescription(client.translate("moderation/giveaway:PRIZE"))
.setDescriptionLocalizations({
uk: client.translate("moderation/giveaway:PRIZE", null, "uk-UA"),
ru: client.translate("moderation/giveaway:PRIZE", null, "ru-RU"),
})
.setRequired(true),
)
.addBooleanOption(option =>
option
.setName("isdrop")
.setDescription(client.translate("moderation/giveaway:ISDROP"))
.setDescriptionLocalizations({
uk: client.translate("moderation/giveaway:ISDROP", null, "uk-UA"),
ru: client.translate("moderation/giveaway:ISDROP", null, "ru-RU"),
})
.setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("reroll") .addSubcommand(subcommand =>
.setDescription(client.translate("moderation/giveaway:REROLL")) subcommand
.setDescriptionLocalizations({ .setName("reroll")
"uk": client.translate("moderation/giveaway:REROLL", null, "uk-UA"), .setDescription(client.translate("moderation/giveaway:REROLL"))
"ru": client.translate("moderation/giveaway:REROLL", null, "ru-RU"),
})
.addStringOption(option => option.setName("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:REROLL", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"), ru: client.translate("moderation/giveaway:REROLL", null, "ru-RU"),
}) })
.setRequired(true)), .addStringOption(option =>
option
.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setDescriptionLocalizations({
uk: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
ru: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
})
.setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("end") .addSubcommand(subcommand =>
.setDescription(client.translate("moderation/giveaway:END")) subcommand
.setDescriptionLocalizations({ .setName("end")
"uk": client.translate("moderation/giveaway:END", null, "uk-UA"), .setDescription(client.translate("moderation/giveaway:END"))
"ru": client.translate("moderation/giveaway:END", null, "ru-RU"),
})
.addStringOption(option => option.setName("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:END", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"), ru: client.translate("moderation/giveaway:END", null, "ru-RU"),
}) })
.setRequired(true)), .addStringOption(option =>
option
.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setDescriptionLocalizations({
uk: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
ru: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
})
.setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("delete") .addSubcommand(subcommand =>
.setDescription(client.translate("moderation/giveaway:DELETE")) subcommand
.setDescriptionLocalizations({ .setName("delete")
"uk": client.translate("moderation/giveaway:DELETE", null, "uk-UA"), .setDescription(client.translate("moderation/giveaway:DELETE"))
"ru": client.translate("moderation/giveaway:DELETE", null, "ru-RU"),
})
.addStringOption(option => option.setName("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:DELETE", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"), ru: client.translate("moderation/giveaway:DELETE", null, "ru-RU"),
}) })
.setRequired(true)), .addStringOption(option =>
option
.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setDescriptionLocalizations({
uk: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
ru: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
})
.setRequired(true),
),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
@ -129,44 +158,49 @@ 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
duration: ms(duration), .start(interaction.channel, {
winnerCount: winnersCount, duration: ms(duration),
prize: prize, winnerCount: winnersCount,
hostedBy: interaction.user, prize: prize,
isDrop: isdrop, hostedBy: interaction.user,
messages: { isDrop: isdrop,
giveaway: interaction.translate("moderation/giveaway:TITLE"), messages: {
giveawayEnded: interaction.translate("moderation/giveaway:ENDED"), giveaway: interaction.translate("moderation/giveaway:TITLE"),
timeRemaining: interaction.translate("moderation/giveaway:TIME_REMAINING"), giveawayEnded: interaction.translate("moderation/giveaway:ENDED"),
inviteToParticipate: interaction.translate("moderation/giveaway:INVITE_PARTICIPATE"), timeRemaining: interaction.translate("moderation/giveaway:TIME_REMAINING"),
winMessage: interaction.translate("moderation/giveaway:WIN_MESSAGE"), inviteToParticipate: interaction.translate("moderation/giveaway:INVITE_PARTICIPATE"),
drawing: interaction.translate("moderation/giveaway:DRAWING"), winMessage: interaction.translate("moderation/giveaway:WIN_MESSAGE"),
dropMessage: interaction.translate("moderation/giveaway:DROP"), drawing: interaction.translate("moderation/giveaway:DRAWING"),
embedFooter: interaction.translate("moderation/giveaway:FOOTER"), dropMessage: interaction.translate("moderation/giveaway:DROP"),
noWinner: interaction.translate("moderation/giveaway:NO_WINNER"), embedFooter: interaction.translate("moderation/giveaway:FOOTER"),
winners: interaction.translate("moderation/giveaway:WINNERS"), noWinner: interaction.translate("moderation/giveaway:NO_WINNER"),
endedAt: interaction.translate("moderation/giveaway:END_AT"), winners: interaction.translate("moderation/giveaway:WINNERS"),
hostedBy: interaction.translate("moderation/giveaway:HOSTED_BY"), endedAt: interaction.translate("moderation/giveaway:END_AT"),
}, hostedBy: interaction.translate("moderation/giveaway:HOSTED_BY"),
}).then(() => { },
return interaction.success("moderation/giveaway:GIVEAWAY_CREATED", null, { ephemeral: true }); })
}); .then(() => {
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
messages: { .reroll(giveaway_id, {
congrat: interaction.translate("moderation/giveaway:REROLL_CONGRAT"), messages: {
error: interaction.translate("moderation/giveaway:REROLL_ERROR"), congrat: interaction.translate("moderation/giveaway:REROLL_CONGRAT"),
}, error: interaction.translate("moderation/giveaway:REROLL_ERROR"),
}).then(() => { },
return interaction.success("moderation/giveaway:GIVEAWAY_REROLLED"); })
}).catch(() => { .then(() => {
return interaction.error("moderation/giveaway:NOT_FOUND_ENDED", { return interaction.success("moderation/giveaway:GIVEAWAY_REROLLED");
messageId: giveaway_id, })
}, { ephemeral: true }); .catch(() => {
}); return interaction.error("moderation/giveaway:NOT_FOUND_ENDED", {
messageId: giveaway_id,
}, { ephemeral: true });
});
} else if (command === "end") { } else if (command === "end") {
const giveaway_id = interaction.options.getString("giveaway_id"); const giveaway_id = interaction.options.getString("giveaway_id");
@ -181,13 +215,16 @@ 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
return interaction.success("moderation/giveaway:GIVEAWAY_DELETED"); .delete(giveaway_id)
}).catch(() => { .then(() => {
return interaction.error("moderation/giveaway:NOT_FOUND", { return interaction.success("moderation/giveaway:GIVEAWAY_DELETED");
messageId: giveaway_id, })
}, { ephemeral: true }); .catch(() => {
}); return interaction.error("moderation/giveaway:NOT_FOUND", {
messageId: giveaway_id,
}, { 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 =>
.setDescription(client.translate("moderation/poll:QUESTION")) option
.setDescriptionLocalizations({ .setName("question")
"uk": client.translate("moderation/poll:QUESTION", null, "uk-UA"), .setDescription(client.translate("moderation/poll:QUESTION"))
"ru": client.translate("moderation/poll:QUESTION", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("moderation/poll:QUESTION", null, "uk-UA"),
.setRequired(true)), ru: client.translate("moderation/poll:QUESTION", null, "ru-RU"),
})
.setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false, ownerOnly: false,
@ -45,26 +48,12 @@ 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"),
@ -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 =>
.setDescription(client.translate("common:USER_ID")) option
.setDescriptionLocalizations({ .setName("user_id")
"uk": client.translate("common:USER_ID", null, "uk-UA"), .setDescription(client.translate("common:USER_ID"))
"ru": client.translate("common:USER_ID", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:USER_ID", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:USER_ID", null, "ru-RU"),
})
.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,15 +59,17 @@ 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({
filter: i => i.user.id === interaction.member.id && i.customId === "warn_modal", time: 2 * 60 * 1000,
}).catch(() => { filter: i => i.user.id === interaction.member.id && i.customId === "warn_modal",
interaction.followUp({ })
content: interaction.translate("misc:TIMED_OUT"), .catch(() => {
ephemeral: true, interaction.followUp({
content: interaction.translate("misc:TIMED_OUT"),
ephemeral: true,
});
}); });
});
if (submitted) { if (submitted) {
const reason = submitted.fields.getTextInputValue("warn_reason"); const reason = submitted.fields.getTextInputValue("warn_reason");
@ -85,22 +85,21 @@ 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()})`, },
}, {
{ name: interaction.translate("common:MODERATOR"),
name: interaction.translate("common:MODERATOR"), value: `\`${interaction.user.getUsername()}\` (${interaction.user.toString()})`,
value: `\`${interaction.user.getUsername()}\` (${interaction.user.toString()})`, },
}, {
{ name: interaction.translate("common:REASON"),
name: interaction.translate("common:REASON"), value: reason,
value: reason, inline: true,
inline: true, },
}, ]);
]);
/* /*
if (banCount) { if (banCount) {
if (sanctions >= banCount) { if (sanctions >= banCount) {

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 =>
.setDescription(client.translate("common:USER")) option
.setDescriptionLocalizations({ .setName("user")
"uk": client.translate("common:USER", null, "uk-UA"), .setDescription(client.translate("common:USER"))
"ru": client.translate("common:USER", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:USER", null, "uk-UA"),
.setRequired(true)), ru: client.translate("common:USER", null, "ru-RU"),
})
.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(
member: member.user.getUsername(), interaction.translate("moderation/warns:NO_SANCTIONS", {
})); 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 =>
.setDescription(client.translate("music/clips:QUERY")) option
.setDescriptionLocalizations({ .setName("query")
"uk": client.translate("music/clips:QUERY", null, "uk-UA"), .setDescription(client.translate("music/clips:QUERY"))
"ru": client.translate("music/clips:QUERY", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("music/clips:QUERY", null, "uk-UA"),
.setRequired(true) ru: client.translate("music/clips:QUERY", null, "ru-RU"),
.setAutocomplete(true)), })
.setRequired(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,23 +13,26 @@ 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 =>
.setDescription(client.translate("music/loop:OPTION")) option
.setDescriptionLocalizations({ .setName("option")
"uk": client.translate("music/loop:OPTION", null, "uk-UA"), .setDescription(client.translate("music/loop:OPTION"))
"ru": client.translate("music/loop:OPTION", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("music/loop:OPTION", null, "uk-UA"),
.setRequired(true) ru: client.translate("music/loop:OPTION", null, "ru-RU"),
.setChoices( })
{ name: client.translate("music/loop:AUTOPLAY"), value: "3" }, .setRequired(true)
{ name: client.translate("music/loop:QUEUE"), value: "2" }, .setChoices(
{ name: client.translate("music/loop:TRACK"), value: "1" }, { name: client.translate("music/loop:AUTOPLAY"), value: "3" },
{ name: client.translate("music/loop:DISABLE"), value: "0" }, { name: client.translate("music/loop:QUEUE"), value: "2" },
)), { name: client.translate("music/loop:TRACK"), value: "1" },
{ 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 =>
.setDescription(client.translate("music/play:QUERY")) option
.setDescriptionLocalizations({ .setName("query")
"uk": client.translate("music/play:QUERY", null, "uk-UA"), .setDescription(client.translate("music/play:QUERY"))
"ru": client.translate("music/play:QUERY", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("music/play:QUERY", null, "uk-UA"),
.setRequired(true) ru: client.translate("music/play:QUERY", null, "ru-RU"),
.setAutocomplete(true)), })
.setRequired(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,29 +42,12 @@ 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({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
@ -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 =>
.setDescription(client.translate("music/seek:TIME")) option
.setDescriptionLocalizations({ .setName("time")
"uk": client.translate("music/seek:TIME", null, "uk-UA"), .setDescription(client.translate("music/seek:TIME"))
"ru": client.translate("music/seek:TIME", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("music/seek:TIME", null, "uk-UA"),
.setRequired(true)), ru: client.translate("music/seek:TIME", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("music/skipto:POSITION")) option
.setDescriptionLocalizations({ .setName("position")
"uk": client.translate("music/skipto:POSITION", null, "uk-UA"), .setDescription(client.translate("music/skipto:POSITION"))
"ru": client.translate("music/skipto:POSITION", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("music/skipto:POSITION", null, "uk-UA"),
.setRequired(true)), ru: client.translate("music/skipto:POSITION", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("common:INT")) option
.setDescriptionLocalizations({ .setName("int")
"uk": client.translate("common:INT", null, "uk-UA"), .setDescription(client.translate("common:INT"))
"ru": client.translate("common:INT", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:INT", null, "uk-UA"),
.setRequired(true) ru: client.translate("common:INT", null, "ru-RU"),
.setAutocomplete(true)), })
.setRequired(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(
label: tag, JSON.stringify({
value: tag, label: 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,79 +12,101 @@ 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 =>
.setDescription(client.translate("owner/debug:SET")) subcommand
.setDescriptionLocalizations({ .setName("set")
"uk": client.translate("owner/debug:SET", null, "uk-UA"), .setDescription(client.translate("owner/debug:SET"))
"ru": client.translate("owner/debug:SET", null, "ru-RU"),
})
.addStringOption(option => option.setName("type")
.setDescription(client.translate("owner/debug:TYPE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/debug:TYPE", null, "uk-UA"), uk: client.translate("owner/debug:SET", null, "uk-UA"),
"ru": client.translate("owner/debug:TYPE", null, "ru-RU"), ru: client.translate("owner/debug:SET", null, "ru-RU"),
}) })
.setRequired(true) .addStringOption(option =>
.setChoices( option
{ name: client.translate("common:LEVEL"), value: "level" }, .setName("type")
{ name: client.translate("common:XP"), value: "xp" }, .setDescription(client.translate("owner/debug:TYPE"))
{ name: client.translate("common:CREDITS"), value: "credits" }, .setDescriptionLocalizations({
{ name: client.translate("economy/transactions:BANK"), value: "bank" }, uk: client.translate("owner/debug:TYPE", null, "uk-UA"),
{ name: client.translate("common:REP"), value: "rep" }, ru: client.translate("owner/debug:TYPE", null, "ru-RU"),
)) })
.addUserOption(option => option.setName("user") .setRequired(true)
.setDescription(client.translate("common:USER")) .setChoices(
.setDescriptionLocalizations({ { name: client.translate("common:LEVEL"), value: "level" },
"uk": client.translate("common:USER", null, "uk-UA"), { name: client.translate("common:XP"), value: "xp" },
"ru": client.translate("common:USER", null, "ru-RU"), { name: client.translate("common:CREDITS"), value: "credits" },
}) { name: client.translate("economy/transactions:BANK"), value: "bank" },
.setRequired(true)) { name: client.translate("common:REP"), value: "rep" },
.addIntegerOption(option => option.setName("int") ),
.setDescription(client.translate("common:INT")) )
.setDescriptionLocalizations({ .addUserOption(option =>
"uk": client.translate("common:INT", null, "uk-UA"), option
"ru": client.translate("common:INT", null, "ru-RU"), .setName("user")
}) .setDescription(client.translate("common:USER"))
.setRequired(true)), .setDescriptionLocalizations({
uk: client.translate("common:USER", null, "uk-UA"),
ru: client.translate("common:USER", null, "ru-RU"),
})
.setRequired(true),
)
.addIntegerOption(option =>
option
.setName("int")
.setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({
uk: client.translate("common:INT", null, "uk-UA"),
ru: client.translate("common:INT", null, "ru-RU"),
})
.setRequired(true),
),
) )
.addSubcommand(subcommand => subcommand.setName("add") .addSubcommand(subcommand =>
.setDescription(client.translate("owner/debug:ADD")) subcommand
.setDescriptionLocalizations({ .setName("add")
"uk": client.translate("owner/debug:ADD", null, "uk-UA"), .setDescription(client.translate("owner/debug:ADD"))
"ru": client.translate("owner/debug:ADD", null, "ru-RU"),
})
.addStringOption(option => option.setName("type")
.setDescription(client.translate("owner/debug:TYPE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("owner/debug:TYPE", null, "uk-UA"), uk: client.translate("owner/debug:ADD", null, "uk-UA"),
"ru": client.translate("owner/debug:TYPE", null, "ru-RU"), ru: client.translate("owner/debug:ADD", null, "ru-RU"),
}) })
.setRequired(true) .addStringOption(option =>
.setChoices( option
{ name: client.translate("common:LEVEL"), value: "level" }, .setName("type")
{ name: client.translate("common:XP"), value: "xp" }, .setDescription(client.translate("owner/debug:TYPE"))
{ name: client.translate("common:CREDITS"), value: "credits" }, .setDescriptionLocalizations({
{ name: client.translate("economy/transactions:BANK"), value: "bank" }, uk: client.translate("owner/debug:TYPE", null, "uk-UA"),
{ name: client.translate("common:REP"), value: "rep" }, ru: client.translate("owner/debug:TYPE", null, "ru-RU"),
)) })
.addUserOption(option => option.setName("user") .setRequired(true)
.setDescription(client.translate("common:USER")) .setChoices(
.setDescriptionLocalizations({ { name: client.translate("common:LEVEL"), value: "level" },
"uk": client.translate("common:USER", null, "uk-UA"), { name: client.translate("common:XP"), value: "xp" },
"ru": client.translate("common:USER", null, "ru-RU"), { name: client.translate("common:CREDITS"), value: "credits" },
}) { name: client.translate("economy/transactions:BANK"), value: "bank" },
.setRequired(true)) { name: client.translate("common:REP"), value: "rep" },
.addIntegerOption(option => option.setName("int") ),
.setDescription(client.translate("common:INT")) )
.setDescriptionLocalizations({ .addUserOption(option =>
"uk": client.translate("common:INT", null, "uk-UA"), option
"ru": client.translate("common:INT", null, "ru-RU"), .setName("user")
}) .setDescription(client.translate("common:USER"))
.setRequired(true)), .setDescriptionLocalizations({
uk: client.translate("common:USER", null, "uk-UA"),
ru: client.translate("common:USER", null, "ru-RU"),
})
.setRequired(true),
)
.addIntegerOption(option =>
option
.setName("int")
.setDescription(client.translate("common:INT"))
.setDescriptionLocalizations({
uk: client.translate("common:INT", null, "uk-UA"),
ru: client.translate("common:INT", null, "ru-RU"),
})
.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 =>
.setDescription(client.translate("owner/eval:CODE")) option
.setDescriptionLocalizations({ .setName("code")
"uk": client.translate("owner/eval:CODE", null, "uk-UA"), .setDescription(client.translate("owner/eval:CODE"))
"ru": client.translate("owner/eval:CODE", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("owner/eval:CODE", null, "uk-UA"),
.setRequired(true)), ru: client.translate("owner/eval:CODE", null, "ru-RU"),
})
.setRequired(true),
),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true, ownerOnly: true,
@ -48,22 +51,24 @@ 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
if (typeof output !== "string") output = require("util").inspect(output); .then(output => {
if (output.includes(client.token)) output = output.replace(client.token, "T0K3N"); if (typeof output !== "string") output = require("util").inspect(output);
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 => { })
console.log(err); .catch(err => {
err = err.toString(); console.log(err);
if (err.includes(client.token)) err = err.replace(client.token, "T0K3N"); err = err.toString();
if (err.includes(client.token)) err = err.replace(client.token, "T0K3N");
interaction.editReply({ interaction.editReply({
content: "```js\n" + err + "```", content: "```js\n" + err + "```",
});
}); });
});
} }
} }
module.exports = Eval; module.exports = Eval;

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 =>
.setDescription(client.translate("common:COMMAND")) option
.setDescriptionLocalizations({ .setName("command")
"uk": client.translate("common:COMMAND", null, "uk-UA"), .setDescription(client.translate("common:COMMAND"))
"ru": client.translate("common:COMMAND", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:COMMAND", null, "uk-UA"),
.setRequired(true) ru: client.translate("common:COMMAND", null, "ru-RU"),
.setAutocomplete(true)), })
.setRequired(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
name: c.command.name, .map(c => c)
value: c.command.name, .slice(0, 25)
}), .map(c => ({
)); name: 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 =>
.setDescription(client.translate("common:MESSAGE")) option
.setDescriptionLocalizations({ .setName("message")
"uk": client.translate("common:MESSAGE", null, "uk-UA"), .setDescription(client.translate("common:MESSAGE"))
"ru": client.translate("common:MESSAGE", null, "ru-RU"), .setDescriptionLocalizations({
}) uk: client.translate("common:MESSAGE", null, "uk-UA"),
.setRequired(true)) ru: client.translate("common:MESSAGE", null, "ru-RU"),
.addChannelOption(option => option.setName("channel") })
.setDescription(client.translate("common:CHANNEL")) .setRequired(true),
.setDescriptionLocalizations({ )
"uk": client.translate("common:CHANNEL", null, "uk-UA"), .addChannelOption(option =>
"ru": client.translate("common:CHANNEL", null, "ru-RU"), option
})), .setName("channel")
.setDescription(client.translate("common:CHANNEL"))
.setDescriptionLocalizations({
uk: client.translate("common:CHANNEL", null, "uk-UA"),
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,21 +40,11 @@ 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({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
@ -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 =>
.setDescription(client.translate("suncountry/sendmessage:RPINFO")) subcommand
.setDescriptionLocalizations({ .setName("rpinfo")
"uk": client.translate("suncountry/sendmessage:RPINFO", null, "uk-UA"), .setDescription(client.translate("suncountry/sendmessage:RPINFO"))
"ru": client.translate("suncountry/sendmessage:RPINFO", null, "ru-RU"),
})
.addStringOption(option => option.setName("text")
.setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:MESSAGE", null, "uk-UA"), uk: client.translate("suncountry/sendmessage:RPINFO", null, "uk-UA"),
"ru": client.translate("common:MESSAGE", null, "ru-RU"), ru: client.translate("suncountry/sendmessage:RPINFO", null, "ru-RU"),
}) })
.setRequired(true)) .addStringOption(option =>
.addAttachmentOption(option => option.setName("attachment") option
.setDescription(client.translate("common:ATTACHMENT")) .setName("text")
.setDescriptionLocalizations({ .setDescription(client.translate("common:MESSAGE"))
"uk": client.translate("common:ATTACHMENT", null, "uk-UA"), .setDescriptionLocalizations({
"ru": client.translate("common:ATTACHMENT", null, "ru-RU"), uk: client.translate("common:MESSAGE", null, "uk-UA"),
})), ru: client.translate("common:MESSAGE", null, "ru-RU"),
})
.setRequired(true),
)
.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"),
}),
),
) )
.addSubcommand(subcommand => subcommand.setName("instalife") .addSubcommand(subcommand =>
.setDescription(client.translate("suncountry/sendmessage:INSTALIFE")) subcommand
.setDescriptionLocalizations({ .setName("instalife")
"uk": client.translate("suncountry/sendmessage:INSTALIFE", null, "uk-UA"), .setDescription(client.translate("suncountry/sendmessage:INSTALIFE"))
"ru": client.translate("suncountry/sendmessage:INSTALIFE", null, "ru-RU"),
})
.addStringOption(option => option.setName("name")
.setDescription(client.translate("common:USERNAME"))
.setDescriptionLocalizations({ .setDescriptionLocalizations({
"uk": client.translate("common:USERNAME", null, "uk-UA"), uk: client.translate("suncountry/sendmessage:INSTALIFE", null, "uk-UA"),
"ru": client.translate("common:USERNAME", null, "ru-RU"), ru: client.translate("suncountry/sendmessage:INSTALIFE", null, "ru-RU"),
}) })
.setRequired(true)) .addStringOption(option =>
.addStringOption(option => option.setName("text") option
.setDescription(client.translate("common:MESSAGE")) .setName("name")
.setDescriptionLocalizations({ .setDescription(client.translate("common:USERNAME"))
"uk": client.translate("common:MESSAGE", null, "uk-UA"), .setDescriptionLocalizations({
"ru": client.translate("common:MESSAGE", null, "ru-RU"), uk: client.translate("common:USERNAME", null, "uk-UA"),
}) ru: client.translate("common:USERNAME", null, "ru-RU"),
.setRequired(true)) })
.addAttachmentOption(option => option.setName("attachment") .setRequired(true),
.setDescription(client.translate("common:ATTACHMENT")) )
.setDescriptionLocalizations({ .addStringOption(option =>
"uk": client.translate("common:ATTACHMENT", null, "uk-UA"), option
"ru": client.translate("common:ATTACHMENT", null, "ru-RU"), .setName("text")
})), .setDescription(client.translate("common:MESSAGE"))
.setDescriptionLocalizations({
uk: client.translate("common:MESSAGE", null, "uk-UA"),
ru: client.translate("common:MESSAGE", null, "ru-RU"),
})
.setRequired(true),
)
.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,
@ -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", {
attachment: "./assets/img/achievements/achievement_unlocked2.png", name: "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", {
attachment: "./assets/img/achievements/achievement_unlocked7.png", name: "unlocked.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(
server: member.guild.name, canvas,
}, guildData.language), 53, 625, "RubikMonoOne"); client.translate("administration/welcome:IMG_WELCOME", {
server: member.guild.name,
}, guildData.language),
53,
625,
"RubikMonoOne",
);
ctx.fillText(client.translate("administration/welcome:IMG_WELCOME", { ctx.fillText(
server: member.guild.name, client.translate("administration/welcome:IMG_WELCOME", {
}, guildData.language), canvas.width - 700, canvas.height - 70); server: member.guild.name,
}, 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(
extension: "jpg", member.displayAvatarURL({
})); 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(
server: member.guild.name, canvas,
}, guildData.language), 53, 625, "RubikMonoOne"); client.translate("administration/goodbye:IMG_GOODBYE", {
server: member.guild.name,
}, guildData.language),
53,
625,
"RubikMonoOne",
);
ctx.fillText(client.translate("administration/goodbye:IMG_GOODBYE", { ctx.fillText(
server: member.guild.name, client.translate("administration/goodbye:IMG_GOODBYE", {
}, guildData.language), canvas.width - 700, canvas.height - 70); server: member.guild.name,
}, 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(
extension: "png", member.displayAvatarURL({
size: 512, extension: "png",
})); 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", {
attachment: "./assets/img/achievements/achievement_unlocked5.png", name: "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:
return `[${a.name}](${a.url})`; msg.attachments.size > 0
}).join("\n") : `*${message.translate("common:MISSING")}*`, ? msg.attachments
.map(a => {
return `[${a.name}](${a.url})`;
})
.join("\n")
: `*${message.translate("common:MISSING")}*`,
}, },
]) ])
.setFooter({ .setFooter({
@ -69,17 +74,10 @@ 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({
embeds: [embed], embeds: [embed],
@ -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,57 +13,55 @@ 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); const day = userDate.getDate();
const day = userDate.getDate(); const month = userDate.getMonth();
const month = userDate.getMonth(); const year = userDate.getFullYear();
const year = userDate.getFullYear(); const age = currentYear - year;
const age = currentYear - year;
if (currentMonth === month && currentDay === day) { if (currentMonth === month && currentDay === day) {
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)
.setFooter({
text: client.config.embed.footer,
})
.addFields([
{
name: client.translate("economy/birthdate:HAPPY_BIRTHDAY"),
value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", {
name: user.username,
user: user.id,
age: `**${age}** ${client.functions.getNoun(age, client.translate("misc:NOUNS:AGE:1"), client.translate("misc:NOUNS:AGE:2"), client.translate("misc:NOUNS:AGE:5"))}`,
}), }),
}) },
.setColor(client.config.embed.color) ]);
.setFooter({
text: client.config.embed.footer,
})
.addFields([
{
name: client.translate("economy/birthdate:HAPPY_BIRTHDAY"),
value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", {
name: user.username,
user: user.id,
age: `**${age}** ${client.functions.getNoun(age, client.translate("misc:NOUNS:AGE:1"), client.translate("misc:NOUNS:AGE:2"), client.translate("misc:NOUNS:AGE:5"))}`,
}),
},
]);
const msg = await channel.send({ const msg = await channel.send({
embeds: [embed], embeds: [embed],
}); });
await msg.react("🎉"); await msg.react("🎉");
}
} }
} }
}); }
});
} }
} }
}); });
}, null, true, "Europe/Moscow"); },
null,
true,
"Europe/Moscow",
);
}; };

View file

@ -6,14 +6,12 @@ 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: [] } }) for (const user of users) {
.then(users => { if (!client.users.cache.has(user.id)) client.users.fetch(user.id);
for (const user of users) { client.databaseCache.usersReminds.set(user.id, user);
if (!client.users.cache.has(user.id)) client.users.fetch(user.id); }
client.databaseCache.usersReminds.set(user.id, user); });
}
});
setInterval(async function () { setInterval(async function () {
const dateNow = Date.now(); const dateNow = Date.now();
@ -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(
time: moment(r.createdAt).locale(client.defaultLanguage).format("dddd, Do MMMM YYYY, HH:mm:ss"), client.translate("general/remindme:CREATED", {
})) time: moment(r.createdAt).locale(client.defaultLanguage).format("dddd, Do MMMM YYYY, HH:mm:ss"),
}),
)
.addFields([ .addFields([
{ {
name: client.translate("common: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