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}
*/
this.category = (this.dirname ? this.dirname.split(path.sep)[parseInt(this.dirname.split(path.sep).length - 1, 10)] : "Other");
this.category = this.dirname ? this.dirname.split(path.sep)[parseInt(this.dirname.split(path.sep).length - 1, 10)] : "Other";
}
}

View file

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

View file

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

View file

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

View file

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

View file

@ -12,7 +12,7 @@ class ImportMee6 extends BaseCommand {
command: new SlashCommandBuilder()
.setName("importmee6")
.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),
aliases: [],
dirname: __dirname,

View file

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

View file

@ -12,8 +12,8 @@ class Staff extends BaseCommand {
.setName("staff")
.setDescription(client.translate("general/staff:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("general/staff:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/staff:DESCRIPTION", null, "ru-RU"),
uk: client.translate("general/staff:DESCRIPTION", null, "uk-UA"),
ru: client.translate("general/staff:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
aliases: [],
@ -47,11 +47,14 @@ class Staff extends BaseCommand {
.addFields([
{
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"),
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)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,28 +12,31 @@ class Bank extends BaseCommand {
.setName("bank")
.setDescription(client.translate("economy/bank:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("economy/bank:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/bank:DESCRIPTION", null, "ru-RU"),
uk: client.translate("economy/bank:DESCRIPTION", null, "uk-UA"),
ru: client.translate("economy/bank:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
.addStringOption(option => option.setName("option")
.addStringOption(option =>
option
.setName("option")
.setDescription(client.translate("economy/bank:OPTION"))
.setDescriptionLocalizations({
"uk": client.translate("economy/bank:OPTION", null, "uk-UA"),
"ru": client.translate("economy/bank:OPTION", null, "ru-RU"),
uk: client.translate("economy/bank:OPTION", null, "uk-UA"),
ru: client.translate("economy/bank:OPTION", null, "ru-RU"),
})
.setRequired(true)
.setChoices(
{ name: client.translate("economy/bank:DEPOSIT"), value: "deposit" },
{ name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" },
))
.addStringOption(option => option.setName("credits")
.setChoices({ name: client.translate("economy/bank:DEPOSIT"), value: "deposit" }, { name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" }),
)
.addStringOption(option =>
option
.setName("credits")
.setDescription(client.translate("misc:OPTION_NAN_ALL"))
.setDescriptionLocalizations({
"uk": client.translate("misc:OPTION_NAN_ALL", null, "uk-UA"),
"ru": client.translate("misc:OPTION_NAN_ALL", null, "ru-RU"),
uk: client.translate("misc:OPTION_NAN_ALL", null, "uk-UA"),
ru: client.translate("misc:OPTION_NAN_ALL", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
aliases: [],
dirname: __dirname,
ownerOnly: false,
@ -58,7 +61,10 @@ class Bank extends BaseCommand {
if (choice === "deposit") {
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 (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.bankSold += credits;
@ -80,7 +86,10 @@ class Bank extends BaseCommand {
} else {
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 (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 = {
user: interaction.translate("economy/transactions:BANK"),

View file

@ -12,22 +12,27 @@ class Birthdate extends BaseCommand {
.setName("birthdate")
.setDescription(client.translate("economy/birthdate:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("economy/birthdate:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/birthdate:DESCRIPTION", null, "ru-RU"),
uk: client.translate("economy/birthdate:DESCRIPTION", null, "uk-UA"),
ru: client.translate("economy/birthdate:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
.addIntegerOption(option => option.setName("day")
.addIntegerOption(option =>
option
.setName("day")
.setDescription(client.translate("economy/birthdate:DAY"))
.setDescriptionLocalizations({
"uk": client.translate("economy/birthdate:DAY", null, "uk-UA"),
"ru": client.translate("economy/birthdate:DAY", null, "ru-RU"),
uk: client.translate("economy/birthdate:DAY", null, "uk-UA"),
ru: client.translate("economy/birthdate:DAY", null, "ru-RU"),
})
.setRequired(true))
.addIntegerOption(option => option.setName("month")
.setRequired(true),
)
.addIntegerOption(option =>
option
.setName("month")
.setDescription(client.translate("economy/birthdate:MONTH"))
.setDescriptionLocalizations({
"uk": client.translate("economy/birthdate:MONTH", null, "uk-UA"),
"ru": client.translate("economy/birthdate:MONTH", null, "ru-RU"),
uk: client.translate("economy/birthdate:MONTH", null, "uk-UA"),
ru: client.translate("economy/birthdate:MONTH", null, "ru-RU"),
})
.setRequired(true)
.setChoices(
@ -43,14 +48,18 @@ class Birthdate extends BaseCommand {
{ name: client.translate("economy/birthdate:OCTOBER"), value: 10 },
{ name: client.translate("economy/birthdate:NOVEMBER"), value: 11 },
{ name: client.translate("economy/birthdate:DECEMBER"), value: 12 },
))
.addIntegerOption(option => option.setName("year")
),
)
.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"),
uk: client.translate("economy/birthdate:YEAR", null, "uk-UA"),
ru: client.translate("economy/birthdate:YEAR", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
aliases: [],
dirname: __dirname,
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 (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.markModified("birthdate");

View file

@ -12,8 +12,8 @@ class Divorce extends BaseCommand {
.setName("divorce")
.setDescription(client.translate("economy/divorce:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("economy/divorce:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/divorce:DESCRIPTION", null, "ru-RU"),
uk: client.translate("economy/divorce:DESCRIPTION", null, "uk-UA"),
ru: client.translate("economy/divorce:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
aliases: [],
@ -36,7 +36,7 @@ class Divorce extends BaseCommand {
*/
async execute(client, interaction, data) {
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.user.markModified("lover");

View file

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

View file

@ -13,17 +13,20 @@ class Marry extends BaseCommand {
.setName("marry")
.setDescription(client.translate("economy/marry:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("economy/marry:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/marry:DESCRIPTION", null, "ru-RU"),
uk: client.translate("economy/marry:DESCRIPTION", null, "uk-UA"),
ru: client.translate("economy/marry:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
.addUserOption(option => option.setName("user")
.addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"),
uk: client.translate("common:USER", null, "uk-UA"),
ru: client.translate("common:USER", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
aliases: [],
dirname: __dirname,
ownerOnly: false,
@ -58,23 +61,27 @@ class Marry extends BaseCommand {
const receiver = pendings[requester];
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", {
user: user.toString,
});
} 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", {
user: user.toString(),
});
} 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", {
firstUser: member.toString(),
secondUser: user.toString(),
});
} 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", {
firstUser: member.toString(),
secondUser: user.toString(),
@ -84,16 +91,9 @@ class Marry extends BaseCommand {
pendings[interaction.member.id] = member.id;
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.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),
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder().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({
@ -105,7 +105,7 @@ class Marry extends BaseCommand {
});
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 => {
if (i.isButton()) {
@ -137,10 +137,12 @@ class Marry extends BaseCommand {
const messageOptions = {
content: `${member.toString()} :heart: ${interaction.member.toString()}`,
files: [{
files: [
{
name: "achievement_unlocked3.png",
attachment: "./assets/img/achievements/achievement_unlocked3.png",
}],
},
],
};
let sent = false;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,16 +12,19 @@ class Transactions extends BaseCommand {
.setName("transactions")
.setDescription(client.translate("economy/transactions:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("economy/transactions:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/transactions:DESCRIPTION", null, "ru-RU"),
uk: client.translate("economy/transactions:DESCRIPTION", null, "uk-UA"),
ru: client.translate("economy/transactions:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
.addBooleanOption(option => option.setName("clear")
.addBooleanOption(option =>
option
.setName("clear")
.setDescription(client.translate("economy/transactions:CLEAR"))
.setDescriptionLocalizations({
"uk": client.translate("economy/transactions:CLEAR", null, "uk-UA"),
"ru": client.translate("economy/transactions:CLEAR", null, "ru-RU"),
})),
uk: client.translate("economy/transactions:CLEAR", null, "uk-UA"),
ru: client.translate("economy/transactions:CLEAR", null, "ru-RU"),
}),
),
aliases: [],
dirname: __dirname,
ownerOnly: false,
@ -64,20 +67,26 @@ class Transactions extends BaseCommand {
transactions.slice(-20).forEach(t => {
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) {
embed.setDescription(interaction.translate("economy/transactions:NO_TRANSACTIONS"));
} 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"),
inline: true,
},
]);
if (sortedTransactions[1].length > 0) embed.addFields([
if (sortedTransactions[1].length > 0)
embed.addFields([
{
name: interaction.translate("economy/transactions:T_SEND"),
value: sortedTransactions[1].join("\n"),

View file

@ -12,8 +12,8 @@ class Work extends BaseCommand {
.setName("work")
.setDescription(client.translate("economy/work:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("economy/work:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("economy/work:DESCRIPTION", null, "ru-RU"),
uk: client.translate("economy/work:DESCRIPTION", null, "uk-UA"),
ru: client.translate("economy/work:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
aliases: [],
@ -37,13 +37,14 @@ class Work extends BaseCommand {
async execute(client, interaction, data) {
const isInCooldown = data.memberData.cooldowns?.work;
if (isInCooldown) {
if (isInCooldown > Date.now()) return interaction.error("economy/work:COOLDOWN", {
if (isInCooldown > Date.now())
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.markModified("cooldowns");
@ -57,13 +58,7 @@ class Work extends BaseCommand {
})
.setColor(client.config.embed.color);
const award = [
client.customEmojis.letters.a,
client.customEmojis.letters.w,
client.customEmojis.letters.a,
client.customEmojis.letters.r,
client.customEmojis.letters.d,
];
const award = [client.customEmojis.letters.a, client.customEmojis.letters.w, client.customEmojis.letters.a, client.customEmojis.letters.r, client.customEmojis.letters.d];
let won = 200;
if (data.memberData.workStreak >= 5) {
@ -117,13 +112,16 @@ class Work extends BaseCommand {
const messageOptions = {
embeds: [embed],
};
if (!data.userData.achievements.work.achieved) {
data.userData.achievements.work.progress.now += 1;
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",
}];
},
];
data.userData.achievements.work.achieved = true;
}
data.userData.markModified("achievements.work");

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,22 +12,28 @@ class Avatar extends BaseCommand {
.setName("avatar")
.setDescription(client.translate("general/avatar:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("general/avatar:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/avatar:DESCRIPTION", null, "ru-RU"),
uk: client.translate("general/avatar:DESCRIPTION", null, "uk-UA"),
ru: client.translate("general/avatar:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true)
.addUserOption(option => option.setName("user")
.addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"),
}))
.addBooleanOption(option => option.setName("server")
uk: client.translate("common:USER", null, "uk-UA"),
ru: client.translate("common:USER", null, "ru-RU"),
}),
)
.addBooleanOption(option =>
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"),
})),
uk: client.translate("general/avatar:SERVER", null, "uk-UA"),
ru: client.translate("general/avatar:SERVER", null, "ru-RU"),
}),
),
aliases: [],
dirname: __dirname,
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 });
interaction.reply({
files: [{
files: [
{
attachment: avatarURL,
}],
},
],
});
}
}

View file

@ -12,8 +12,8 @@ class Boosters extends BaseCommand {
.setName("boosters")
.setDescription(client.translate("general/boosters:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("general/boosters:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/boosters:DESCRIPTION", null, "ru-RU"),
uk: client.translate("general/boosters:DESCRIPTION", null, "uk-UA"),
ru: client.translate("general/boosters:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
aliases: [],
@ -43,24 +43,11 @@ class Boosters extends BaseCommand {
const embeds = generateBoostersEmbeds(client, interaction, boosters, data.guildData);
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId("boosters_prev_page")
.setStyle(ButtonStyle.Primary)
.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("⏹️"),
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("boosters_prev_page").setStyle(ButtonStyle.Primary).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({
@ -70,7 +57,7 @@ class Boosters extends BaseCommand {
});
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 => {
if (i.isButton()) {
@ -110,7 +97,7 @@ class Boosters extends BaseCommand {
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]) {
currentPage = collected.first().content - 1;
interaction.editReply({
@ -159,7 +146,10 @@ function generateBoostersEmbeds(client, interaction, boosters, guildData) {
let k = 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;
k += 10;

View file

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

View file

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

View file

@ -13,17 +13,20 @@ class Minecraft extends BaseCommand {
.setName("minecraft")
.setDescription(client.translate("general/minecraft:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("general/minecraft:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/minecraft:DESCRIPTION", null, "ru-RU"),
uk: client.translate("general/minecraft:DESCRIPTION", null, "uk-UA"),
ru: client.translate("general/minecraft:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true)
.addStringOption(option => option.setName("ip")
.addStringOption(option =>
option
.setName("ip")
.setDescription(client.translate("common:IP"))
.setDescriptionLocalizations({
"uk": client.translate("common:IP", null, "uk-UA"),
"ru": client.translate("common:IP", null, "ru-RU"),
uk: client.translate("common:IP", null, "uk-UA"),
ru: client.translate("common:IP", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
aliases: [],
dirname: __dirname,
ownerOnly: false,
@ -77,7 +80,17 @@ class Minecraft extends BaseCommand {
},
{
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"),
@ -88,7 +101,6 @@ class Minecraft extends BaseCommand {
name: interaction.translate("general/minecraft:FIELD_VERSION"),
value: res.raw.vanilla.raw.version.name,
inline: true,
},
{
name: interaction.translate("general/minecraft:FIELD_PING"),

View file

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

View file

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

View file

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

View file

@ -12,8 +12,8 @@ class Serverinfo extends BaseCommand {
.setName("serverinfo")
.setDescription(client.translate("general/serverinfo:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("general/serverinfo:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/serverinfo:DESCRIPTION", null, "ru-RU"),
uk: client.translate("general/serverinfo:DESCRIPTION", null, "uk-UA"),
ru: client.translate("general/serverinfo:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
aliases: [],
@ -63,8 +63,20 @@ class Serverinfo extends BaseCommand {
},
{
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"))}` +
"\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"))}`,
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"),
)}` +
"\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,
},
{
@ -89,9 +101,27 @@ class Serverinfo extends BaseCommand {
},
{
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"))}` +
"\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"))}`,
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"),
)}` +
"\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,
},
])

View file

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

View file

@ -12,8 +12,8 @@ class Stats extends BaseCommand {
.setName("stats")
.setDescription(client.translate("general/stats:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("general/stats:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/stats:DESCRIPTION", null, "ru-RU"),
uk: client.translate("general/stats:DESCRIPTION", null, "uk-UA"),
ru: client.translate("general/stats:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true),
aliases: [],
@ -80,7 +80,12 @@ class Stats extends BaseCommand {
{
name: client.customEmojis.voice + " " + interaction.translate("general/stats:MUSIC_TITLE"),
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"),
)}`,
}),
},
{

View file

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

View file

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

View file

@ -13,17 +13,20 @@ class Whois extends BaseCommand {
.setName("whois")
.setDescription(client.translate("general/whois:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("general/whois:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("general/whois:DESCRIPTION", null, "ru-RU"),
uk: client.translate("general/whois:DESCRIPTION", null, "uk-UA"),
ru: client.translate("general/whois:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true)
.addStringOption(option => option.setName("ip")
.addStringOption(option =>
option
.setName("ip")
.setDescription(client.translate("common:IP"))
.setDescriptionLocalizations({
"uk": client.translate("common:IP", null, "uk-UA"),
"ru": client.translate("common:IP", null, "ru-RU"),
uk: client.translate("common:IP", null, "uk-UA"),
ru: client.translate("common:IP", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
aliases: [],
dirname: __dirname,
ownerOnly: false,
@ -51,9 +54,11 @@ class Whois extends BaseCommand {
if (whois.status === "fail") return interaction.editReply({ content: interaction.translate("general/whois:ERROR", { ip }) });
const embed = new EmbedBuilder()
.setTitle(interaction.translate("general/whois:INFO_ABOUT", {
.setTitle(
interaction.translate("general/whois:INFO_ABOUT", {
ip,
}))
}),
)
.setFooter({
text: client.config.embed.footer,
})

View file

@ -14,8 +14,8 @@ class Checkjar extends BaseCommand {
.setName("checkjar")
.setDescription(client.translate("iat/checkjar:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("iat/checkjar:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("iat/checkjar:DESCRIPTION", null, "ru-RU"),
uk: client.translate("iat/checkjar:DESCRIPTION", null, "uk-UA"),
ru: client.translate("iat/checkjar:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
aliases: [],
@ -47,7 +47,7 @@ class Checkjar extends BaseCommand {
},
}).then(res => res.json());
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",
headers: {
"X-Token": client.config.apiKeys.monobankApiKey,

View file

@ -12,30 +12,39 @@ class Clear extends BaseCommand {
.setName("clear")
.setDescription(client.translate("moderation/clear:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/clear:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("moderation/clear:DESCRIPTION", null, "ru-RU"),
uk: client.translate("moderation/clear:DESCRIPTION", null, "uk-UA"),
ru: client.translate("moderation/clear:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
.addStringOption(option => option.setName("option")
.addStringOption(option =>
option
.setName("option")
.setDescription(client.translate("moderation/clear:OPTION"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/clear:OPTION", null, "uk-UA"),
"ru": client.translate("moderation/clear:OPTION", null, "ru-RU"),
uk: client.translate("moderation/clear:OPTION", null, "uk-UA"),
ru: client.translate("moderation/clear:OPTION", null, "ru-RU"),
})
.setRequired(true))
.addUserOption(option => option.setName("user")
.setRequired(true),
)
.addUserOption(option =>
option
.setName("user")
.setDescription(client.translate("common:USER"))
.setDescriptionLocalizations({
"uk": client.translate("common:USER", null, "uk-UA"),
"ru": client.translate("common:USER", null, "ru-RU"),
}))
.addStringOption(option => option.setName("id")
uk: client.translate("common:USER", null, "uk-UA"),
ru: client.translate("common:USER", 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"),
})),
uk: client.translate("common:USER_ID", null, "uk-UA"),
ru: client.translate("common:USER_ID", null, "ru-RU"),
}),
),
aliases: [],
dirname: __dirname,
ownerOnly: false,
@ -62,16 +71,9 @@ class Clear extends BaseCommand {
user_id = interaction.options.getString("id");
if (option === "all") {
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.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),
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder().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({
@ -80,7 +82,7 @@ class Clear extends BaseCommand {
});
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 => {
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) 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) {
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"))}`,
user: member && member.user.getUsername() || user_id,
user: (member && member.user.getUsername()) || user_id,
}, { edit: true });
} else {
interaction.replyT("moderation/clear:CLEARED", {

View file

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

View file

@ -13,87 +13,116 @@ class Giveaway extends BaseCommand {
.setName("giveaway")
.setDescription(client.translate("moderation/giveaway:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:DESCRIPTION", null, "ru-RU"),
uk: client.translate("moderation/giveaway:DESCRIPTION", null, "uk-UA"),
ru: client.translate("moderation/giveaway:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
.addSubcommand(subcommand => subcommand.setName("create")
.addSubcommand(subcommand =>
subcommand
.setName("create")
.setDescription(client.translate("moderation/giveaway:CREATE"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:CREATE", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:CREATE", null, "ru-RU"),
uk: client.translate("moderation/giveaway:CREATE", null, "uk-UA"),
ru: client.translate("moderation/giveaway:CREATE", null, "ru-RU"),
})
.addStringOption(option => option.setName("duration")
.addStringOption(option =>
option
.setName("duration")
.setDescription(client.translate("common:DURATION"))
.setDescriptionLocalizations({
"uk": client.translate("common:DURATION", null, "uk-UA"),
"ru": client.translate("common:DURATION", null, "ru-RU"),
uk: client.translate("common:DURATION", null, "uk-UA"),
ru: client.translate("common:DURATION", null, "ru-RU"),
})
.setRequired(true))
.addIntegerOption(option => option.setName("winners_count")
.setRequired(true),
)
.addIntegerOption(option =>
option
.setName("winners_count")
.setDescription(client.translate("moderation/giveaway:WINNERS_COUNT"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:WINNERS_COUNT", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:WINNERS_COUNT", null, "ru-RU"),
uk: client.translate("moderation/giveaway:WINNERS_COUNT", null, "uk-UA"),
ru: client.translate("moderation/giveaway:WINNERS_COUNT", null, "ru-RU"),
})
.setRequired(true))
.addStringOption(option => option.setName("prize")
.setRequired(true),
)
.addStringOption(option =>
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"),
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")
.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"),
uk: client.translate("moderation/giveaway:ISDROP", null, "uk-UA"),
ru: client.translate("moderation/giveaway:ISDROP", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
)
.addSubcommand(subcommand => subcommand.setName("reroll")
.addSubcommand(subcommand =>
subcommand
.setName("reroll")
.setDescription(client.translate("moderation/giveaway:REROLL"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:REROLL", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:REROLL", null, "ru-RU"),
uk: client.translate("moderation/giveaway:REROLL", null, "uk-UA"),
ru: client.translate("moderation/giveaway:REROLL", null, "ru-RU"),
})
.addStringOption(option => option.setName("giveaway_id")
.addStringOption(option =>
option
.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
uk: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
ru: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
)
.addSubcommand(subcommand => subcommand.setName("end")
.addSubcommand(subcommand =>
subcommand
.setName("end")
.setDescription(client.translate("moderation/giveaway:END"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:END", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:END", null, "ru-RU"),
uk: client.translate("moderation/giveaway:END", null, "uk-UA"),
ru: client.translate("moderation/giveaway:END", null, "ru-RU"),
})
.addStringOption(option => option.setName("giveaway_id")
.addStringOption(option =>
option
.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
uk: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
ru: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
)
.addSubcommand(subcommand => subcommand.setName("delete")
.addSubcommand(subcommand =>
subcommand
.setName("delete")
.setDescription(client.translate("moderation/giveaway:DELETE"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:DELETE", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:DELETE", null, "ru-RU"),
uk: client.translate("moderation/giveaway:DELETE", null, "uk-UA"),
ru: client.translate("moderation/giveaway:DELETE", null, "ru-RU"),
})
.addStringOption(option => option.setName("giveaway_id")
.addStringOption(option =>
option
.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
"ru": client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
uk: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "uk-UA"),
ru: client.translate("moderation/giveaway:GIVEAWAY_ID", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
),
aliases: [],
dirname: __dirname,
@ -129,7 +158,8 @@ class Giveaway extends BaseCommand {
const prize = interaction.options.getString("prize");
const isdrop = interaction.options.getBoolean("isdrop");
client.giveawaysManager.start(interaction.channel, {
client.giveawaysManager
.start(interaction.channel, {
duration: ms(duration),
winnerCount: winnersCount,
prize: prize,
@ -149,20 +179,24 @@ class Giveaway extends BaseCommand {
endedAt: interaction.translate("moderation/giveaway:END_AT"),
hostedBy: interaction.translate("moderation/giveaway:HOSTED_BY"),
},
}).then(() => {
})
.then(() => {
return interaction.success("moderation/giveaway:GIVEAWAY_CREATED", null, { ephemeral: true });
});
} else if (command === "reroll") {
const giveaway_id = interaction.options.getString("giveaway_id");
client.giveawaysManager.reroll(giveaway_id, {
client.giveawaysManager
.reroll(giveaway_id, {
messages: {
congrat: interaction.translate("moderation/giveaway:REROLL_CONGRAT"),
error: interaction.translate("moderation/giveaway:REROLL_ERROR"),
},
}).then(() => {
})
.then(() => {
return interaction.success("moderation/giveaway:GIVEAWAY_REROLLED");
}).catch(() => {
})
.catch(() => {
return interaction.error("moderation/giveaway:NOT_FOUND_ENDED", {
messageId: giveaway_id,
}, { ephemeral: true });
@ -181,9 +215,12 @@ class Giveaway extends BaseCommand {
} else if (command === "delete") {
const giveaway_id = interaction.options.getString("giveaway_id");
client.giveawaysManager.delete(giveaway_id).then(() => {
client.giveawaysManager
.delete(giveaway_id)
.then(() => {
return interaction.success("moderation/giveaway:GIVEAWAY_DELETED");
}).catch(() => {
})
.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")
.setDescription(client.translate("moderation/poll:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/poll:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("moderation/poll:DESCRIPTION", null, "ru-RU"),
uk: client.translate("moderation/poll:DESCRIPTION", null, "uk-UA"),
ru: client.translate("moderation/poll:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageMessages)
.addStringOption(option => option.setName("question")
.addStringOption(option =>
option
.setName("question")
.setDescription(client.translate("moderation/poll:QUESTION"))
.setDescriptionLocalizations({
"uk": client.translate("moderation/poll:QUESTION", null, "uk-UA"),
"ru": client.translate("moderation/poll:QUESTION", null, "ru-RU"),
uk: client.translate("moderation/poll:QUESTION", null, "uk-UA"),
ru: client.translate("moderation/poll:QUESTION", null, "ru-RU"),
})
.setRequired(true)),
.setRequired(true),
),
aliases: [],
dirname: __dirname,
ownerOnly: false,
@ -45,27 +48,13 @@ class Poll extends BaseCommand {
async execute(client, interaction) {
const question = interaction.options.getString("question");
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId("poll_everyone")
.setLabel("@everyone")
.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),
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("poll_everyone").setLabel("@everyone").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({
content: interaction.translate("moderation/poll:SELECT_MENTION"),
ephemeral: true,
@ -74,7 +63,7 @@ class Poll extends BaseCommand {
let mention = null;
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 => {
if (i.isButton()) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -13,15 +13,17 @@ class Loop extends BaseCommand {
.setName("loop")
.setDescription(client.translate("music/loop:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("music/loop:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/loop:DESCRIPTION", null, "ru-RU"),
uk: client.translate("music/loop:DESCRIPTION", null, "uk-UA"),
ru: client.translate("music/loop:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
.addStringOption(option => option.setName("option")
.addStringOption(option =>
option
.setName("option")
.setDescription(client.translate("music/loop:OPTION"))
.setDescriptionLocalizations({
"uk": client.translate("music/loop:OPTION", null, "uk-UA"),
"ru": client.translate("music/loop:OPTION", null, "ru-RU"),
uk: client.translate("music/loop:OPTION", null, "uk-UA"),
ru: client.translate("music/loop:OPTION", null, "ru-RU"),
})
.setRequired(true)
.setChoices(
@ -29,7 +31,8 @@ class Loop extends BaseCommand {
{ 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: [],
dirname: __dirname,
ownerOnly: false,
@ -56,17 +59,11 @@ class Loop extends BaseCommand {
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true });
const type = interaction.options.getString("option"),
mode = type === "3" ? QueueRepeatMode.AUTOPLAY :
type === "2" ? QueueRepeatMode.QUEUE :
type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
mode = type === "3" ? QueueRepeatMode.AUTOPLAY : type === "2" ? QueueRepeatMode.QUEUE : type === "1" ? QueueRepeatMode.TRACK : QueueRepeatMode.OFF;
queue.setRepeatMode(mode);
interaction.success(`music/loop:${
type === "3" ? "AUTOPLAY_ENABLED" :
type === "2" ? "QUEUE_ENABLED" :
type === "1" ? "TRACK_ENABLED" : "LOOP_DISABLED"
}`);
interaction.success(`music/loop:${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")
.setDescription(client.translate("music/nowplaying:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("music/nowplaying:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/nowplaying:DESCRIPTION", null, "ru-RU"),
uk: client.translate("music/nowplaying:DESCRIPTION", null, "uk-UA"),
ru: client.translate("music/nowplaying:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
aliases: [],
@ -77,9 +77,13 @@ class Nowplaying extends BaseCommand {
{
name: "\u200b",
value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${
queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") :
queue.repeatMode === QueueRepeatMode.QUEUE ? interaction.translate("music/nowplaying:QUEUE") :
queue.repeatMode === QueueRepeatMode.TRACK ? interaction.translate("music/nowplaying:TRACK") : interaction.translate("common:DISABLED")
queue.repeatMode === QueueRepeatMode.AUTOPLAY
? interaction.translate("music/nowplaying:AUTOPLAY")
: 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")
.setDescription(client.translate("music/play:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("music/play:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/play:DESCRIPTION", null, "ru-RU"),
uk: client.translate("music/play:DESCRIPTION", null, "uk-UA"),
ru: client.translate("music/play:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false)
.addStringOption(option => option.setName("query")
.addStringOption(option =>
option
.setName("query")
.setDescription(client.translate("music/play:QUERY"))
.setDescriptionLocalizations({
"uk": client.translate("music/play:QUERY", null, "uk-UA"),
"ru": client.translate("music/play:QUERY", null, "ru-RU"),
uk: client.translate("music/play:QUERY", null, "uk-UA"),
ru: client.translate("music/play:QUERY", null, "ru-RU"),
})
.setRequired(true)
.setAutocomplete(true)),
.setAutocomplete(true),
),
aliases: [],
dirname: __dirname,
ownerOnly: false,
@ -96,10 +99,10 @@ class Play extends BaseCommand {
return interaction.respond(
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,
}),
));
})),
);
}
}

View file

@ -13,8 +13,8 @@ class Queue extends BaseCommand {
.setName("queue")
.setDescription(client.translate("music/queue:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("music/queue:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("music/queue:DESCRIPTION", null, "ru-RU"),
uk: client.translate("music/queue:DESCRIPTION", null, "uk-UA"),
ru: client.translate("music/queue:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(false),
aliases: [],
@ -42,28 +42,11 @@ class Queue extends BaseCommand {
let currentPage = 0;
let embeds = generateQueueEmbeds(interaction, queue);
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId("queue_prev_page")
.setLabel(interaction.translate("music/queue:PREV_PAGE"))
.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("⏹️"),
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("queue_prev_page").setLabel(interaction.translate("music/queue:PREV_PAGE")).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({
@ -73,7 +56,7 @@ class Queue extends BaseCommand {
});
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 => {
if (i.isButton()) {
@ -116,7 +99,7 @@ class Queue extends BaseCommand {
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]) {
currentPage = collected.first().content - 1;
interaction.editReply({
@ -168,11 +151,19 @@ function generateQueueEmbeds(interaction, queue) {
.setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING"))
.setThumbnail(currentTrack.thumbnail)
.setColor(interaction.client.config.embed.color)
.setDescription(`${interaction.translate("music/nowplaying:REPEAT")}: \`${
queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") :
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")}`)
.setDescription(
`${interaction.translate("music/nowplaying:REPEAT")}: \`${
queue.repeatMode === QueueRepeatMode.AUTOPLAY
? interaction.translate("music/nowplaying:AUTOPLAY")
: 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();
embeds.push(embed);
@ -190,11 +181,19 @@ function generateQueueEmbeds(interaction, queue) {
.setTitle(interaction.translate("music/nowplaying:CURRENTLY_PLAYING"))
.setThumbnail(currentTrack.thumbnail)
.setColor(interaction.client.config.embed.color)
.setDescription(`${interaction.translate("music/nowplaying:REPEAT")}: \`${
queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") :
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}`)
.setDescription(
`${interaction.translate("music/nowplaying:REPEAT")}: \`${
queue.repeatMode === QueueRepeatMode.AUTOPLAY
? interaction.translate("music/nowplaying:AUTOPLAY")
: 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();
embeds.push(embed);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -13,8 +13,8 @@ class NSFW extends BaseCommand {
.setName("nsfw")
.setDescription(client.translate("nsfw/nsfw:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("nsfw/nsfw:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("nsfw/nsfw:DESCRIPTION", null, "ru-RU"),
uk: client.translate("nsfw/nsfw:DESCRIPTION", null, "uk-UA"),
ru: client.translate("nsfw/nsfw:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true),
aliases: [],
@ -41,19 +41,15 @@ class NSFW extends BaseCommand {
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 =>
JSON.parse(JSON.stringify({
JSON.parse(
JSON.stringify({
label: tag,
value: tag,
})),
}),
),
);
const row = new ActionRowBuilder()
.addComponents(
new StringSelectMenuBuilder()
.setCustomId("nsfw_select")
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
.addOptions(tags),
);
const row = new ActionRowBuilder().addComponents(new StringSelectMenuBuilder().setCustomId("nsfw_select").setPlaceholder(client.translate("common:NOTHING_SELECTED")).addOptions(tags));
const msg = await interaction.editReply({
content: interaction.translate("common:AVAILABLE_OPTIONS"),
@ -63,7 +59,7 @@ class NSFW extends BaseCommand {
});
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 => {
if (i.isStringSelectMenu() && i.customId === "nsfw_select") {

View file

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

View file

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

View file

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

View file

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

View file

@ -12,8 +12,8 @@ class Servers extends BaseCommand {
.setName("servers")
.setDescription(client.translate("owner/servers:DESCRIPTION"))
.setDescriptionLocalizations({
"uk": client.translate("owner/servers:DESCRIPTION", null, "uk-UA"),
"ru": client.translate("owner/servers:DESCRIPTION", null, "ru-RU"),
uk: client.translate("owner/servers:DESCRIPTION", null, "uk-UA"),
ru: client.translate("owner/servers:DESCRIPTION", null, "ru-RU"),
})
.setDMPermission(true),
aliases: [],
@ -40,20 +40,10 @@ class Servers extends BaseCommand {
let currentPage = 0;
const embeds = generateServersEmbeds(interaction, client.guilds.cache);
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId("servers_prev_page")
.setStyle(ButtonStyle.Primary)
.setEmoji("⬅️"),
new ButtonBuilder()
.setCustomId("servers_next_page")
.setStyle(ButtonStyle.Primary)
.setEmoji("➡️"),
new ButtonBuilder()
.setCustomId("servers_stop")
.setStyle(ButtonStyle.Danger)
.setEmoji("⏹️"),
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder().setCustomId("servers_prev_page").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({
@ -63,7 +53,7 @@ class Servers extends BaseCommand {
});
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 => {
if (i.isButton()) {
@ -119,11 +109,24 @@ function generateServersEmbeds(interaction, servers) {
let k = 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;
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()
.setColor(interaction.client.config.embed.color)

View file

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

View file

@ -2,7 +2,7 @@ module.exports = {
/* The token of your Discord Bot */
token: "XXXXXXXXXXX",
/* ID of Bot's user */
user: "XXXXXXXXXXX",
userId: "XXXXXXXXXXX",
/* Set to true for production */
production: true,
/* 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({
port: client.config.dashboard.port,
client: {
id: client.config.user,
id: client.config.userId,
secret: client.config.dashboard.secret,
},
SSL: {
@ -57,7 +57,7 @@ module.exports.load = async client => {
requiredPermissions: PermissionsBitField.Flags.ViewChannel,
minimizedConsoleLogs: true,
invite: {
clientId: client.config.user,
clientId: client.config.userId,
scopes: ["bot", "applications.commands"],
permissions: "8",
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) {
const args = {
content: interaction.user.toString(),
files: [{
files: [
{
name: "achievement_unlocked2.png",
attachment: "./assets/img/achievements/achievement_unlocked2.png",
}],
},
],
};
userData.achievements.firstCommand.progress.now = 1;

View file

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

View file

@ -79,13 +79,23 @@ class GuildMemberAdd extends BaseEvent {
ctx.fillText(member.user.username, canvas.width - 670, canvas.height - 250);
// Draw server name
ctx.font = applyText(canvas, client.translate("administration/welcome:IMG_WELCOME", {
ctx.font = applyText(
canvas,
client.translate("administration/welcome:IMG_WELCOME", {
server: member.guild.name,
}, guildData.language), 53, 625, "RubikMonoOne");
}, guildData.language),
53,
625,
"RubikMonoOne",
);
ctx.fillText(client.translate("administration/welcome:IMG_WELCOME", {
ctx.fillText(
client.translate("administration/welcome:IMG_WELCOME", {
server: member.guild.name,
}, guildData.language), canvas.width - 700, canvas.height - 70);
}, guildData.language),
canvas.width - 700,
canvas.height - 70,
);
// Draw discriminator
ctx.font = "35px RubikMonoOne";
@ -117,9 +127,11 @@ class GuildMemberAdd extends BaseEvent {
ctx.closePath();
ctx.clip();
const avatar = await Canvas.loadImage(member.displayAvatarURL({
const avatar = await Canvas.loadImage(
member.displayAvatarURL({
extension: "jpg",
}));
}),
);
ctx.drawImage(avatar, 45, 90, 270, 270);
const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "welcome-image.png" });
@ -128,8 +140,7 @@ class GuildMemberAdd extends BaseEvent {
content: message,
files: [attachment],
});
} else
channel.send({ content: message });
} else 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);
// Draw server name
ctx.font = applyText(canvas, client.translate("administration/goodbye:IMG_GOODBYE", {
ctx.font = applyText(
canvas,
client.translate("administration/goodbye:IMG_GOODBYE", {
server: member.guild.name,
}, guildData.language), 53, 625, "RubikMonoOne");
}, guildData.language),
53,
625,
"RubikMonoOne",
);
ctx.fillText(client.translate("administration/goodbye:IMG_GOODBYE", {
ctx.fillText(
client.translate("administration/goodbye:IMG_GOODBYE", {
server: member.guild.name,
}, guildData.language), canvas.width - 700, canvas.height - 70);
}, guildData.language),
canvas.width - 700,
canvas.height - 70,
);
// Draw discriminator
ctx.font = "35px RubikMonoOne";
@ -91,7 +101,11 @@ class GuildMemberRemove extends BaseEvent {
// Draw membercount
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
ctx.fillStyle = "#FFFFFF";
@ -115,10 +129,12 @@ class GuildMemberRemove extends BaseEvent {
ctx.closePath();
ctx.clip();
const avatar = await Canvas.loadImage(member.displayAvatarURL({
const avatar = await Canvas.loadImage(
member.displayAvatarURL({
extension: "png",
size: 512,
}));
}),
);
ctx.drawImage(avatar, 45, 90, 270, 270);
const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "goodbye-image.png" });
@ -127,8 +143,7 @@ class GuildMemberRemove extends BaseEvent {
content: message,
files: [attachment],
});
} else
channel.send({ content: message });
} else 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 (newMember?.roles.cache.some(r => r.id === "940149470975365191")) {
const userData = await client.findOrCreateUser({
id: newMember.id,
});
const userData = await client.findOrCreateUser({ id: newMember.id });
userData.achievements.tip.progress.now = 1;
userData.achievements.tip.achieved = true;
@ -30,10 +28,12 @@ class GuildMemberUpdate extends BaseEvent {
await userData.save();
newMember.send({
files: [{
files: [
{
name: "achievement_unlocked5.png",
attachment: "./assets/img/achievements/achievement_unlocked5.png",
}],
},
],
});
}
}

View file

@ -58,9 +58,14 @@ class MessageCreate extends BaseEvent {
.addFields([
{
name: message.translate("misc:QUOTE_ATTACHED"),
value: msg.attachments.size > 0 ? msg.attachments.map(a => {
value:
msg.attachments.size > 0
? msg.attachments
.map(a => {
return `[${a.name}](${a.url})`;
}).join("\n") : `*${message.translate("common:MISSING")}*`,
})
.join("\n")
: `*${message.translate("common:MISSING")}*`,
},
])
.setFooter({
@ -69,16 +74,9 @@ class MessageCreate extends BaseEvent {
.setColor(client.config.embed.color)
.setTimestamp(msg.createdTimestamp);
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel(message.translate("misc:QUOTE_JUMP"))
.setStyle(ButtonStyle.Link)
.setURL(msg.url),
new ButtonBuilder()
.setCustomId("quote_delete")
.setEmoji("1102200816582000750")
.setStyle(ButtonStyle.Danger),
const row = new ActionRowBuilder().addComponents(
new ButtonBuilder().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({
@ -87,18 +85,17 @@ class MessageCreate extends BaseEvent {
});
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 => {
if (i.isButton() && i.customId === "quote_delete")
if (reply.deletable) await reply.delete();
if (i.isButton() && i.customId === "quote_delete") if (reply.deletable) reply.delete();
});
}
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 (!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();
}
@ -114,9 +111,7 @@ class MessageCreate extends BaseEvent {
}
message.mentions.users.forEach(async u => {
const userData = await client.findOrCreateUser({
id: u.id,
});
const userData = await client.findOrCreateUser({ id: u.id });
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),
isInCooldown = xpCooldown[msg.author.id];
if (isInCooldown)
if (isInCooldown > Date.now()) return;
if (isInCooldown) 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;
const won = client.functions.randomNum(1, 2);

View file

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

View file

@ -24,9 +24,7 @@ module.exports.update = function (client) {
// })
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()];
text += `### ${cat} (${cmds.length} ${client.functions.getNoun(cmds.length, "команда", "команды", "команд")})\n\n`;

View file

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

View file

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

View file

@ -18,7 +18,7 @@ module.exports = {
async createInvite(client, guildId) {
const guild = client.guilds.cache.get(guildId);
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";
},
@ -46,7 +46,7 @@ module.exports = {
return array.sort(function (a, b) {
const x = a[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 = [];
pArray.forEach(element => array.push(element));
let currentIndex = array.length,
temporaryValue, randomIndex;
temporaryValue,
randomIndex;
while (currentIndex !== 0) {
randomIndex = Math.floor(Math.random() * currentIndex);
@ -82,7 +83,6 @@ module.exports = {
randomNum(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1) + min);
},
@ -97,10 +97,7 @@ module.exports = {
printDate(client, date, format = "", locale = client.defaultLanguage) {
const languageData = client.languages.find(language => language.name === locale);
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) {
const languageData = client.languages.find(language => language.name === locale);
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) {
return (dateTimePad((tDate.getDate()), 2) + "-" +
dateTimePad((tDate.getMonth() + 1), 2) + "-" +
dateTimePad(tDate.getFullYear(), 2) + " " +
dateTimePad(tDate.getHours(), 2) + ":" +
dateTimePad(tDate.getMinutes(), 2) + ":" +
dateTimePad(tDate.getSeconds(), 2) + "." +
dateTimePad(tDate.getMilliseconds(), 3));
return (
dateTimePad(tDate.getDate(), 2) +
"-" +
dateTimePad(tDate.getMonth() + 1, 2) +
"-" +
dateTimePad(tDate.getFullYear(), 2) +
" " +
dateTimePad(tDate.getHours(), 2) +
":" +
dateTimePad(tDate.getMinutes(), 2) +
":" +
dateTimePad(tDate.getSeconds(), 2) +
"." +
dateTimePad(tDate.getMilliseconds(), 3)
);
}
module.exports = class Logger {

View file

@ -20,10 +20,8 @@ class Mee6Api {
* @returns {String} ID of the guild or user.
*/
static getId(guildOrUser) {
if (typeof guildOrUser === "string")
return guildOrUser;
else if (typeof guildOrUser.id === "string")
return guildOrUser.id;
if (typeof guildOrUser === "string") return guildOrUser;
else if (typeof guildOrUser.id === "string") return guildOrUser.id;
else throw new Error("Invalid Id specified.");
}
@ -35,6 +33,7 @@ class Mee6Api {
static async getRoleRewards(guild) {
const guildId = this.getId(guild);
const { role_rewards } = await fetchMee6(`${guildId}?limit=1`);
return role_rewards.sort((a, b) => a.rank - b.rank).map(({ rank, ...rest }) => ({ ...rest, level: rank }));
}
@ -52,11 +51,17 @@ class Mee6Api {
const { id, level, username, discriminator, avatar, message_count: messageCount } = user;
const avatarUrl = `https://cdn.discordapp.com/avatars/${id}/${avatar}`;
const [userXp, levelXp, totalXp] = user.detailed_xp;
return {
id, level, username, discriminator, avatarUrl, messageCount,
id,
level,
username,
discriminator,
avatarUrl,
messageCount,
tag: `${username}#${discriminator}`,
xp: { userXp, levelXp, totalXp },
rank: (limit * page) + index + 1,
rank: limit * page + index + 1,
};
});
}
@ -68,13 +73,16 @@ class Mee6Api {
*/
static async getLeaderboard(guild) {
const leaderboard = [];
let pageNumber = 0, page;
let pageNumber = 0,
page;
while (true) {
page = await this.getLeaderboardPage(guild, 1000, pageNumber);
leaderboard.push(...page);
if (page.length < 1000) break;
pageNumber += 1;
}
return leaderboard;
}
@ -86,13 +94,17 @@ class Mee6Api {
*/
static async getUserXp(guild, user) {
const userId = this.getId(user);
let pageNumber = 0, page, userInfo;
let pageNumber = 0,
page,
userInfo;
while (true) {
page = await this.getLeaderboardPage(guild, 1000, pageNumber);
userInfo = page.find(u => u.id === userId);
if (page.length < 1000 || userInfo) break;
pageNumber += 1;
}
return userInfo;
}
}

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