Новые правила линтера и изменения под правила

This commit is contained in:
JonnyBro 2022-12-15 21:02:38 +05:00
parent d75cf0ae32
commit e31297120c
110 changed files with 984 additions and 1009 deletions

View file

@ -14,31 +14,31 @@ module.exports = mongoose.model("Guild", new Schema({
enabled: false, enabled: false,
message: null, message: null,
channel: null, channel: null,
withImage: null withImage: null,
}, },
goodbye: { goodbye: {
enabled: false, enabled: false,
message: null, message: null,
channel: null, channel: null,
withImage: null withImage: null,
}, },
autorole: { autorole: {
enabled: false, enabled: false,
role: null role: null,
}, },
automod: { automod: {
enabled: false, enabled: false,
ignored: [] ignored: [],
}, },
warnsSanctions: { warnsSanctions: {
kick: false, kick: false,
ban: false ban: false,
}, },
news: false, news: false,
suggestions: false, suggestions: false,
modlogs: false, modlogs: false,
birthdays: false, birthdays: false,
reports: false reports: false,
}}, } },
casesCount: { type: Number, default: 0 }, casesCount: { type: Number, default: 0 },
})); }));

View file

@ -50,21 +50,20 @@ class JaBa extends Client {
playdl.getFreeClientID().then(id => playdl.setToken({ playdl.getFreeClientID().then(id => playdl.setToken({
soundcloud: { soundcloud: {
client_id: id client_id: id,
} },
})); }));
this.player.on("trackStart", async (queue, track) => { this.player.on("trackStart", async (queue, track) => {
const m = await queue.metadata.channel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language) }); const m = await queue.metadata.channel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language) });
if (track.durationMS > 1) { if (track.durationMS > 1)
setTimeout(() => { setTimeout(() => {
if (m.deletable) m.delete(); if (m.deletable) m.delete();
}, track.durationMS); }, track.durationMS);
} else { else
setTimeout(() => { setTimeout(() => {
if (m.deletable) m.delete(); if (m.deletable) m.delete();
}, (10 * 60 * 1000)); // m * s * ms }, (10 * 60 * 1000)); // m * s * ms
}
}); });
this.player.on("queueEnd", queue => queue.metadata.channel.send(this.translate("music/play:QUEUE_ENDED", null, queue.metadata.channel.guild.data.language))); this.player.on("queueEnd", queue => queue.metadata.channel.send(this.translate("music/play:QUEUE_ENDED", null, queue.metadata.channel.guild.data.language)));
this.player.on("channelEmpty", queue => queue.metadata.channel.send(this.translate("music/play:STOP_EMPTY", null, queue.metadata.channel.guild.data.language))); this.player.on("channelEmpty", queue => queue.metadata.channel.send(this.translate("music/play:STOP_EMPTY", null, queue.metadata.channel.guild.data.language)));
@ -83,8 +82,8 @@ class JaBa extends Client {
botsCanWin: false, botsCanWin: false,
embedColor: this.config.embed.color, embedColor: this.config.embed.color,
embedColorEnd: "#FF0000", embedColorEnd: "#FF0000",
reaction: "🎉" reaction: "🎉",
} },
}); });
} }
@ -96,7 +95,7 @@ class JaBa extends Client {
mongoose.connect(this.config.mongoDB, { mongoose.connect(this.config.mongoDB, {
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true useUnifiedTopology: true,
}).then(() => { }).then(() => {
this.logger.log("Connected to the Mongodb database.", "log"); this.logger.log("Connected to the Mongodb database.", "log");
}).catch((err) => { }).catch((err) => {
@ -114,7 +113,11 @@ class JaBa extends Client {
*/ */
async loadCommands(dir) { async loadCommands(dir) {
const filePath = path.join(__dirname, dir); const filePath = path.join(__dirname, dir);
var folders = await fs.readdir(filePath); folders = folders.map(file => path.join(filePath, file)).filter(async (path) => { path = await fs.lstat(path); path.isDirectory(); }); let folders = await fs.readdir(filePath);
folders = folders
.map(file => path.join(filePath, file))
.filter(async path => { path = await fs.lstat(path); path.isDirectory(); });
const rest = new REST().setToken(this.config.token); const rest = new REST().setToken(this.config.token);
const commands = []; const commands = [];
for (let index = 0; index < folders.length; index++) { for (let index = 0; index < folders.length; index++) {
@ -130,14 +133,13 @@ class JaBa extends Client {
const command = new Command(this); const command = new Command(this);
this.commands.set(command.command.name, command); this.commands.set(command.command.name, command);
const aliases = []; const aliases = [];
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) { if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0)
command.aliases.forEach((alias) => { command.aliases.forEach((alias) => {
const command_alias = (command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? { ...command.command.toJSON() } : { ...command.command }; const command_alias = (command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? { ...command.command.toJSON() } : { ...command.command };
command_alias.name = alias; command_alias.name = alias;
aliases.push(command_alias); aliases.push(command_alias);
this.commands.set(alias, command); this.commands.set(alias, command);
}); });
}
commands.push((command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? command.command.toJSON() : command.command, ...aliases); commands.push((command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? command.command.toJSON() : command.command, ...aliases);
@ -149,19 +151,18 @@ class JaBa extends Client {
} }
try { try {
if (this.config.production) { if (this.config.production)
await rest.put( await rest.put(
Routes.applicationCommands(this.config.user), { Routes.applicationCommands(this.config.user), {
body: commands body: commands,
} },
); );
} else { else
await rest.put( await rest.put(
Routes.applicationGuildCommands(this.config.user, this.config.support.id), { Routes.applicationGuildCommands(this.config.user, this.config.support.id), {
body: commands body: commands,
} },
); );
}
this.logger.log("Successfully registered application commands."); this.logger.log("Successfully registered application commands.");
} catch (err) { } catch (err) {
@ -180,14 +181,13 @@ class JaBa extends Client {
const command = new Command(this); const command = new Command(this);
this.commands.set(command.command.name, command); this.commands.set(command.command.name, command);
const aliases = []; const aliases = [];
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) { if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0)
command.aliases.forEach((alias) => { command.aliases.forEach((alias) => {
const command_alias = command.command instanceof SlashCommandBuilder ? { ...command.command.toJSON() } : { ...command.command }; const command_alias = command.command instanceof SlashCommandBuilder ? { ...command.command.toJSON() } : { ...command.command };
command_alias.name = alias; command_alias.name = alias;
aliases.push(command_alias); aliases.push(command_alias);
this.commands.set(alias, command); this.commands.set(alias, command);
}); });
}
if (command.onLoad || typeof command.onLoad === "function") await command.onLoad(this); if (command.onLoad || typeof command.onLoad === "function") await command.onLoad(this);
this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`); this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`);
@ -312,9 +312,9 @@ class JaBa extends Client {
if (this.databaseCache.users.get(userID)) return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID); if (this.databaseCache.users.get(userID)) return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID);
else { else {
let userData = (isLean ? await this.usersData.findOne({ let userData = (isLean ? await this.usersData.findOne({
id: userID id: userID,
}).lean() : await this.usersData.findOne({ }).lean() : await this.usersData.findOne({
id: userID id: userID,
})); }));
if (userData) { if (userData) {
if (!isLean) this.databaseCache.users.set(userID, userData); if (!isLean) this.databaseCache.users.set(userID, userData);
@ -322,7 +322,7 @@ class JaBa extends Client {
return userData; return userData;
} else { } else {
userData = new this.usersData({ userData = new this.usersData({
id: userID id: userID,
}); });
await userData.save(); await userData.save();
this.databaseCache.users.set(userID, userData); this.databaseCache.users.set(userID, userData);
@ -343,10 +343,10 @@ class JaBa extends Client {
else { else {
let memberData = (isLean ? await this.membersData.findOne({ let memberData = (isLean ? await this.membersData.findOne({
guildID: guildId, guildID: guildId,
id: memberID id: memberID,
}).lean() : await this.membersData.findOne({ }).lean() : await this.membersData.findOne({
guildID: guildId, guildID: guildId,
id: memberID id: memberID,
})); }));
if (memberData) { if (memberData) {
if (!isLean) this.databaseCache.members.set(`${memberID}${guildId}`, memberData); if (!isLean) this.databaseCache.members.set(`${memberID}${guildId}`, memberData);
@ -355,11 +355,11 @@ class JaBa extends Client {
} else { } else {
memberData = new this.membersData({ memberData = new this.membersData({
id: memberID, id: memberID,
guildID: guildId guildID: guildId,
}); });
await memberData.save(); await memberData.save();
const guild = await this.findOrCreateGuild({ const guild = await this.findOrCreateGuild({
id: guildId id: guildId,
}); });
if (guild) { if (guild) {
guild.members.push(memberData._id); guild.members.push(memberData._id);
@ -382,9 +382,9 @@ class JaBa extends Client {
if (this.databaseCache.guilds.get(guildId)) return isLean ? this.databaseCache.guilds.get(guildId).toJSON() : this.databaseCache.guilds.get(guildId); if (this.databaseCache.guilds.get(guildId)) return isLean ? this.databaseCache.guilds.get(guildId).toJSON() : this.databaseCache.guilds.get(guildId);
else { else {
let guildData = (isLean ? await this.guildsData.findOne({ let guildData = (isLean ? await this.guildsData.findOne({
id: guildId id: guildId,
}).populate("members").lean() : await this.guildsData.findOne({ }).populate("members").lean() : await this.guildsData.findOne({
id: guildId id: guildId,
}).populate("members")); }).populate("members"));
if (guildData) { if (guildData) {
if (!isLean) this.databaseCache.guilds.set(guildId, guildData); if (!isLean) this.databaseCache.guilds.set(guildId, guildData);
@ -392,7 +392,7 @@ class JaBa extends Client {
return guildData; return guildData;
} else { } else {
guildData = new this.guildsData({ guildData = new this.guildsData({
id: guildId id: guildId,
}); });
await guildData.save(); await guildData.save();
this.databaseCache.guilds.set(guildId, guildData); this.databaseCache.guilds.set(guildId, guildData);

View file

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

View file

@ -4,9 +4,9 @@ const mongoose = require("mongoose"),
const genToken = () => { const genToken = () => {
let token = ""; let token = "";
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwzy0123456789.-_"; const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwzy0123456789.-_";
for (let i = 0; i < 32; i++) { for (let i = 0; i < 32; i++)
token += characters.charAt(Math.floor(Math.random() * characters.length)); token += characters.charAt(Math.floor(Math.random() * characters.length));
}
return token; return token;
}; };
@ -25,61 +25,61 @@ const userSchema = new mongoose.Schema({
achieved: false, achieved: false,
progress: { progress: {
now: 0, now: 0,
total: 1 total: 1,
} },
}, },
work: { work: {
achieved: false, achieved: false,
progress: { progress: {
now: 0, now: 0,
total: 10 total: 10,
} },
}, },
firstCommand: { firstCommand: {
achieved: false, achieved: false,
progress: { progress: {
now: 0, now: 0,
total: 1 total: 1,
} },
}, },
slots: { slots: {
achieved: false, achieved: false,
progress: { progress: {
now: 0, now: 0,
total: 3 total: 3,
} },
}, },
tip: { tip: {
achieved: false, achieved: false,
progress: { progress: {
now: 0, now: 0,
total: 1 total: 1,
} },
}, },
rep: { rep: {
achieved: false, achieved: false,
progress: { progress: {
now: 0, now: 0,
total: 20 total: 20,
}, },
}, },
invite: { invite: {
achieved: false, achieved: false,
progress: { progress: {
now: 0, now: 0,
total: 1 total: 1,
} },
} },
}}, } },
cooldowns: { type: Object, default: { cooldowns: { type: Object, default: {
rep: 0 rep: 0,
}}, } },
afk: { type: String, default: null }, afk: { type: String, default: null },
reminds: { type: Array, default: [] }, reminds: { type: Array, default: [] },
logged: { type: Boolean, default: false }, logged: { type: Boolean, default: false },
apiToken: { type: String, default: genToken() } apiToken: { type: String, default: genToken() },
}); });
userSchema.method("getAchievements", async function() { userSchema.method("getAchievements", async function() {
@ -93,7 +93,7 @@ userSchema.method("getAchievements", async function() {
await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.slots.achieved ? "_colored" : ""}4.png`), await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.slots.achieved ? "_colored" : ""}4.png`),
await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.tip.achieved ? "_colored" : ""}5.png`), await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.tip.achieved ? "_colored" : ""}5.png`),
await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.rep.achieved ? "_colored" : ""}6.png`), await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.rep.achieved ? "_colored" : ""}6.png`),
await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.invite.achieved ? "_colored" : ""}7.png`) await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.invite.achieved ? "_colored" : ""}7.png`),
]; ];
let dim = 0; let dim = 0;

View file

@ -21,7 +21,7 @@ class Automod extends BaseCommand {
.addChannelTypes(ChannelType.GuildText)), .addChannelTypes(ChannelType.GuildText)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -44,7 +44,7 @@ class Automod extends BaseCommand {
if (state) { if (state) {
data.guildData.plugins.automod = { data.guildData.plugins.automod = {
enabled: true, enabled: true,
ignored: [] ignored: [],
}; };
data.guildData.markModified("plugins.automod"); data.guildData.markModified("plugins.automod");
await data.guildData.save(); await data.guildData.save();
@ -55,12 +55,12 @@ class Automod extends BaseCommand {
data.guildData.markModified("plugins.automod"); data.guildData.markModified("plugins.automod");
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/automod:DISABLED_CHANNEL", { interaction.success("administration/automod:DISABLED_CHANNEL", {
channel: channel.toString() channel: channel.toString(),
}); });
} else { } else {
data.guildData.plugins.automod = { data.guildData.plugins.automod = {
enabled: false, enabled: false,
ignored: [] ignored: [],
}; };
data.guildData.markModified("plugins.automod"); data.guildData.markModified("plugins.automod");
await data.guildData.save(); await data.guildData.save();

View file

@ -20,7 +20,7 @@ class Autorole extends BaseCommand {
.setDescription(client.translate("common:ROLE"))), .setDescription(client.translate("common:ROLE"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -45,18 +45,18 @@ class Autorole extends BaseCommand {
data.guildData.plugins.autorole = { data.guildData.plugins.autorole = {
enabled: true, enabled: true,
role: role.id role: role.id,
}; };
data.guildData.markModified("plugins.autorole"); data.guildData.markModified("plugins.autorole");
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/autorole:SUCCESS_ENABLED", { interaction.success("administration/autorole:SUCCESS_ENABLED", {
role: role.toString() role: role.toString(),
}); });
} else { } else {
data.guildData.plugins.autorole = { data.guildData.plugins.autorole = {
enabled: false, enabled: false,
role: null role: null,
}; };
data.guildData.markModified("plugins.autorole"); data.guildData.markModified("plugins.autorole");
await data.guildData.save(); await data.guildData.save();

View file

@ -14,7 +14,7 @@ class Config extends BaseCommand {
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addSubcommand(subcommand => subcommand.setName("list") .addSubcommand(subcommand => subcommand.setName("list")
.setDescription(client.translate("administration/config:LIST")) .setDescription(client.translate("administration/config:LIST")),
) )
.addSubcommand(subcommand => subcommand.setName("set") .addSubcommand(subcommand => subcommand.setName("set")
.setDescription(client.translate("administration/config:SET")) .setDescription(client.translate("administration/config:SET"))
@ -25,18 +25,18 @@ class Config extends BaseCommand {
{ name: client.translate("administration/config:MODLOGS"), value: "modlogs" }, { name: client.translate("administration/config:MODLOGS"), value: "modlogs" },
{ name: client.translate("administration/config:NEWS"), value: "news" }, { name: client.translate("administration/config:NEWS"), value: "news" },
{ name: client.translate("administration/config:REPORTS"), value: "reports" }, { name: client.translate("administration/config:REPORTS"), value: "reports" },
{ name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" } { name: client.translate("administration/config:SUGGESTIONS"), value: "suggestions" },
) )
.setRequired(true)) .setRequired(true))
.addBooleanOption(option => option.setName("state") .addBooleanOption(option => option.setName("state")
.setDescription(client.translate("common:STATE")) .setDescription(client.translate("common:STATE"))
.setRequired(true)) .setRequired(true))
.addChannelOption(option => option.setName("channel") .addChannelOption(option => option.setName("channel")
.setDescription(client.translate("common:CHANNEL"))) .setDescription(client.translate("common:CHANNEL"))),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -61,65 +61,65 @@ class Config extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.guild.name, name: interaction.guild.name,
iconURL: interaction.guild.iconURL() iconURL: interaction.guild.iconURL(),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.addFields([ .addFields([
{ {
name: interaction.translate("administration/config:WELCOME_TITLE"), name: interaction.translate("administration/config:WELCOME_TITLE"),
value: guildData.plugins.welcome.enabled ? interaction.translate("administration/config:WELCOME_CONTENT", { value: guildData.plugins.welcome.enabled ? interaction.translate("administration/config:WELCOME_CONTENT", {
channel: `<#${guildData.plugins.welcome.channel}>`, channel: `<#${guildData.plugins.welcome.channel}>`,
withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO") withImage: guildData.plugins.welcome.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"),
}) : interaction.translate("common:DISABLED"), }) : interaction.translate("common:DISABLED"),
inline: true inline: true,
}, },
{ {
name: interaction.translate("administration/config:GOODBYE_TITLE"), name: interaction.translate("administration/config:GOODBYE_TITLE"),
value: guildData.plugins.goodbye.enabled ? interaction.translate("administration/config:GOODBYE_CONTENT", { value: guildData.plugins.goodbye.enabled ? interaction.translate("administration/config:GOODBYE_CONTENT", {
channel: `<#${guildData.plugins.goodbye.channel}>`, channel: `<#${guildData.plugins.goodbye.channel}>`,
withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO") withImage: guildData.plugins.goodbye.withImage ? interaction.translate("common:YES") : interaction.translate("common:NO"),
}) : interaction.translate("common:DISABLED"), }) : interaction.translate("common:DISABLED"),
inline: true inline: true,
}, },
{ {
name: interaction.translate("administration/config:AUTOROLE_TITLE"), name: interaction.translate("administration/config:AUTOROLE_TITLE"),
value: guildData.plugins.autorole.enabled ? `<@&${guildData.plugins.autorole.role}>` value: guildData.plugins.autorole.enabled ? `<@&${guildData.plugins.autorole.role}>`
: interaction.translate("common:DISABLED") : interaction.translate("common:DISABLED"),
}, },
{ {
name: interaction.translate("administration/config:AUTO_SANCTIONS"), name: interaction.translate("administration/config:AUTO_SANCTIONS"),
value: (guildData.plugins.warnsSanctions.kick ? interaction.translate("administration/config:KICK_CONTENT", { value: (guildData.plugins.warnsSanctions.kick ? interaction.translate("administration/config:KICK_CONTENT", {
count: guildData.plugins.warnsSanctions.kick count: guildData.plugins.warnsSanctions.kick,
}) : interaction.translate("administration/config:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? interaction.translate("administration/config:BAN_CONTENT", { }) : interaction.translate("administration/config:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? interaction.translate("administration/config:BAN_CONTENT", {
count: guildData.plugins.warnsSanctions.ban count: guildData.plugins.warnsSanctions.ban,
}) : interaction.translate("administration/config:BAN_NOT_DEFINED")) }) : interaction.translate("administration/config:BAN_NOT_DEFINED")),
}, },
{ {
name: interaction.translate("administration/config:AUTOMOD_TITLE"), name: interaction.translate("administration/config:AUTOMOD_TITLE"),
value: guildData.plugins.automod.enabled ? interaction.translate("administration/config:AUTOMOD_CONTENT", { value: guildData.plugins.automod.enabled ? interaction.translate("administration/config:AUTOMOD_CONTENT", {
channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`) channels: guildData.plugins.automod.ignored.map(ch => ` ${ch}`),
}) : interaction.translate("common:DISABLED") }) : interaction.translate("common:DISABLED"),
}, },
{ {
name: interaction.translate("administration/config:SPECIAL_CHANNELS"), name: interaction.translate("administration/config:SPECIAL_CHANNELS"),
value: interaction.translate("administration/config:NEWS_LIST", { value: interaction.translate("administration/config:NEWS_LIST", {
channel: guildData.plugins.news ? `<#${guildData.plugins.news}>` : `*${interaction.translate("common:NOT_DEFINED")}*` channel: guildData.plugins.news ? `<#${guildData.plugins.news}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
}) + "\n" + }) + "\n" +
interaction.translate("administration/config:SUGGESTIONS_LIST", { interaction.translate("administration/config:SUGGESTIONS_LIST", {
channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : `*${interaction.translate("common:NOT_DEFINED")}*` channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
}) + "\n" + }) + "\n" +
interaction.translate("administration/config:REPORTS_LIST", { interaction.translate("administration/config:REPORTS_LIST", {
channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : `*${interaction.translate("common:NOT_DEFINED")}*` channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
}) + "\n" + }) + "\n" +
interaction.translate("administration/config:MODLOGS_LIST", { interaction.translate("administration/config:MODLOGS_LIST", {
channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*` channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
}) + "\n" + }) + "\n" +
interaction.translate("administration/config:BIRTHDAYS_LIST", { interaction.translate("administration/config:BIRTHDAYS_LIST", {
channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : `*${interaction.translate("common:NOT_DEFINED")}*` channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : `*${interaction.translate("common:NOT_DEFINED")}*`,
}) }),
}, },
// { // {
// name: interaction.translate("administration/config:DASHBOARD_TITLE"), // name: interaction.translate("administration/config:DASHBOARD_TITLE"),
@ -129,7 +129,7 @@ class Config extends BaseCommand {
interaction.reply({ interaction.reply({
embeds: [embed], embeds: [embed],
ephemeral: true ephemeral: true,
}); });
} else { } else {
const setting = interaction.options.getString("setting"); const setting = interaction.options.getString("setting");
@ -156,7 +156,7 @@ async function changeSetting(interaction, setting, state, channel) {
await interaction.guild.data.save(); await interaction.guild.data.save();
return interaction.reply({ return interaction.reply({
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:DISABLED")}**`, content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:DISABLED")}**`,
ephemeral: true ephemeral: true,
}); });
} else { } else {
if (channel) { if (channel) {
@ -165,11 +165,12 @@ async function changeSetting(interaction, setting, state, channel) {
await interaction.guild.data.save(); await interaction.guild.data.save();
return interaction.reply({ return interaction.reply({
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`, content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: **${interaction.translate("common:ENABLED")}** (${channel.toString()})`,
ephemeral: true ephemeral: true,
}); });
} else return interaction.reply({ } else
return interaction.reply({
content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${interaction.guild.data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${interaction.guild.data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`}`, content: `${interaction.translate(`administration/config:${setting.toUpperCase()}`)}: ${interaction.guild.data.plugins[setting] ? `**${interaction.translate("common:ENABLED")}** (<#${interaction.guild.data.plugins[setting]}>)` : `**${interaction.translate("common:DISABLED")}**`}`,
ephemeral: true ephemeral: true,
}); });
} }
} }

View file

@ -14,7 +14,7 @@ class Goodbye extends BaseCommand {
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addSubcommand(subcommand => subcommand.setName("test") .addSubcommand(subcommand => subcommand.setName("test")
.setDescription(client.translate("administration/goodbye:TEST")) .setDescription(client.translate("administration/goodbye:TEST")),
) )
.addSubcommand(subcommand => subcommand.setName("config") .addSubcommand(subcommand => subcommand.setName("config")
.setDescription(client.translate("administration/goodbye:CONFIG")) .setDescription(client.translate("administration/goodbye:CONFIG"))
@ -26,11 +26,11 @@ class Goodbye extends BaseCommand {
.addStringOption(option => option.setName("message") .addStringOption(option => option.setName("message")
.setDescription(client.translate("common:MESSAGE"))) .setDescription(client.translate("common:MESSAGE")))
.addBooleanOption(option => option.setName("image") .addBooleanOption(option => option.setName("image")
.setDescription(client.translate("administration/goodbye:IMAGE"))) .setDescription(client.translate("administration/goodbye:IMAGE"))),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -60,7 +60,7 @@ class Goodbye extends BaseCommand {
enabled: false, enabled: false,
message: null, message: null,
channelID: null, channelID: null,
withImage: null withImage: null,
}; };
data.guildData.markModified("plugins.goodbye"); data.guildData.markModified("plugins.goodbye");
await data.guildData.save(); await data.guildData.save();
@ -81,7 +81,7 @@ class Goodbye extends BaseCommand {
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/goodbye:ENABLED", { interaction.success("administration/goodbye:ENABLED", {
channel: `<#${data.guildData.plugins.goodbye.channel}>` channel: `<#${data.guildData.plugins.goodbye.channel}>`,
}, { ephemeral: true }); }, { ephemeral: true });
} }
} }

View file

@ -17,7 +17,7 @@ class Selectroles extends BaseCommand {
.setDescription(client.translate("administration/selectroles:MESSAGE")) .setDescription(client.translate("administration/selectroles:MESSAGE"))
.addStringOption(option => option.setName("text") .addStringOption(option => option.setName("text")
.setDescription(client.translate("common:MESSAGE")) .setDescription(client.translate("common:MESSAGE"))
.setRequired(true)) .setRequired(true)),
) )
.addSubcommand(subcommand => subcommand.setName("addrole") .addSubcommand(subcommand => subcommand.setName("addrole")
.setDescription(client.translate("administration/selectroles:ADDROLE")) .setDescription(client.translate("administration/selectroles:ADDROLE"))
@ -29,11 +29,11 @@ class Selectroles extends BaseCommand {
.setRequired(true)) .setRequired(true))
.addRoleOption(option => option.setName("role") .addRoleOption(option => option.setName("role")
.setDescription(client.translate("common:ROLE")) .setDescription(client.translate("common:ROLE"))
.setRequired(true)) .setRequired(true)),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -59,7 +59,7 @@ class Selectroles extends BaseCommand {
interaction.reply({ interaction.reply({
content: interaction.translate("administration/selectroles:ROLES_UPDATED", null, { ephemeral: true }), content: interaction.translate("administration/selectroles:ROLES_UPDATED", null, { ephemeral: true }),
ephemeral: true ephemeral: true,
}); });
} }
}); });
@ -81,7 +81,7 @@ class Selectroles extends BaseCommand {
interaction.channel.send(text).then(message => { interaction.channel.send(text).then(message => {
interaction.success("administration/selectroles:MESSAGE_SENT", { interaction.success("administration/selectroles:MESSAGE_SENT", {
channel: interaction.channel.toString(), channel: interaction.channel.toString(),
message_id: message.id message_id: message.id,
}, { edit: true }); }, { edit: true });
}); });
} else if (command === "addrole") { } else if (command === "addrole") {
@ -96,7 +96,7 @@ class Selectroles extends BaseCommand {
const option = [{ const option = [{
label: role.name, label: role.name,
value: role.id value: role.id,
}]; }];
const menu = row.components[0]; const menu = row.components[0];
@ -110,7 +110,7 @@ class Selectroles extends BaseCommand {
SelectMenuBuilder.from(menu) SelectMenuBuilder.from(menu)
.setMinValues(0) .setMinValues(0)
.setMaxValues(menu.options.length + 1) .setMaxValues(menu.options.length + 1)
.addOptions(option) .addOptions(option),
); );
} else { } else {
row.addComponents( row.addComponents(
@ -119,19 +119,19 @@ class Selectroles extends BaseCommand {
.setMinValues(0) .setMinValues(0)
.setMaxValues(1) .setMaxValues(1)
.setPlaceholder(interaction.translate("common:AVAILABLE_OPTIONS")) .setPlaceholder(interaction.translate("common:AVAILABLE_OPTIONS"))
.addOptions(option) .addOptions(option),
); );
} }
message.edit({ message.edit({
components: [row] components: [row],
}); });
interaction.followUp({ interaction.followUp({
content: interaction.translate("administration/selectroles:SUCCESS_ADDED", { content: interaction.translate("administration/selectroles:SUCCESS_ADDED", {
role: role.name role: role.name,
}), }),
ephemeral: true ephemeral: true,
}); });
} }
} }

View file

@ -20,7 +20,7 @@ class Set extends BaseCommand {
{ name: client.translate("common:LEVEL"), value: "level" }, { name: client.translate("common:LEVEL"), value: "level" },
{ name: client.translate("common:XP"), value: "xp" }, { name: client.translate("common:XP"), value: "xp" },
{ name: client.translate("common:CREDITS"), value: "credits" }, { name: client.translate("common:CREDITS"), value: "credits" },
{ name: client.translate("economy/transactions:BANK"), value: "bank" } { name: client.translate("economy/transactions:BANK"), value: "bank" },
)) ))
.addUserOption(option => option.setName("user") .addUserOption(option => option.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
@ -30,7 +30,7 @@ class Set extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -53,7 +53,7 @@ class Set extends BaseCommand {
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
const int = interaction.options.getInteger("int"); const int = interaction.options.getInteger("int");
if (int < 0) return interaction.error("administration/set:INVALID_NUMBER", null, { ephemeral: true }); if (int < 0) return interaction.error("administration/set:INVALID_NUMBER", null, { ephemeral: true });
@ -64,7 +64,7 @@ class Set extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -73,7 +73,7 @@ class Set extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -82,7 +82,7 @@ class Set extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -91,7 +91,7 @@ class Set extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
} }

View file

@ -18,11 +18,11 @@ class Setlang extends BaseCommand {
.setRequired(true) .setRequired(true)
.addChoices( .addChoices(
{ name: "Русский", value: "ru-RU" }, { name: "Русский", value: "ru-RU" },
{ name: "Українська", value: "uk-UA" } { name: "Українська", value: "uk-UA" },
)), )),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -46,7 +46,7 @@ class Setlang extends BaseCommand {
await data.guildData.save(); await data.guildData.save();
return interaction.success("administration/setlang:SUCCESS", { return interaction.success("administration/setlang:SUCCESS", {
lang: language.nativeName lang: language.nativeName,
}); });
} }
} }

View file

@ -18,7 +18,7 @@ class Stealemoji extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -41,15 +41,15 @@ class Stealemoji extends BaseCommand {
interaction.guild.emojis interaction.guild.emojis
.create({ .create({
name: parsedEmoji.name, name: parsedEmoji.name,
attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${ext}` attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${ext}`,
}) })
.then(emoji => interaction.success("administration/stealemoji:SUCCESS", { .then(emoji => interaction.success("administration/stealemoji:SUCCESS", {
emoji: emoji.name emoji: emoji.name,
}, { ephemeral: true })) }, { ephemeral: true }))
.catch(e => { .catch(e => {
interaction.error("administration/stealemoji:ERROR", { interaction.error("administration/stealemoji:ERROR", {
emoji: parsedEmoji.name, emoji: parsedEmoji.name,
e e,
}, { ephemeral: true }); }, { ephemeral: true });
}); });
} }

View file

@ -14,7 +14,7 @@ class Welcome extends BaseCommand {
.setDMPermission(false) .setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator) .setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addSubcommand(subcommand => subcommand.setName("test") .addSubcommand(subcommand => subcommand.setName("test")
.setDescription(client.translate("administration/goodbye:TEST")) .setDescription(client.translate("administration/goodbye:TEST")),
) )
.addSubcommand(subcommand => subcommand.setName("config") .addSubcommand(subcommand => subcommand.setName("config")
.setDescription(client.translate("administration/goodbye:CONFIG")) .setDescription(client.translate("administration/goodbye:CONFIG"))
@ -26,11 +26,11 @@ class Welcome extends BaseCommand {
.addStringOption(option => option.setName("message") .addStringOption(option => option.setName("message")
.setDescription(client.translate("common:MESSAGE"))) .setDescription(client.translate("common:MESSAGE")))
.addBooleanOption(option => option.setName("image") .addBooleanOption(option => option.setName("image")
.setDescription(client.translate("administration/goodbye:IMAGE"))) .setDescription(client.translate("administration/goodbye:IMAGE"))),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -60,7 +60,7 @@ class Welcome extends BaseCommand {
enabled: false, enabled: false,
message: null, message: null,
channelID: null, channelID: null,
withImage: null withImage: null,
}; };
data.guildData.markModified("plugins.welcome"); data.guildData.markModified("plugins.welcome");
await data.guildData.save(); await data.guildData.save();
@ -81,7 +81,7 @@ class Welcome extends BaseCommand {
await data.guildData.save(); await data.guildData.save();
interaction.success("administration/welcome:ENABLED", { interaction.success("administration/welcome:ENABLED", {
channel: `<#${data.guildData.plugins.welcome.channel}>` channel: `<#${data.guildData.plugins.welcome.channel}>`,
}, { ephemeral: true }); }, { ephemeral: true });
} }
} }

View file

@ -16,7 +16,7 @@ class Achievements extends BaseCommand {
.setDescription(client.translate("common:USER"))), .setDescription(client.translate("common:USER"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -36,16 +36,16 @@ class Achievements extends BaseCommand {
const user = interaction.options.getUser("user") || interaction.member; const user = interaction.options.getUser("user") || interaction.member;
if (user.bot) return interaction.error("economy/profile:BOT_USER"); if (user.bot) return interaction.error("economy/profile:BOT_USER");
const userData = (user.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ const userData = (user.id === interaction.user.id ? data.userData : await client.findOrCreateUser({
id: user.id id: user.id,
})); }));
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("economy/achievements:TITLE") name: interaction.translate("economy/achievements:TITLE"),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
embed.addFields([ embed.addFields([
@ -54,61 +54,61 @@ class Achievements extends BaseCommand {
value: interaction.translate("economy/achievements:PROGRESS", { value: interaction.translate("economy/achievements:PROGRESS", {
now: userData.achievements.firstCommand.progress.now, now: userData.achievements.firstCommand.progress.now,
total: userData.achievements.firstCommand.progress.total, total: userData.achievements.firstCommand.progress.total,
percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total)) percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total)),
}) }),
}, },
{ {
name: interaction.translate("economy/achievements:CLAIM_SALARY"), name: interaction.translate("economy/achievements:CLAIM_SALARY"),
value: interaction.translate("economy/achievements:PROGRESS", { value: interaction.translate("economy/achievements:PROGRESS", {
now: userData.achievements.work.progress.now, now: userData.achievements.work.progress.now,
total: userData.achievements.work.progress.total, total: userData.achievements.work.progress.total,
percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total)) percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total)),
}) }),
}, },
{ {
name: interaction.translate("economy/achievements:MARRY"), name: interaction.translate("economy/achievements:MARRY"),
value: interaction.translate("economy/achievements:PROGRESS", { value: interaction.translate("economy/achievements:PROGRESS", {
now: userData.achievements.married.progress.now, now: userData.achievements.married.progress.now,
total: userData.achievements.married.progress.total, total: userData.achievements.married.progress.total,
percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total)) percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total)),
}) }),
}, },
{ {
name: interaction.translate("economy/achievements:SLOTS"), name: interaction.translate("economy/achievements:SLOTS"),
value: interaction.translate("economy/achievements:PROGRESS", { value: interaction.translate("economy/achievements:PROGRESS", {
now: userData.achievements.slots.progress.now, now: userData.achievements.slots.progress.now,
total: userData.achievements.slots.progress.total, total: userData.achievements.slots.progress.total,
percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total)) percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total)),
}) }),
}, },
{ {
name: interaction.translate("economy/achievements:TIP"), name: interaction.translate("economy/achievements:TIP"),
value: interaction.translate("economy/achievements:PROGRESS", { value: interaction.translate("economy/achievements:PROGRESS", {
now: userData.achievements.tip.progress.now, now: userData.achievements.tip.progress.now,
total: userData.achievements.tip.progress.total, total: userData.achievements.tip.progress.total,
percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total)) percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total)),
}) }),
}, },
{ {
name: interaction.translate("economy/achievements:REP"), name: interaction.translate("economy/achievements:REP"),
value: interaction.translate("economy/achievements:PROGRESS", { value: interaction.translate("economy/achievements:PROGRESS", {
now: userData.achievements.rep.progress.now, now: userData.achievements.rep.progress.now,
total: userData.achievements.rep.progress.total, total: userData.achievements.rep.progress.total,
percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total)) percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total)),
}) }),
}, },
{ {
name: interaction.translate("economy/achievements:INVITE"), name: interaction.translate("economy/achievements:INVITE"),
value: interaction.translate("economy/achievements:PROGRESS", { value: interaction.translate("economy/achievements:PROGRESS", {
now: userData.achievements.invite.progress.now, now: userData.achievements.invite.progress.now,
total: userData.achievements.invite.progress.total, total: userData.achievements.invite.progress.total,
percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total)) percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total)),
}) }),
} },
]); ]);
interaction.reply({ interaction.reply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -17,14 +17,14 @@ class Bank extends BaseCommand {
.setRequired(true) .setRequired(true)
.addChoices( .addChoices(
{ name: client.translate("economy/bank:DEPOSIT"), value: "deposit" }, { name: client.translate("economy/bank:DEPOSIT"), value: "deposit" },
{ name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" } { name: client.translate("economy/bank:WITHDRAW"), value: "withdraw" },
)) ))
.addStringOption(option => option.setName("credits") .addStringOption(option => option.setName("credits")
.setDescription(client.translate("moderation/clear:OPTION")) .setDescription(client.translate("moderation/clear:OPTION"))
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -56,12 +56,12 @@ class Bank extends BaseCommand {
user: interaction.translate("economy/transactions:BANK"), user: interaction.translate("economy/transactions:BANK"),
amount: credits, amount: credits,
date: Date.now(), date: Date.now(),
type: "send" type: "send",
}; };
data.memberData.transactions.push(info); data.memberData.transactions.push(info);
interaction.success("economy/bank:SUCCESS_DEP", { interaction.success("economy/bank:SUCCESS_DEP", {
money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
}); });
} else { } else {
const credits = interaction.options.getString("credits") === "all" ? data.memberData.bankSold : interaction.options.getString("credits"); const credits = interaction.options.getString("credits") === "all" ? data.memberData.bankSold : interaction.options.getString("credits");
@ -72,7 +72,7 @@ class Bank extends BaseCommand {
user: interaction.translate("economy/transactions:BANK"), user: interaction.translate("economy/transactions:BANK"),
amount: credits, amount: credits,
date: Date.now(), date: Date.now(),
type: "got" type: "got",
}; };
data.memberData.transactions.push(info); data.memberData.transactions.push(info);
@ -82,7 +82,7 @@ class Bank extends BaseCommand {
await data.memberData.save(); await data.memberData.save();
interaction.success("economy/bank:SUCCESS_WD", { interaction.success("economy/bank:SUCCESS_WD", {
money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` money: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
}); });
} }
} }

View file

@ -30,14 +30,14 @@ class Birthdate extends BaseCommand {
{ name: "Сентябрь", value: 9 }, { name: "Сентябрь", value: 9 },
{ name: "Октябрь", value: 10 }, { name: "Октябрь", value: 10 },
{ name: "Ноябрь", value: 11 }, { name: "Ноябрь", value: 11 },
{ name: "Декабрь", value: 12 } { name: "Декабрь", value: 12 },
)) ))
.addIntegerOption(option => option.setName("year") .addIntegerOption(option => option.setName("year")
.setDescription(client.translate("economy/birthdate:YEAR")) .setDescription(client.translate("economy/birthdate:YEAR"))
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -67,7 +67,7 @@ class Birthdate extends BaseCommand {
await data.userData.save(); await data.userData.save();
interaction.success("economy/birthdate:SUCCESS", { interaction.success("economy/birthdate:SUCCESS", {
date: client.printDate(d) date: client.printDate(d),
}); });
} }
} }

View file

@ -14,7 +14,7 @@ class Divorce extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -38,19 +38,19 @@ class Divorce extends BaseCommand {
await data.userData.save(); await data.userData.save();
const oldLover = await client.findOrCreateUser({ const oldLover = await client.findOrCreateUser({
id: user.id id: user.id,
}); });
oldLover.lover = null; oldLover.lover = null;
await oldLover.save(); await oldLover.save();
interaction.success("economy/divorce:DIVORCED", { interaction.success("economy/divorce:DIVORCED", {
user: user.toString() user: user.toString(),
}); });
user.send({ user.send({
content: interaction.translate("economy/divorce:DIVORCED_U", { content: interaction.translate("economy/divorce:DIVORCED_U", {
user: interaction.member.toString() user: interaction.member.toString(),
}) }),
}); });
} }
} }

View file

@ -15,7 +15,7 @@ class ImportMee6 extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -42,8 +42,8 @@ class ImportMee6 extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: interaction.translate("owner/debug:SUCCESS_LEVEL", { content: interaction.translate("owner/debug:SUCCESS_LEVEL", {
username: interaction.member.toString(), username: interaction.member.toString(),
amount: level amount: level,
}) }),
}); });
} }
} }

View file

@ -26,11 +26,11 @@ class Leaderboard extends BaseCommand {
.addChoices( .addChoices(
{ name: client.translate("economy/leaderboard:LEVEL"), value: "level" }, { name: client.translate("economy/leaderboard:LEVEL"), value: "level" },
{ name: client.translate("economy/leaderboard:MONEY"), value: "money" }, { name: client.translate("economy/leaderboard:MONEY"), value: "money" },
{ name: client.translate("economy/leaderboard:REP"), value: "rep" } { name: client.translate("economy/leaderboard:REP"), value: "rep" },
)), )),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -53,7 +53,7 @@ class Leaderboard extends BaseCommand {
const isOnMobile = JSON.stringify(Object.keys(interaction.member.presence.clientStatus)) === JSON.stringify(["mobile"]); const isOnMobile = JSON.stringify(Object.keys(interaction.member.presence.clientStatus)) === JSON.stringify(["mobile"]);
if (isOnMobile) interaction.followUp({ if (isOnMobile) interaction.followUp({
content: interaction.translate("economy/leaderboard:MOBILE"), content: interaction.translate("economy/leaderboard:MOBILE"),
ephemeral: true ephemeral: true,
}); });
if (type === "money") { if (type === "money") {
@ -63,7 +63,7 @@ class Leaderboard extends BaseCommand {
await asyncForEach(membersData, async member => { await asyncForEach(membersData, async member => {
membersLeaderboard.push({ membersLeaderboard.push({
id: member.id, id: member.id,
money: member.money + member.bankSold money: member.money + member.bankSold,
}); });
}); });
membersLeaderboard.sort((a, b) => b.money - a.money); membersLeaderboard.sort((a, b) => b.money - a.money);
@ -81,23 +81,23 @@ class Leaderboard extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("economy/leaderboard:TABLE", { name: interaction.translate("economy/leaderboard:TABLE", {
name: interaction.guild.name name: interaction.guild.name,
}), }),
iconURL: interaction.guild.iconURL() iconURL: interaction.guild.iconURL(),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.addFields({ .addFields({
name: interaction.translate("common:USER"), name: interaction.translate("common:USER"),
value: userNames, value: userNames,
inline: true inline: true,
}, { }, {
name: interaction.translate("common:CREDITS"), name: interaction.translate("common:CREDITS"),
value: money, value: money,
inline: true inline: true,
}); });
interaction.editReply({ interaction.editReply({
embeds: [embed] embeds: [embed],
}); });
} else if (type === "level") { } else if (type === "level") {
const membersLeaderboard = [], const membersLeaderboard = [],
@ -107,7 +107,7 @@ class Leaderboard extends BaseCommand {
membersLeaderboard.push({ membersLeaderboard.push({
id: member.id, id: member.id,
level: member.level, level: member.level,
xp: member.exp xp: member.exp,
}); });
}); });
membersLeaderboard.sort((a, b) => b.level - a.level); membersLeaderboard.sort((a, b) => b.level - a.level);
@ -127,31 +127,31 @@ class Leaderboard extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("economy/leaderboard:TABLE", { name: interaction.translate("economy/leaderboard:TABLE", {
name: interaction.guild.name name: interaction.guild.name,
}), }),
iconURL: interaction.guild.iconURL() iconURL: interaction.guild.iconURL(),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.addFields([ .addFields([
{ {
name: interaction.translate("common:USER"), name: interaction.translate("common:USER"),
value: userNames.join("\n"), value: userNames.join("\n"),
inline: true inline: true,
}, },
{ {
name: interaction.translate("common:LEVEL"), name: interaction.translate("common:LEVEL"),
value: level.join("\n"), value: level.join("\n"),
inline: true inline: true,
}, },
{ {
name: interaction.translate("common:XP"), name: interaction.translate("common:XP"),
value: xp.join("\n"), value: xp.join("\n"),
inline: true inline: true,
} },
]); ]);
interaction.editReply({ interaction.editReply({
embeds: [embed] embeds: [embed],
}); });
} else if (type === "rep") { } else if (type === "rep") {
const usersLeaderboard = [], const usersLeaderboard = [],
@ -160,7 +160,7 @@ class Leaderboard extends BaseCommand {
await asyncForEach(usersData, async user => { await asyncForEach(usersData, async user => {
usersLeaderboard.push({ usersLeaderboard.push({
id: user.id, id: user.id,
rep: user.rep rep: user.rep,
}); });
}); });
usersLeaderboard.sort((a, b) => b.rep - a.rep); usersLeaderboard.sort((a, b) => b.rep - a.rep);
@ -178,23 +178,23 @@ class Leaderboard extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("economy/leaderboard:TABLE", { name: interaction.translate("economy/leaderboard:TABLE", {
name: interaction.guild.name name: interaction.guild.name,
}), }),
iconURL: interaction.guild.iconURL() iconURL: interaction.guild.iconURL(),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.addFields({ .addFields({
name: interaction.translate("common:USER"), name: interaction.translate("common:USER"),
value: userNames, value: userNames,
inline: true inline: true,
}, { }, {
name: interaction.translate("common:REP"), name: interaction.translate("common:REP"),
value: rep, value: rep,
inline: true inline: true,
}); });
interaction.editReply({ interaction.editReply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -18,7 +18,7 @@ class Marry extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -40,7 +40,7 @@ class Marry extends BaseCommand {
if (member.user.bot) return interaction.error("economy/marry:BOT_USER"); if (member.user.bot) return interaction.error("economy/marry:BOT_USER");
if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF"); if (member.id === interaction.member.id) return interaction.error("economy/marry:YOURSELF");
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: member.id id: member.id,
}); });
if (userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED_USER", { user: member.toString() }); if (userData.lover) return interaction.error("economy/marry:ALREADY_MARRIED_USER", { user: member.toString() });
@ -50,24 +50,24 @@ class Marry extends BaseCommand {
if (requester === interaction.author.id) { if (requester === interaction.author.id) {
const user = client.users.cache.get(receiver) || await client.users.fetch(receiver); const user = client.users.cache.get(receiver) || await client.users.fetch(receiver);
return interaction.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", { return interaction.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", {
user: user.toString user: user.toString,
}); });
} else if (receiver === interaction.member.id) { } else if (receiver === interaction.member.id) {
const user = client.users.cache.get(requester) || await client.users.fetch(requester); const user = client.users.cache.get(requester) || await client.users.fetch(requester);
return interaction.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", { return interaction.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", {
user: user.toString() user: user.toString(),
}); });
} else if (requester === member.id) { } else if (requester === member.id) {
const user = client.users.cache.get(receiver) || await client.users.fetch(receiver); const user = client.users.cache.get(receiver) || await client.users.fetch(receiver);
return interaction.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", { return interaction.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", {
firstUser: member.toString(), firstUser: member.toString(),
secondUser: user.toString() secondUser: user.toString(),
}); });
} else if (receiver === member.id) { } else if (receiver === member.id) {
const user = client.users.cache.get(requester) || await client.users.fetch(requester); const user = client.users.cache.get(requester) || await client.users.fetch(requester);
return interaction.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", { return interaction.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", {
firstUser: member.toString(), firstUser: member.toString(),
secondUser: user.toString() secondUser: user.toString(),
}); });
} }
} }
@ -89,9 +89,9 @@ class Marry extends BaseCommand {
await interaction.reply({ await interaction.reply({
content: interaction.translate("economy/marry:REQUEST", { content: interaction.translate("economy/marry:REQUEST", {
to: member.toString(), to: member.toString(),
from: interaction.member.toString() from: interaction.member.toString(),
}), }),
components: [row] components: [row],
}); });
const filter = i => i.user.id === member.id; const filter = i => i.user.id === member.id;
@ -112,7 +112,7 @@ class Marry extends BaseCommand {
}); });
return interaction.editReply({ return interaction.editReply({
components: [row] components: [row],
}); });
} }
@ -126,8 +126,8 @@ class Marry extends BaseCommand {
content: `${member.toString()} :heart: ${interaction.member.toString()}`, content: `${member.toString()} :heart: ${interaction.member.toString()}`,
files: [{ files: [{
name: "achievement_unlocked3.png", name: "achievement_unlocked3.png",
attachment: "./assets/img/achievements/achievement_unlocked3.png" attachment: "./assets/img/achievements/achievement_unlocked3.png",
}] }],
}; };
let sent = false; let sent = false;
@ -151,17 +151,17 @@ class Marry extends BaseCommand {
return interaction.editReply({ return interaction.editReply({
content: interaction.translate("economy/marry:SUCCESS", { content: interaction.translate("economy/marry:SUCCESS", {
creator: interaction.member.toString(), creator: interaction.member.toString(),
partner: member.toString() partner: member.toString(),
}), }),
components: [] components: [],
}); });
} else { } else {
return interaction.editReply({ return interaction.editReply({
content: interaction.translate("economy/marry:DENIED", { content: interaction.translate("economy/marry:DENIED", {
creator: interaction.member.toString(), creator: interaction.member.toString(),
partner: member.toString() partner: member.toString(),
}), }),
components: [] components: [],
}); });
} }
}); });

View file

@ -24,7 +24,7 @@ class Money extends BaseCommand {
.setDescription(client.translate("common:USER"))), .setDescription(client.translate("common:USER"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -48,7 +48,7 @@ class Money extends BaseCommand {
const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ const memberData = member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id)); const guilds = client.guilds.cache.filter(g => g.members.cache.find(m => m.id === member.id));
@ -56,7 +56,7 @@ class Money extends BaseCommand {
await asyncForEach(guilds, async guild => { await asyncForEach(guilds, async guild => {
const data = await client.findOrCreateMember({ const data = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: guild.id guildId: guild.id,
}); });
globalMoney += data.money + data.bankSold; globalMoney += data.money + data.bankSold;
}); });
@ -64,33 +64,33 @@ class Money extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("economy/money:TITLE", { name: interaction.translate("economy/money:TITLE", {
username: member.user.tag username: member.user.tag,
}), }),
iconURL: member.user.displayAvatarURL() iconURL: member.user.displayAvatarURL(),
}) })
.addFields([ .addFields([
{ {
name: interaction.translate("economy/profile:CASH"), name: interaction.translate("economy/profile:CASH"),
value: `**${memberData.money}** ${client.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, value: `**${memberData.money}** ${client.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:BANK"), name: interaction.translate("economy/profile:BANK"),
value: `**${memberData.bankSold}** ${client.getNoun(memberData.bankSold, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, value: `**${memberData.bankSold}** ${client.getNoun(memberData.bankSold, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:GLOBAL"), name: interaction.translate("economy/profile:GLOBAL"),
value: `**${globalMoney}** ${client.getNoun(globalMoney, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, value: `**${globalMoney}** ${client.getNoun(globalMoney, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true inline: true,
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
interaction.editReply({ interaction.editReply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -15,7 +15,7 @@ class Number extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -44,7 +44,7 @@ class Number extends BaseCommand {
const filter = m => !m.author.bot; const filter = m => !m.author.bot;
const collector = new MessageCollector(interaction.channel, { const collector = new MessageCollector(interaction.channel, {
filter, filter,
time: (5 * 60 * 1000) time: (5 * 60 * 1000),
}); });
currentGames[interaction.guildId] = true; currentGames[interaction.guildId] = true;
@ -63,8 +63,8 @@ class Number extends BaseCommand {
number, number,
time, time,
participantCount: participants.length, participantCount: participants.length,
participants: participants.map(p => `<@${p}>`).join(", ") participants: participants.map(p => `<@${p}>`).join(", "),
}) }),
}); });
if (participants.length > 1) { if (participants.length > 1) {
@ -73,13 +73,13 @@ class Number extends BaseCommand {
interaction.channel.send({ interaction.channel.send({
content: interaction.translate("economy/number:WON", { content: interaction.translate("economy/number:WON", {
winner: msg.author.username, winner: msg.author.username,
credits: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` credits: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
}) }),
}); });
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: msg.author.id, id: msg.author.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
memberData.money += won; memberData.money += won;
@ -88,7 +88,7 @@ class Number extends BaseCommand {
user: interaction.translate("economy/transactions:NUMBERS"), user: interaction.translate("economy/transactions:NUMBERS"),
amount: won, amount: won,
date: Date.now(), date: Date.now(),
type: "got" type: "got",
}; };
data.memberData.transactions.push(info); data.memberData.transactions.push(info);
@ -98,10 +98,10 @@ class Number extends BaseCommand {
} }
if (parseInt(msg.content) < number) msg.reply({ if (parseInt(msg.content) < number) msg.reply({
content: interaction.translate("economy/number:TOO_BIG", { user: msg.author.toString(), number: parsedNumber }) content: interaction.translate("economy/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("economy/number:TOO_SMALL", { user: msg.author.toString(), number: parsedNumber }) content: interaction.translate("economy/number:TOO_SMALL", { user: msg.author.toString(), number: parsedNumber }),
}); });
}); });

View file

@ -20,7 +20,7 @@ class Pay extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -45,12 +45,12 @@ class Pay extends BaseCommand {
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.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}` amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDITS:1"), interaction.translate("misc:NOUNS:CREDITS:2"), interaction.translate("misc:NOUNS:CREDITS:5"))}`,
}); });
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
data.memberData.money -= amount; data.memberData.money -= amount;
@ -63,7 +63,7 @@ class Pay extends BaseCommand {
user: member.user.tag, user: member.user.tag,
amount: amount, amount: amount,
date: Date.now(), date: Date.now(),
type: "send" type: "send",
}; };
data.memberData.transactions.push(info1); data.memberData.transactions.push(info1);
@ -71,13 +71,13 @@ class Pay extends BaseCommand {
user: member.user.tag, user: member.user.tag,
amount: amount, amount: amount,
date: Date.now(), date: Date.now(),
type: "got" type: "got",
}; };
data.memberData.transactions.push(info2); data.memberData.transactions.push(info2);
interaction.success("economy/pay:SUCCESS", { interaction.success("economy/pay:SUCCESS", {
user: member.toString(), user: member.toString(),
amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` amount: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
}); });
} }
} }

View file

@ -24,7 +24,7 @@ class Profile extends BaseCommand {
.setDescription(client.translate("common:USER"))), .setDescription(client.translate("common:USER"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -48,10 +48,10 @@ class Profile extends BaseCommand {
const memberData = (member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({ const memberData = (member.id === interaction.user.id ? data.memberData : await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
})); }));
const userData = (member.id === interaction.user.id ? data.userData : await client.findOrCreateUser({ const userData = (member.id === interaction.user.id ? data.userData : await client.findOrCreateUser({
id: member.id id: member.id,
})); }));
if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true); if (userData.lover && !client.users.cache.find(u => u.id === userData.lover)) await client.users.fetch(userData.lover, true);
@ -60,7 +60,7 @@ class Profile extends BaseCommand {
await asyncForEach(guilds, async guild => { await asyncForEach(guilds, async guild => {
const data = await client.findOrCreateMember({ const data = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: guild.id guildId: guild.id,
}); });
globalMoney += data.money + data.bankSold; globalMoney += data.money + data.bankSold;
}); });
@ -68,73 +68,73 @@ class Profile extends BaseCommand {
const profileEmbed = new EmbedBuilder() const profileEmbed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("economy/profile:TITLE", { name: interaction.translate("economy/profile:TITLE", {
user: member.nickname user: member.nickname,
}), }),
iconURL: member.displayAvatarURL() iconURL: member.displayAvatarURL(),
}) })
.setImage("attachment://achievements.png") .setImage("attachment://achievements.png")
.addFields([ .addFields([
{ {
name: client.customEmojis.link + " " + interaction.translate("economy/profile:LINK"), name: client.customEmojis.link + " " + interaction.translate("economy/profile:LINK"),
value: `[${interaction.translate("economy/profile:LINK_TEXT")}](${client.config.dashboard.baseURL}/user/${member.user.id}/${interaction.guild.id})` value: `[${interaction.translate("economy/profile:LINK_TEXT")}](${client.config.dashboard.baseURL}/user/${member.user.id}/${interaction.guild.id})`,
}, },
{ {
name: interaction.translate("economy/profile:BIO"), name: interaction.translate("economy/profile:BIO"),
value: userData.bio ? userData.bio : interaction.translate("common:UNKNOWN") value: userData.bio ? userData.bio : interaction.translate("common:UNKNOWN"),
}, },
{ {
name: interaction.translate("economy/profile:CASH"), name: interaction.translate("economy/profile:CASH"),
value: `**${memberData.money}** ${client.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, value: `**${memberData.money}** ${client.getNoun(memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:BANK"), name: interaction.translate("economy/profile:BANK"),
value: `**${memberData.bankSold}** ${client.getNoun(memberData.bankSold, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, value: `**${memberData.bankSold}** ${client.getNoun(memberData.bankSold, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:GLOBAL"), name: interaction.translate("economy/profile:GLOBAL"),
value: `**${globalMoney}** ${client.getNoun(globalMoney, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, value: `**${globalMoney}** ${client.getNoun(globalMoney, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:REPUTATION"), name: interaction.translate("economy/profile:REPUTATION"),
value: `**${userData.rep}** ${client.getNoun(userData.rep, interaction.translate("misc:NOUNS:POINTS:1"), interaction.translate("misc:NOUNS:POINTS:2"), interaction.translate("misc:NOUNS:POINTS:5"))}`, value: `**${userData.rep}** ${client.getNoun(userData.rep, interaction.translate("misc:NOUNS:POINTS:1"), interaction.translate("misc:NOUNS:POINTS:2"), interaction.translate("misc:NOUNS:POINTS:5"))}`,
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:LEVEL"), name: interaction.translate("economy/profile:LEVEL"),
value:`**${memberData.level}**`, value:`**${memberData.level}**`,
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:XP"), name: interaction.translate("economy/profile:XP"),
value: `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`, value: `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`,
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:REGISTERED"), name: interaction.translate("economy/profile:REGISTERED"),
value: client.printDate(new Date(memberData.registeredAt)), value: client.printDate(new Date(memberData.registeredAt)),
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:BIRTHDATE"), name: interaction.translate("economy/profile:BIRTHDATE"),
value: (!userData.birthdate ? interaction.translate("common:NOT_DEFINED") : client.printDate(new Date(userData.birthdate))), value: (!userData.birthdate ? interaction.translate("common:NOT_DEFINED") : client.printDate(new Date(userData.birthdate))),
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:LOVER"), name: interaction.translate("economy/profile:LOVER"),
value: (!userData.lover ? interaction.translate("common:NOT_DEFINED") : client.users.cache.get(userData.lover).tag), value: (!userData.lover ? interaction.translate("common:NOT_DEFINED") : client.users.cache.get(userData.lover).tag),
inline: true inline: true,
}, },
{ {
name: interaction.translate("economy/profile:ACHIEVEMENTS"), name: interaction.translate("economy/profile:ACHIEVEMENTS"),
value: interaction.translate("economy/profile:ACHIEVEMENTS_CONTENT") value: interaction.translate("economy/profile:ACHIEVEMENTS_CONTENT"),
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.setTimestamp(); .setTimestamp();
@ -144,8 +144,8 @@ class Profile extends BaseCommand {
embeds: [profileEmbed], embeds: [profileEmbed],
files: [{ files: [{
name: "achievements.png", name: "achievements.png",
attachment: buffer attachment: buffer,
}] }],
}); });
} }
} }

View file

@ -17,7 +17,7 @@ class Rep extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -37,7 +37,7 @@ class Rep extends BaseCommand {
const isInCooldown = data.userData.cooldowns?.rep; const isInCooldown = data.userData.cooldowns?.rep;
if (isInCooldown) { if (isInCooldown) {
if (isInCooldown > Date.now()) return interaction.error("economy/rep:COOLDOWN", { if (isInCooldown > Date.now()) return interaction.error("economy/rep:COOLDOWN", {
time: client.convertTime(isInCooldown, true, true, data.guildData.language) time: client.convertTime(isInCooldown, true, true, data.guildData.language),
}); });
} }
@ -52,7 +52,7 @@ class Rep extends BaseCommand {
await data.userData.save(); await data.userData.save();
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: user.id id: user.id,
}); });
userData.rep++; userData.rep++;
@ -64,8 +64,8 @@ class Rep extends BaseCommand {
content: `${user}`, content: `${user}`,
files: [{ files: [{
name: "achievement_unlocked6.png", name: "achievement_unlocked6.png",
attachment: "./assets/img/achievements/achievement_unlocked6.png" attachment: "./assets/img/achievements/achievement_unlocked6.png",
}] }],
}); });
} }
userData.markModified("achievements.rep"); userData.markModified("achievements.rep");
@ -73,7 +73,7 @@ class Rep extends BaseCommand {
await userData.save(); await userData.save();
interaction.success("economy/rep:SUCCESS", { interaction.success("economy/rep:SUCCESS", {
user: user.toString() user: user.toString(),
}); });
} }
} }

View file

@ -20,7 +20,7 @@ class Rob extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -45,7 +45,7 @@ class Rob extends BaseCommand {
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
if (amount > memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_MEMBER", { user: member.toString() }); if (amount > memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_MEMBER", { user: member.toString() });
@ -57,7 +57,7 @@ class Rob extends BaseCommand {
const potentiallyLose = Math.floor(amount * 1.5); const potentiallyLose = Math.floor(amount * 1.5);
if (potentiallyLose > data.memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_AUTHOR", { if (potentiallyLose > data.memberData.money) return interaction.error("economy/rob:NOT_ENOUGH_AUTHOR", {
moneyMin: `**${potentiallyLose}** ${client.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, moneyMin: `**${potentiallyLose}** ${client.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.getNoun(data.memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` moneyCurrent: `**${data.memberData.money}** ${client.getNoun(data.memberData.money, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
}); });
const itsAWon = Math.floor(client.functions.randomNum(0, 100) < 25); const itsAWon = Math.floor(client.functions.randomNum(0, 100) < 25);
@ -70,7 +70,7 @@ class Rob extends BaseCommand {
const randomNum = client.functions.randomNum(1, 2); const randomNum = client.functions.randomNum(1, 2);
interaction.replyT("economy/rob:ROB_WON_" + randomNum, { interaction.replyT("economy/rob:ROB_WON_" + randomNum, {
money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
user: member.toString() user: member.toString(),
}); });
data.memberData.money += amount; data.memberData.money += amount;
memberData.money -= amount; memberData.money -= amount;
@ -82,7 +82,7 @@ class Rob extends BaseCommand {
interaction.replyT("economy/rob:ROB_LOSE_" + randomNum, { interaction.replyT("economy/rob:ROB_LOSE_" + randomNum, {
fine: `**${potentiallyLose}** ${client.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, fine: `**${potentiallyLose}** ${client.getNoun(potentiallyLose, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
offset: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, offset: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
user: member.toString() user: member.toString(),
}); });
data.memberData.money -= potentiallyLose; data.memberData.money -= potentiallyLose;
memberData.money += won; memberData.money += won;

View file

@ -17,7 +17,7 @@ class Setbio extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**

View file

@ -17,7 +17,7 @@ class Slots extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -48,7 +48,7 @@ class Slots extends BaseCommand {
const colonnes = [ const colonnes = [
client.functions.shuffle(fruits), client.functions.shuffle(fruits),
client.functions.shuffle(fruits), client.functions.shuffle(fruits),
client.functions.shuffle(fruits) client.functions.shuffle(fruits),
]; ];
function getCredits(number, isJackpot) { function getCredits(number, isJackpot) {
@ -87,7 +87,7 @@ class Slots extends BaseCommand {
if ((colonnes[0][i2] == colonnes[1][j2]) && (colonnes[1][j2] == colonnes[2][k2])) { if ((colonnes[0][i2] == colonnes[1][j2]) && (colonnes[1][j2] == colonnes[2][k2])) {
msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |"; msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |";
await interaction.editReply({ await interaction.editReply({
content: msg content: msg,
}); });
const credits = getCredits(amount, true); const credits = getCredits(amount, true);
@ -95,8 +95,8 @@ class Slots extends BaseCommand {
content: "**!! ДЖЕКПОТ !!**\n" + interaction.translate("economy/slots:VICTORY", { content: "**!! ДЖЕКПОТ !!**\n" + interaction.translate("economy/slots:VICTORY", {
money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
won: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, won: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
user: interaction.member.toString() user: interaction.member.toString(),
}) }),
}); });
const toAdd = credits - amount; const toAdd = credits - amount;
@ -107,7 +107,7 @@ class Slots extends BaseCommand {
user: interaction.translate("economy/slots:DESCRIPTION"), user: interaction.translate("economy/slots:DESCRIPTION"),
amount: toAdd, amount: toAdd,
date: Date.now(), date: Date.now(),
type: "got" type: "got",
}; };
data.memberData.transactions.push(info); data.memberData.transactions.push(info);
@ -118,8 +118,8 @@ class Slots extends BaseCommand {
interaction.followUp({ interaction.followUp({
files: [{ files: [{
name: "achievement_unlocked4.png", name: "achievement_unlocked4.png",
attachment: "./assets/img/achievements/achievement_unlocked4.png" attachment: "./assets/img/achievements/achievement_unlocked4.png",
}] }],
}); });
} }
data.userData.markModified("achievements.slots"); data.userData.markModified("achievements.slots");
@ -132,7 +132,7 @@ class Slots extends BaseCommand {
if (colonnes[0][i2] == colonnes[1][j2] || colonnes[1][j2] == colonnes[2][k2] || colonnes[0][i2] == colonnes[2][k2]) { if (colonnes[0][i2] == colonnes[1][j2] || colonnes[1][j2] == colonnes[2][k2] || colonnes[0][i2] == colonnes[2][k2]) {
msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |"; msg += "| : : : **" + (interaction.translate("common:VICTORY").toUpperCase()) + "** : : : |";
await interaction.editReply({ await interaction.editReply({
content: msg content: msg,
}); });
const credits = getCredits(amount, false); const credits = getCredits(amount, false);
@ -140,8 +140,8 @@ class Slots extends BaseCommand {
content: interaction.translate("economy/slots:VICTORY", { content: interaction.translate("economy/slots:VICTORY", {
money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
won: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, won: `**${credits}** ${client.getNoun(credits, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
user: interaction.member.toString() user: interaction.member.toString(),
}) }),
}); });
const toAdd = credits - amount; const toAdd = credits - amount;
@ -149,7 +149,7 @@ class Slots extends BaseCommand {
user: interaction.translate("economy/slots:DESCRIPTION"), user: interaction.translate("economy/slots:DESCRIPTION"),
amount: toAdd, amount: toAdd,
date: Date.now(), date: Date.now(),
type: "got" type: "got",
}; };
data.memberData.transactions.push(info); data.memberData.transactions.push(info);
data.memberData.money += toAdd; data.memberData.money += toAdd;
@ -161,8 +161,8 @@ class Slots extends BaseCommand {
interaction.followUp({ interaction.followUp({
files: [{ files: [{
name: "achievement_unlocked4.png", name: "achievement_unlocked4.png",
attachment: "./assets/img/achievements/achievement_unlocked4.png" attachment: "./assets/img/achievements/achievement_unlocked4.png",
}] }],
}); });
} }
data.userData.markModified("achievements.slots"); data.userData.markModified("achievements.slots");
@ -176,15 +176,15 @@ class Slots extends BaseCommand {
interaction.followUp({ interaction.followUp({
content: interaction.translate("economy/slots:DEFEAT", { content: interaction.translate("economy/slots:DEFEAT", {
money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`, money: `**${amount}** ${client.getNoun(amount, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
user: interaction.member.toString() user: interaction.member.toString(),
}) }),
}); });
const info = { const info = {
user: interaction.translate("economy/slots:DESCRIPTION"), user: interaction.translate("economy/slots:DESCRIPTION"),
amount: amount, amount: amount,
date: Date.now(), date: Date.now(),
type: "send" type: "send",
}; };
data.memberData.transactions.push(info); data.memberData.transactions.push(info);
data.memberData.money -= amount; data.memberData.money -= amount;
@ -216,7 +216,7 @@ class Slots extends BaseCommand {
msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n"; msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n";
await interaction.editReply({ await interaction.editReply({
content: msg content: msg,
}); });
} }
} }

View file

@ -18,7 +18,7 @@ class TicTacToe extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -38,11 +38,11 @@ class TicTacToe extends BaseCommand {
tictactoe(interaction, { tictactoe(interaction, {
resultBtn: true, resultBtn: true,
embedColor: client.config.embed.color, embedColor: client.config.embed.color,
embedFoot: client.config.embed.footer embedFoot: client.config.embed.footer,
}).then(async winner => { }).then(async winner => {
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: winner.id, id: winner.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
memberData.money += 100; memberData.money += 100;
@ -52,7 +52,7 @@ class TicTacToe extends BaseCommand {
user: interaction.translate("economy/transactions:TTT"), user: interaction.translate("economy/transactions:TTT"),
amount: 100, amount: 100,
date: Date.now(), date: Date.now(),
type: "got" type: "got",
}; };
memberData.transactions.push(info); memberData.transactions.push(info);
}); });

View file

@ -16,7 +16,7 @@ class Transactions extends BaseCommand {
.setDescription(client.translate("economy/transactions:CLEAR"))), .setDescription(client.translate("economy/transactions:CLEAR"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -43,11 +43,11 @@ class Transactions extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("economy/transactions:EMBED_TRANSACTIONS"), name: interaction.translate("economy/transactions:EMBED_TRANSACTIONS"),
iconURL: interaction.member.displayAvatarURL() iconURL: interaction.member.displayAvatarURL(),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
const transactions = data.memberData.transactions, const transactions = data.memberData.transactions,
@ -65,20 +65,20 @@ class Transactions extends BaseCommand {
{ {
name: interaction.translate("economy/transactions:T_GOT"), name: interaction.translate("economy/transactions:T_GOT"),
value: sortedTransactions[0].join("\n"), value: sortedTransactions[0].join("\n"),
inline: true inline: true,
} },
]); ]);
if (sortedTransactions[1].length > 0) embed.addFields([ if (sortedTransactions[1].length > 0) embed.addFields([
{ {
name: interaction.translate("economy/transactions:T_SEND"), name: interaction.translate("economy/transactions:T_SEND"),
value: sortedTransactions[1].join("\n"), value: sortedTransactions[1].join("\n"),
inline: true inline: true,
} },
]); ]);
} }
interaction.reply({ interaction.reply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -14,7 +14,7 @@ class Work extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -34,7 +34,7 @@ class Work extends BaseCommand {
const isInCooldown = data.memberData.cooldowns?.work; const isInCooldown = data.memberData.cooldowns?.work;
if (isInCooldown) { if (isInCooldown) {
if (isInCooldown > Date.now()) return interaction.error("economy/work:COOLDOWN", { if (isInCooldown > Date.now()) return interaction.error("economy/work:COOLDOWN", {
time: client.convertTime(isInCooldown, true, true, data.guildData.language) time: client.convertTime(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;
@ -49,7 +49,7 @@ class Work extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setFooter({ .setFooter({
text: interaction.translate("economy/work:AWARD"), text: interaction.translate("economy/work:AWARD"),
iconURL: interaction.member.displayAvatarURL() iconURL: interaction.member.displayAvatarURL(),
}) })
.setColor(client.config.embed.color); .setColor(client.config.embed.color);
@ -58,7 +58,7 @@ class Work extends BaseCommand {
client.customEmojis.letters.w, client.customEmojis.letters.w,
client.customEmojis.letters.a, client.customEmojis.letters.a,
client.customEmojis.letters.r, client.customEmojis.letters.r,
client.customEmojis.letters.d client.customEmojis.letters.d,
]; ];
let won = 200; let won = 200;
@ -68,13 +68,13 @@ class Work extends BaseCommand {
{ {
name: interaction.translate("economy/work:SALARY"), name: interaction.translate("economy/work:SALARY"),
value: interaction.translate("economy/work:SALARY_CONTENT", { value: interaction.translate("economy/work:SALARY_CONTENT", {
won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
}) }),
}, },
{ {
name: interaction.translate("economy/work:STREAK"), name: interaction.translate("economy/work:STREAK"),
value: interaction.translate("economy/work:STREAK_CONTENT") value: interaction.translate("economy/work:STREAK_CONTENT"),
} },
]); ]);
data.memberData.workStreak = 0; data.memberData.workStreak = 0;
} else { } else {
@ -88,13 +88,13 @@ class Work extends BaseCommand {
{ {
name: interaction.translate("economy/work:SALARY"), name: interaction.translate("economy/work:SALARY"),
value: interaction.translate("economy/work:SALARY_CONTENT", { value: interaction.translate("economy/work:SALARY_CONTENT", {
won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}` won: `**${won}** ${client.getNoun(won, interaction.translate("misc:NOUNS:CREDIT:1"), interaction.translate("misc:NOUNS:CREDIT:2"), interaction.translate("misc:NOUNS:CREDIT:5"))}`,
}) }),
}, },
{ {
name: interaction.translate("economy/work:STREAK"), name: interaction.translate("economy/work:STREAK"),
value: award.join("") value: award.join(""),
} },
]); ]);
} }
@ -105,19 +105,19 @@ class Work extends BaseCommand {
user: interaction.translate("economy/work:SALARY"), user: interaction.translate("economy/work:SALARY"),
amount: won, amount: won,
date: Date.now(), date: Date.now(),
type: "got" type: "got",
}; };
data.memberData.transactions.push(info); data.memberData.transactions.push(info);
const messageOptions = { const messageOptions = {
embeds: [embed] embeds: [embed],
}; };
if (!data.userData.achievements.work.achieved) { if (!data.userData.achievements.work.achieved) {
data.userData.achievements.work.progress.now += 1; data.userData.achievements.work.progress.now += 1;
if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) { if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) {
messageOptions.files = [{ messageOptions.files = [{
name: "unlocked.png", name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked1.png" attachment: "./assets/img/achievements/achievement_unlocked1.png",
}]; }];
data.userData.achievements.work.achieved = true; data.userData.achievements.work.achieved = true;
} }

View file

@ -17,7 +17,7 @@ class Eightball extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -42,7 +42,7 @@ class Eightball extends BaseCommand {
interaction.replyT("fun/8ball:ANSWER", { interaction.replyT("fun/8ball:ANSWER", {
question, question,
answer answer,
}, { edit: true }); }, { edit: true });
} }
} }

View file

@ -15,7 +15,7 @@ class Cat extends BaseCommand {
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -37,7 +37,7 @@ class Cat extends BaseCommand {
const res = await fetch("https://and-here-is-my-code.glitch.me/img/cat").then(response => response.json()); const res = await fetch("https://and-here-is-my-code.glitch.me/img/cat").then(response => response.json());
interaction.editReply({ interaction.editReply({
content: res.Link content: res.Link,
}); });
} }
} }

View file

@ -15,7 +15,7 @@ class Crab extends BaseCommand {
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -37,7 +37,7 @@ class Crab extends BaseCommand {
const res = await fetch("https://and-here-is-my-code.glitch.me/img/crab").then(response => response.json()); const res = await fetch("https://and-here-is-my-code.glitch.me/img/crab").then(response => response.json());
interaction.editReply({ interaction.editReply({
content: res.Link content: res.Link,
}); });
} }
} }

View file

@ -15,7 +15,7 @@ class Dog extends BaseCommand {
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -37,7 +37,7 @@ class Dog extends BaseCommand {
const res = await fetch("https://and-here-is-my-code.glitch.me/img/dog").then(response => response.json()); const res = await fetch("https://and-here-is-my-code.glitch.me/img/dog").then(response => response.json());
interaction.editReply({ interaction.editReply({
content: res.Link content: res.Link,
}); });
} }
} }

View file

@ -21,7 +21,7 @@ class LMGTFY extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -47,12 +47,12 @@ class LMGTFY extends BaseCommand {
interaction.reply({ interaction.reply({
content: `<${res}>`, content: `<${res}>`,
ephemeral: true ephemeral: true,
}); });
} else { } else {
interaction.reply({ interaction.reply({
content: `<${url}>`, content: `<${url}>`,
ephemeral: true ephemeral: true,
}); });
} }
} }

View file

@ -22,7 +22,7 @@ class Lovecalc extends BaseCommand {
.setDescription(client.translate("common:USER"))), .setDescription(client.translate("common:USER"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -53,20 +53,20 @@ class Lovecalc extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}` name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}`,
}) })
.setDescription(interaction.translate("fun/lovecalc:CONTENT", { .setDescription(interaction.translate("fun/lovecalc:CONTENT", {
percent, percent,
firstMember: firstMember, firstMember: firstMember,
secondMember: secondMember secondMember: secondMember,
})) }))
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
interaction.reply({ interaction.reply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -15,7 +15,7 @@ class Memes extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -37,8 +37,8 @@ class Memes extends BaseCommand {
const tags = ["memes", "dankmemes", "me_irl", "wholesomememes"].map(tag => const tags = ["memes", "dankmemes", "me_irl", "wholesomememes"].map(tag =>
JSON.parse(JSON.stringify({ JSON.parse(JSON.stringify({
label: tag, label: tag,
value: tag value: tag,
})) })),
); );
const row = new ActionRowBuilder() const row = new ActionRowBuilder()
@ -46,13 +46,13 @@ class Memes extends BaseCommand {
new SelectMenuBuilder() new SelectMenuBuilder()
.setCustomId("memes_select") .setCustomId("memes_select")
.setPlaceholder(client.translate("common:NOTHING_SELECTED")) .setPlaceholder(client.translate("common:NOTHING_SELECTED"))
.addOptions(tags) .addOptions(tags),
); );
const msg = await interaction.editReply({ const msg = await interaction.editReply({
content: interaction.translate("common:AVAILABLE_OPTIONS"), content: interaction.translate("common:AVAILABLE_OPTIONS"),
fetchReply: true, fetchReply: true,
components: [row] components: [row],
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
@ -68,7 +68,7 @@ class Memes extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.setTitle(res.title) .setTitle(res.title)
.setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`) .setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`)
@ -76,14 +76,14 @@ class Memes extends BaseCommand {
.setTimestamp(); .setTimestamp();
await interaction.editReply({ await interaction.editReply({
embeds: [embed] embeds: [embed],
}); });
} }
}); });
collector.on("end", () => { collector.on("end", () => {
return interaction.editReply({ return interaction.editReply({
components: [] components: [],
}); });
}); });
} }

View file

@ -15,7 +15,7 @@ class Activity extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -43,7 +43,7 @@ class Activity extends BaseCommand {
const activities = defaultApplications.map(a => { const activities = defaultApplications.map(a => {
return { return {
label: `${a.name} ${a.premium_tier_level ? `(${interaction.translate("general/activity:BOOST_NEEDED")})` : ""}`, label: `${a.name} ${a.premium_tier_level ? `(${interaction.translate("general/activity:BOOST_NEEDED")})` : ""}`,
value: a.id value: a.id,
}; };
}); });
@ -52,12 +52,12 @@ class Activity extends BaseCommand {
new SelectMenuBuilder() new SelectMenuBuilder()
.setCustomId("activity_select") .setCustomId("activity_select")
.setPlaceholder(client.translate("common:NOTHING_SELECTED")) .setPlaceholder(client.translate("common:NOTHING_SELECTED"))
.addOptions(activities) .addOptions(activities),
); );
await interaction.editReply({ await interaction.editReply({
content: interaction.translate("general/activity:AVAILABLE_ACTIVITIES"), content: interaction.translate("general/activity:AVAILABLE_ACTIVITIES"),
components: [row] components: [row],
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
@ -73,23 +73,23 @@ class Activity extends BaseCommand {
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setDescription(`**[${interaction.translate("general/activity:CLICK_HERE", { .setDescription(`**[${interaction.translate("general/activity:CLICK_HERE", {
activity: defaultApplications.find(a => a.id === activity).name, activity: defaultApplications.find(a => a.id === activity).name,
channel: voice.name channel: voice.name,
})}](${invite.code})**`) })}](${invite.code})**`)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.setTimestamp(); .setTimestamp();
await interaction.editReply({ await interaction.editReply({
embeds: [embed], embeds: [embed],
components: [] components: [],
}); });
} }
}); });
collector.on("end", () => { collector.on("end", () => {
return interaction.editReply({ return interaction.editReply({
components: [] components: [],
}); });
}); });
} }

View file

@ -17,7 +17,7 @@ class Afk extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -40,7 +40,7 @@ class Afk extends BaseCommand {
data.userData.save(); data.userData.save();
interaction.success("general/afk:SUCCESS", { interaction.success("general/afk:SUCCESS", {
reason reason,
}, { ephemeral: true }); }, { ephemeral: true });
} }
} }

View file

@ -16,7 +16,7 @@ class Avatar extends BaseCommand {
.setDescription(client.translate("common:USER"))), .setDescription(client.translate("common:USER"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -35,13 +35,13 @@ class Avatar extends BaseCommand {
async execute(client, interaction) { async execute(client, interaction) {
const user = interaction.options.getUser("user") || interaction.user; const user = interaction.options.getUser("user") || interaction.user;
const avatarURL = user.displayAvatarURL({ const avatarURL = user.displayAvatarURL({
size: 512 size: 512,
}); });
interaction.reply({ interaction.reply({
files: [{ files: [{
attachment: avatarURL attachment: avatarURL,
}] }],
}); });
} }
} }

View file

@ -17,7 +17,7 @@ class Emoji extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -40,34 +40,34 @@ class Emoji extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("general/emoji:TITLE", { name: interaction.translate("general/emoji:TITLE", {
emoji: parsedEmoji.name emoji: parsedEmoji.name,
}) }),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.addFields([ .addFields([
{ {
name: interaction.translate("common:NAME"), name: interaction.translate("common:NAME"),
value: parsedEmoji.name value: parsedEmoji.name,
}, },
{ {
name: interaction.translate("general/emoji:ANIMATED"), name: interaction.translate("general/emoji:ANIMATED"),
value: parsedEmoji.animated ? interaction.translate("common:YES") : interaction.translate("common:NO") value: parsedEmoji.animated ? interaction.translate("common:YES") : interaction.translate("common:NO"),
}, },
{ {
name: interaction.translate("common:ID"), name: interaction.translate("common:ID"),
value: parsedEmoji.id?.toString() || interaction.translate("general/emoji:STANDART") value: parsedEmoji.id?.toString() || interaction.translate("general/emoji:STANDART"),
}, },
{ {
name: interaction.translate("general/emoji:LINK"), name: interaction.translate("general/emoji:LINK"),
value: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${parsedEmoji.animated ? "gif" : "png"}` value: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${parsedEmoji.animated ? "gif" : "png"}`,
} },
]); ]);
interaction.reply({ interaction.reply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -17,7 +17,7 @@ class Help extends BaseCommand {
.setDescription(client.translate("common:COMMAND"))), .setDescription(client.translate("common:COMMAND"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -52,7 +52,7 @@ class Help extends BaseCommand {
const categoriesRows = categories.sort().map(c => { const categoriesRows = categories.sort().map(c => {
return { return {
label: `${c} (${commands.filter(cmd => cmd.category === c).length})`, label: `${c} (${commands.filter(cmd => cmd.category === c).length})`,
value: c value: c,
}; };
}); });
@ -61,13 +61,13 @@ class Help extends BaseCommand {
new SelectMenuBuilder() new SelectMenuBuilder()
.setCustomId("help_category_select") .setCustomId("help_category_select")
.setPlaceholder(client.translate("common:NOTHING_SELECTED")) .setPlaceholder(client.translate("common:NOTHING_SELECTED"))
.addOptions(categoriesRows) .addOptions(categoriesRows),
); );
const msg = await interaction.editReply({ const msg = await interaction.editReply({
content: interaction.translate("common:AVAILABLE_OPTIONS"), content: interaction.translate("common:AVAILABLE_OPTIONS"),
fetchReply: true, fetchReply: true,
components: [row] components: [row],
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
@ -81,36 +81,36 @@ class Help extends BaseCommand {
const categoryCommands = commands.filter(cmd => cmd.category === arg).map(c => { const categoryCommands = commands.filter(cmd => cmd.category === arg).map(c => {
return { return {
name: `**${c.command.name}**`, name: `**${c.command.name}**`,
value: interaction.translate(`${arg.toLowerCase()}/${c.command.name}:DESCRIPTION`) value: interaction.translate(`${arg.toLowerCase()}/${c.command.name}:DESCRIPTION`),
}; };
}); });
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.setAuthor({ .setAuthor({
name: interaction.translate("general/help:COMMANDS_IN", { category: arg }) name: interaction.translate("general/help:COMMANDS_IN", { category: arg }),
}) })
.addFields(categoryCommands) .addFields(categoryCommands)
.addFields([ .addFields([
{ {
name: "\u200B", name: "\u200B",
value: interaction.translate("general/help:INFO") value: interaction.translate("general/help:INFO"),
} },
]); ]);
return interaction.editReply({ return interaction.editReply({
content: null, content: null,
embeds: [embed] embeds: [embed],
}); });
} }
}); });
collector.on("end", () => { collector.on("end", () => {
return interaction.editReply({ return interaction.editReply({
components: [] components: [],
}); });
}); });
} }
@ -132,21 +132,21 @@ function generateCommandHelp(interaction, command) {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("general/help:CMD_TITLE", { name: interaction.translate("general/help:CMD_TITLE", {
cmd: cmd.command.name cmd: cmd.command.name,
}) }),
}) })
.addFields([ .addFields([
{ {
name: interaction.translate("general/help:FIELD_DESCRIPTION"), name: interaction.translate("general/help:FIELD_DESCRIPTION"),
value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`) value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`),
}, },
{ {
name: interaction.translate("general/help:FIELD_USAGE"), name: interaction.translate("general/help:FIELD_USAGE"),
value: `*${cmd.command.dm_permission === false ? interaction.translate("general/help:GUILD_ONLY") : interaction.translate("general/help:NOT_GUILD_ONLY")}*\n\n` + usage value: `*${cmd.command.dm_permission === false ? interaction.translate("general/help:GUILD_ONLY") : interaction.translate("general/help:NOT_GUILD_ONLY")}*\n\n` + usage,
}, },
{ {
name: interaction.translate("general/help:FIELD_EXAMPLES"), name: interaction.translate("general/help:FIELD_EXAMPLES"),
value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:EXAMPLES`) value: interaction.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:EXAMPLES`),
}, },
// { // {
// name: interaction.translate("general/help:FIELD_ALIASES"), // name: interaction.translate("general/help:FIELD_ALIASES"),
@ -154,12 +154,12 @@ function generateCommandHelp(interaction, command) {
// }, // },
{ {
name: interaction.translate("general/help:FIELD_PERMISSIONS"), name: interaction.translate("general/help:FIELD_PERMISSIONS"),
value: cmd.command.default_member_permissions > 0 ? interaction.translate(`misc:PERMISSIONS:${getPermName(cmd.command.default_member_permissions)}`) : interaction.translate("general/help:NO_REQUIRED_PERMISSION") value: cmd.command.default_member_permissions > 0 ? interaction.translate(`misc:PERMISSIONS:${getPermName(cmd.command.default_member_permissions)}`) : interaction.translate("general/help:NO_REQUIRED_PERMISSION"),
} },
]) ])
.setColor(interaction.client.config.embed.color) .setColor(interaction.client.config.embed.color)
.setFooter({ .setFooter({
text: interaction.client.config.embed.footer text: interaction.client.config.embed.footer,
}); });
return embed; return embed;

View file

@ -18,7 +18,7 @@ class Minecraft extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -40,7 +40,7 @@ class Minecraft extends BaseCommand {
const ip = interaction.options.getString("ip"); const ip = interaction.options.getString("ip");
const options = { const options = {
type: "minecraft", type: "minecraft",
host: ip host: ip,
}; };
if (ip.split(":").length > 1) { if (ip.split(":").length > 1) {
@ -49,7 +49,7 @@ class Minecraft extends BaseCommand {
options.port = splitIp[1]; options.port = splitIp[1];
} }
var res = await gamedig.query(options).catch(() => {}); let res = await gamedig.query(options).catch(() => {});
if (!res) { if (!res) {
options.type = "minecraftpe"; options.type = "minecraftpe";
@ -60,41 +60,41 @@ class Minecraft extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: res.name name: res.name,
}) })
.addFields([ .addFields([
{ {
name: interaction.translate("general/minecraft:FIELD_STATUS"), name: interaction.translate("general/minecraft:FIELD_STATUS"),
value: interaction.translate("general/minecraft:ONLINE") value: interaction.translate("general/minecraft:ONLINE"),
}, },
{ {
name: interaction.translate("general/minecraft:FIELD_CONNECTED"), name: interaction.translate("general/minecraft:FIELD_CONNECTED"),
value: `**${(res.raw.players ? res.raw.players.online : res.players.length)}** ${client.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.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.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.getNoun((res.raw.players ? res.raw.players.max : res.maxplayers), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))}`,
}, },
{ {
name: interaction.translate("general/minecraft:FIELD_IP"), name: interaction.translate("general/minecraft:FIELD_IP"),
value: res.connect, value: res.connect,
inline: true inline: true,
}, },
{ {
name: interaction.translate("general/minecraft:FIELD_VERSION"), name: interaction.translate("general/minecraft:FIELD_VERSION"),
value: res.raw.vanilla.raw.version.name, value: res.raw.vanilla.raw.version.name,
inline: true inline: true,
}, },
{ {
name: interaction.translate("general/minecraft:FIELD_PING"), name: interaction.translate("general/minecraft:FIELD_PING"),
value: res.raw.vanilla.ping.toString() value: res.raw.vanilla.ping.toString(),
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setThumbnail(`https://eu.mc-api.net/v3/server/favicon/${ip}`) .setThumbnail(`https://eu.mc-api.net/v3/server/favicon/${ip}`)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
interaction.editReply({ interaction.editReply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -14,7 +14,7 @@ class Ping extends BaseCommand {
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -32,7 +32,7 @@ class Ping extends BaseCommand {
*/ */
async execute(client, interaction) { async execute(client, interaction) {
interaction.replyT("general/ping:CONTENT", { interaction.replyT("general/ping:CONTENT", {
ping: Math.round(client.ws.ping) ping: Math.round(client.ws.ping),
}); });
} }
} }

View file

@ -22,7 +22,7 @@ class Remindme extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -49,7 +49,7 @@ class Remindme extends BaseCommand {
const rData = { const rData = {
message: message, message: message,
createdAt: dateNow, createdAt: dateNow,
sendAt: dateNow + ms(time) sendAt: dateNow + ms(time),
}; };
data.userData.reminds.push(rData); data.userData.reminds.push(rData);
@ -59,7 +59,7 @@ class Remindme extends BaseCommand {
interaction.success("general/remindme:SAVED", { interaction.success("general/remindme:SAVED", {
message, message,
time: moment(rData.createdAt).locale(interaction.guild.data.language).format("dddd, Do MMMM YYYY, HH:mm:ss") time: moment(rData.createdAt).locale(interaction.guild.data.language).format("dddd, Do MMMM YYYY, HH:mm:ss"),
}, { edit: true }); }, { edit: true });
} }
} }

View file

@ -20,7 +20,7 @@ class Report extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -46,51 +46,51 @@ class Report extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("general/report:TITLE", { name: interaction.translate("general/report:TITLE", {
user: member.user.tag user: member.user.tag,
}), }),
iconURL: interaction.user.displayAvatarURL({ iconURL: interaction.user.displayAvatarURL({
extension: "png", extension: "png",
size: 512 size: 512,
}) }),
}) })
.addFields([ .addFields([
{ {
name: interaction.translate("common:DATE"), name: interaction.translate("common:DATE"),
value: client.printDate(new Date(Date.now())) value: client.printDate(new Date(Date.now())),
}, },
{ {
name: interaction.translate("common:AUTHOR"), name: interaction.translate("common:AUTHOR"),
value: interaction.user.toString(), value: interaction.user.toString(),
inline: true inline: true,
}, },
{ {
name: interaction.translate("common:USER"), name: interaction.translate("common:USER"),
value: member.user.toString(), value: member.user.toString(),
inline: true inline: true,
}, },
{ {
name: interaction.translate("common:REASON"), name: interaction.translate("common:REASON"),
value: rep, value: rep,
inline: true inline: true,
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
const success = parseEmoji(client.customEmojis.cool).id; const success = parseEmoji(client.customEmojis.cool).id;
const error = parseEmoji(client.customEmojis.notcool).id; const error = parseEmoji(client.customEmojis.notcool).id;
repChannel.send({ repChannel.send({
embeds: [embed] embeds: [embed],
}).then(async m => { }).then(async m => {
await m.react(success); await m.react(success);
await m.react(error); await m.react(error);
}); });
interaction.success("general/report:SUCCESS", { interaction.success("general/report:SUCCESS", {
channel: repChannel.toString() channel: repChannel.toString(),
}); });
} }
} }

View file

@ -14,7 +14,7 @@ class Serverinfo extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -39,66 +39,66 @@ class Serverinfo extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: guild.name, name: guild.name,
iconURL: guild.iconURL() iconURL: guild.iconURL(),
}) })
.setThumbnail(guild.iconURL()) .setThumbnail(guild.iconURL())
.addFields([ .addFields([
{ {
name: client.customEmojis.link + " " + interaction.translate("general/serverinfo:LINK"), name: client.customEmojis.link + " " + interaction.translate("general/serverinfo:LINK"),
value: `[${interaction.translate("general/serverinfo:LINK_TEXT")}](${client.config.dashboard.baseURL}/stats/${guild.id})` value: `[${interaction.translate("general/serverinfo:LINK_TEXT")}](${client.config.dashboard.baseURL}/stats/${guild.id})`,
}, },
{ {
name: client.customEmojis.title + interaction.translate("common:NAME"), name: client.customEmojis.title + interaction.translate("common:NAME"),
value: guild.name, value: guild.name,
inline: true inline: true,
}, },
{ {
name: client.customEmojis.calendar + interaction.translate("common:CREATION"), name: client.customEmojis.calendar + interaction.translate("common:CREATION"),
value: client.printDate(guild.createdAt), value: client.printDate(guild.createdAt),
inline: true inline: true,
}, },
{ {
name: client.customEmojis.users + interaction.translate("common:MEMBERS"), name: client.customEmojis.users + interaction.translate("common:MEMBERS"),
value: `${guild.members.cache.filter(m => !m.user.bot).size} ${client.getNoun(guild.members.cache.filter(m => !m.user.bot).size, interaction.translate("misc:NOUNS:MEMBERS:1"), interaction.translate("misc:NOUNS:MEMBERS:2"), interaction.translate("misc:NOUNS:MEMBERS:5"))}` + value: `${guild.members.cache.filter(m => !m.user.bot).size} ${client.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.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"))}`, "\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${client.getNoun(guild.members.cache.filter(m => m.user.bot).size, interaction.translate("misc:NOUNS:BOTS:1"), interaction.translate("misc:NOUNS:BOTS:2"), interaction.translate("misc:NOUNS:BOTS:5"))}`,
inline: true inline: true,
}, },
{ {
name: client.customEmojis.afk + interaction.translate("general/serverinfo:AFK_CHANNEL"), name: client.customEmojis.afk + interaction.translate("general/serverinfo:AFK_CHANNEL"),
value: guild.afkChannel?.toString() || interaction.translate("common:MISSING"), value: guild.afkChannel?.toString() || interaction.translate("common:MISSING"),
inline: true inline: true,
}, },
{ {
name: client.customEmojis.id + interaction.translate("common:SERVER_ID"), name: client.customEmojis.id + interaction.translate("common:SERVER_ID"),
value: guild.id, value: guild.id,
inline: true inline: true,
}, },
{ {
name: client.customEmojis.crown + interaction.translate("common:OWNER"), name: client.customEmojis.crown + interaction.translate("common:OWNER"),
value: owner.toString(), value: owner.toString(),
inline: true inline: true,
}, },
{ {
name: client.customEmojis.boost + interaction.translate("general/serverinfo:BOOSTS"), name: client.customEmojis.boost + interaction.translate("general/serverinfo:BOOSTS"),
value: guild.premiumSubscriptionCount?.toString() || "0", value: guild.premiumSubscriptionCount?.toString() || "0",
inline: true inline: true,
}, },
{ {
name: client.customEmojis.channels + interaction.translate("common:CHANNELS"), name: client.customEmojis.channels + interaction.translate("common:CHANNELS"),
value: `${guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size} ${client.getNoun(guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size, interaction.translate("misc:NOUNS:TEXT:1"), interaction.translate("misc:NOUNS:TEXT:2"), interaction.translate("misc:NOUNS:TEXT:5"))}` + value: `${guild.channels.cache.filter(c => c.type === ChannelType.GuildText).size} ${client.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.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.GuildVoice).size} ${client.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.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"))}`, "\n" + `${guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size} ${client.getNoun(guild.channels.cache.filter(c => c.type === ChannelType.GuildCategory).size, interaction.translate("misc:NOUNS:CATEGORY:1"), interaction.translate("misc:NOUNS:CATEGORY:2"), interaction.translate("misc:NOUNS:CATEGORY:5"))}`,
inline: true inline: true,
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
interaction.reply({ interaction.reply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -18,7 +18,7 @@ class Shorturl extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -40,7 +40,7 @@ class Shorturl extends BaseCommand {
interaction.reply({ interaction.reply({
content: `<${res}>`, content: `<${res}>`,
ephemeral: true ephemeral: true,
}); });
} }
} }

View file

@ -14,7 +14,7 @@ class Staff extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -37,26 +37,26 @@ class Staff extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("general/staff:TITLE", { name: interaction.translate("general/staff:TITLE", {
guild: interaction.guild.name guild: interaction.guild.name,
}) }),
}) })
.addFields([ .addFields([
{ {
name: interaction.translate("general/staff:ADMINS"), name: interaction.translate("general/staff:ADMINS"),
value: (administrators.size > 0 ? administrators.map((a) => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : interaction.translate("general/staff:NO_ADMINS")) value: (administrators.size > 0 ? administrators.map((a) => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : interaction.translate("general/staff:NO_ADMINS")),
}, },
{ {
name: interaction.translate("general/staff:MODS"), name: interaction.translate("general/staff:MODS"),
value: (moderators.size > 0 ? moderators.map((m) => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS")) value: (moderators.size > 0 ? moderators.map((m) => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS")),
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
interaction.reply({ interaction.reply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -1,4 +1,3 @@
const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField, version } = require("discord.js"); const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField, version } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
@ -15,7 +14,7 @@ class Stats extends BaseCommand {
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -39,10 +38,10 @@ class Stats extends BaseCommand {
const statsEmbed = new EmbedBuilder() const statsEmbed = new EmbedBuilder()
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.setAuthor({ .setAuthor({
name: interaction.translate("common:STATS") name: interaction.translate("common:STATS"),
}) })
.setDescription(interaction.translate("general/stats:MADE")) .setDescription(interaction.translate("general/stats:MADE"))
.addFields([ .addFields([
@ -50,35 +49,35 @@ class Stats extends BaseCommand {
name: client.customEmojis.stats + " " + interaction.translate("general/stats:COUNTS_TITLE"), name: client.customEmojis.stats + " " + interaction.translate("general/stats:COUNTS_TITLE"),
value: interaction.translate("general/stats:COUNTS_CONTENT", { value: interaction.translate("general/stats:COUNTS_CONTENT", {
servers: servers, servers: servers,
users: users users: users,
}), }),
inline: true inline: true,
}, },
{ {
name: client.customEmojis.version + " " + interaction.translate("general/stats:VERSIONS_TITLE"), name: client.customEmojis.version + " " + interaction.translate("general/stats:VERSIONS_TITLE"),
value: `\`Discord.js: v${version}\`\n\`Nodejs: v${process.versions.node}\``, value: `\`Discord.js: v${version}\`\n\`Nodejs: v${process.versions.node}\``,
inline: true inline: true,
}, },
{ {
name: client.customEmojis.ram + " " + interaction.translate("general/stats:RAM_TITLE"), name: client.customEmojis.ram + " " + interaction.translate("general/stats:RAM_TITLE"),
value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``, value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``,
inline: true inline: true,
}, },
{ {
name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"), name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"),
value: interaction.translate("general/stats:ONLINE_CONTENT", { value: interaction.translate("general/stats:ONLINE_CONTENT", {
time: client.convertTime(Date.now() + client.uptime, true, true, data.guildData.language) time: client.convertTime(Date.now() + client.uptime, true, true, data.guildData.language),
}) }),
}, },
{ {
name: client.customEmojis.voice + " " + interaction.translate("general/stats:MUSIC_TITLE"), name: client.customEmojis.voice + " " + interaction.translate("general/stats:MUSIC_TITLE"),
value: interaction.translate("general/stats:MUSIC_CONTENT", { value: interaction.translate("general/stats:MUSIC_CONTENT", {
count: `${client.player.queues.size} ${client.getNoun(client.player.queues.size, interaction.translate("misc:NOUNS:SERVERS:1"), interaction.translate("misc:NOUNS:SERVERS:2"), interaction.translate("misc:NOUNS:SERVERS:5"))}` count: `${client.player.queues.size} ${client.getNoun(client.player.queues.size, interaction.translate("misc:NOUNS:SERVERS:1"), interaction.translate("misc:NOUNS:SERVERS:2"), interaction.translate("misc:NOUNS:SERVERS:5"))}`,
}) }),
}, },
{ {
name: interaction.translate("general/stats:CREDITS_TITLE"), name: interaction.translate("general/stats:CREDITS_TITLE"),
value: interaction.translate("general/stats:CREDITS_CONTENT") value: interaction.translate("general/stats:CREDITS_CONTENT"),
}, },
{ {
name: client.customEmojis.link + " " + interaction.translate("general/stats:LINKS_TITLE"), name: client.customEmojis.link + " " + interaction.translate("general/stats:LINKS_TITLE"),
@ -87,13 +86,13 @@ class Stats extends BaseCommand {
docsLink: `${client.config.dashboard.baseURL}/docs/`, docsLink: `${client.config.dashboard.baseURL}/docs/`,
inviteLink: client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] }), inviteLink: client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] }),
donateLink: "https://qiwi.com/n/JONNYBRO/", donateLink: "https://qiwi.com/n/JONNYBRO/",
owner: client.config.owner.id owner: client.config.owner.id,
}) }),
} },
]); ]);
interaction.reply({ interaction.reply({
embeds: [statsEmbed] embeds: [statsEmbed],
}); });
} }
} }

View file

@ -17,7 +17,7 @@ class Suggest extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -41,43 +41,43 @@ class Suggest extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("general/suggest:TITLE", { name: interaction.translate("general/suggest:TITLE", {
user: interaction.user.tag user: interaction.user.tag,
}), }),
iconURL: interaction.member.displayAvatarURL() iconURL: interaction.member.displayAvatarURL(),
}) })
.addFields([ .addFields([
{ {
name: interaction.translate("common:DATE"), name: interaction.translate("common:DATE"),
value: client.printDate(new Date(Date.now())) value: client.printDate(new Date(Date.now())),
}, },
{ {
name: interaction.translate("common:AUTHOR"), name: interaction.translate("common:AUTHOR"),
value: interaction.user.toString(), value: interaction.user.toString(),
inline: true inline: true,
}, },
{ {
name: interaction.translate("common:CONTENT"), name: interaction.translate("common:CONTENT"),
value: suggestion, value: suggestion,
inline: true inline: true,
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
const success = parseEmoji(client.customEmojis.cool).id; const success = parseEmoji(client.customEmojis.cool).id;
const error = parseEmoji(client.customEmojis.notcool).id; const error = parseEmoji(client.customEmojis.notcool).id;
suggChannel.send({ suggChannel.send({
embeds: [embed] embeds: [embed],
}).then(async m => { }).then(async m => {
await m.react(success); await m.react(success);
await m.react(error); await m.react(error);
}); });
interaction.success("general/suggest:SUCCESS", { interaction.success("general/suggest:SUCCESS", {
channel: suggChannel.toString() channel: suggChannel.toString(),
}); });
} }
} }

View file

@ -16,7 +16,7 @@ class Userinfo extends BaseCommand {
.setDescription(client.translate("common:USER"))), .setDescription(client.translate("common:USER"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -37,58 +37,58 @@ class Userinfo extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: `${member.user.tag} (${member.id})`, name: `${member.user.tag} (${member.id})`,
iconURL: member.displayAvatarURL() iconURL: member.displayAvatarURL(),
}) })
.setThumbnail(member.displayAvatarURL({ .setThumbnail(member.displayAvatarURL({
size: 512 size: 512,
})) }))
.addFields([ .addFields([
{ {
name: ":man: " + interaction.translate("common:USERNAME"), name: ":man: " + interaction.translate("common:USERNAME"),
value: member.user.tag, value: member.user.tag,
inline: true inline: true,
}, },
{ {
name: client.customEmojis.pencil + " " + interaction.translate("common:NICKNAME"), name: client.customEmojis.pencil + " " + interaction.translate("common:NICKNAME"),
value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"), value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"),
inline: true inline: true,
}, },
{ {
name: client.customEmojis.status[member.presence.status] + " " + interaction.translate("common:STATUS"), name: client.customEmojis.status[member.presence.status] + " " + interaction.translate("common:STATUS"),
value: interaction.translate(`common:STATUS_${member.presence.status.toUpperCase()}`), value: interaction.translate(`common:STATUS_${member.presence.status.toUpperCase()}`),
inline: true inline: true,
}, },
{ {
name: client.customEmojis.bot + " " + interaction.translate("common:ROBOT"), name: client.customEmojis.bot + " " + interaction.translate("common:ROBOT"),
value: member.user.bot ? interaction.translate("common:YES") : interaction.translate("common:NO"), value: member.user.bot ? interaction.translate("common:YES") : interaction.translate("common:NO"),
inline: true inline: true,
}, },
{ {
name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"), name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"),
value: client.printDate(member.user.createdAt), value: client.printDate(member.user.createdAt),
inline: true inline: true,
}, },
{ {
name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"), name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOINED"),
value: client.printDate(member.joinedAt), value: client.printDate(member.joinedAt),
inline: true inline: true,
}, },
{ {
name: client.customEmojis.color + " " + interaction.translate("common:COLOR"), name: client.customEmojis.color + " " + interaction.translate("common:COLOR"),
value: member.displayHexColor, value: member.displayHexColor,
inline: true inline: true,
}, },
{ {
name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"), name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"),
value: (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 10).join(", ") + " " + interaction.translate("general/userinfo:MORE_ROLES", { value: (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 10).join(", ") + " " + interaction.translate("general/userinfo:MORE_ROLES", {
count: member.roles.cache.size - 10 count: member.roles.cache.size - 10,
}) : (member.roles.cache.size < 1) ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", ")), }) : (member.roles.cache.size < 1) ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", ")),
inline: true inline: true,
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
if (member.presence.activities[0]?.name === "Custom Status") { if (member.presence.activities[0]?.name === "Custom Status") {
@ -96,21 +96,21 @@ class Userinfo extends BaseCommand {
{ {
name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"), name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"),
value: member.presence.activities[0] ? `${interaction.translate("general/userinfo:CUSTOM")}\n${member.presence.activities[0].state || interaction.translate("common:NOT_DEFINED")}` : interaction.translate("general/userinfo:NO_ACTIVITY"), value: member.presence.activities[0] ? `${interaction.translate("general/userinfo:CUSTOM")}\n${member.presence.activities[0].state || interaction.translate("common:NOT_DEFINED")}` : interaction.translate("general/userinfo:NO_ACTIVITY"),
inline: true inline: true,
} },
]); ]);
} else { } else {
embed.addFields([ embed.addFields([
{ {
name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"), name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"),
value: member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : interaction.translate("general/userinfo:NO_ACTIVITY"), value: member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : interaction.translate("general/userinfo:NO_ACTIVITY"),
inline: true inline: true,
} },
]); ]);
} }
interaction.reply({ interaction.reply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -18,7 +18,7 @@ class Whois extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -42,10 +42,10 @@ class Whois extends BaseCommand {
if (whois.status === "fail") return interaction.editReply({ content: interaction.translate("general/whois:ERROR", { ip }) }); if (whois.status === "fail") return interaction.editReply({ content: interaction.translate("general/whois:ERROR", { ip }) });
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(interaction.translate("general/whois:INFO_ABOUT", { .setTitle(interaction.translate("general/whois:INFO_ABOUT", {
ip ip,
})) }))
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.addFields( .addFields(
@ -57,7 +57,7 @@ class Whois extends BaseCommand {
{ name: interaction.translate("general/whois:TIMEZONE"), value: `${whois.timezone || interaction.translate("common:UNKNOWN")}`, inline: true }, { name: interaction.translate("general/whois:TIMEZONE"), value: `${whois.timezone || interaction.translate("common:UNKNOWN")}`, inline: true },
{ name: interaction.translate("general/whois:CONTINENT"), value: `${whois.continent || interaction.translate("common:UNKNOWN")} (${whois.continentCode || interaction.translate("common:UNKNOWN")})`, inline: true }, { name: interaction.translate("general/whois:CONTINENT"), value: `${whois.continent || interaction.translate("common:UNKNOWN")} (${whois.continentCode || interaction.translate("common:UNKNOWN")})`, inline: true },
{ name: interaction.translate("general/whois:CURRENCY"), value: `${whois.currency || interaction.translate("common:UNKNOWN")}`, inline: true }, { name: interaction.translate("general/whois:CURRENCY"), value: `${whois.currency || interaction.translate("common:UNKNOWN")}`, inline: true },
{ name: interaction.translate("general/whois:ISP"), value: `${whois.isp || interaction.translate("common:UNKNOWN")}`, inline: true } { name: interaction.translate("general/whois:ISP"), value: `${whois.isp || interaction.translate("common:UNKNOWN")}`, inline: true },
) )
.setTimestamp(); .setTimestamp();
@ -66,7 +66,7 @@ class Whois extends BaseCommand {
else if (whois.hosting) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:HOSTING") }); else if (whois.hosting) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:HOSTING") });
interaction.editReply({ interaction.editReply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -20,7 +20,7 @@ class Clear extends BaseCommand {
.setDescription(client.translate("common:USER"))), .setDescription(client.translate("common:USER"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -57,7 +57,7 @@ class Clear extends BaseCommand {
await interaction.editReply({ await interaction.editReply({
content: interaction.translate("moderation/clear:ALL_CONFIRM"), content: interaction.translate("moderation/clear:ALL_CONFIRM"),
components: [row] components: [row],
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
@ -74,7 +74,7 @@ class Clear extends BaseCommand {
newChannel.setPosition(position); newChannel.setPosition(position);
return newChannel.send({ return newChannel.send({
content: interaction.translate("moderation/clear:CHANNEL_CLEARED") content: interaction.translate("moderation/clear:CHANNEL_CLEARED"),
}); });
} else if (i.customId === "clear_confirm_no") { } else if (i.customId === "clear_confirm_no") {
i.deferUpdate(); i.deferUpdate();
@ -91,7 +91,7 @@ class Clear extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: interaction.translate("misc:SELECT_CANCELED"), content: interaction.translate("misc:SELECT_CANCELED"),
components: [row] components: [row],
}); });
} else if (reason === "idle") { } else if (reason === "idle") {
row.components.forEach(component => { row.components.forEach(component => {
@ -99,14 +99,14 @@ class Clear extends BaseCommand {
}); });
interaction.editReply({ interaction.editReply({
components: [row] components: [row],
}); });
} }
}); });
} else { } else {
if (isNaN(option) || parseInt(option) < 1) return interaction.error("misc:OPTION_NAN_ALL", null, { ephemeral: true }); if (isNaN(option) || parseInt(option) < 1) return interaction.error("misc:OPTION_NAN_ALL", null, { ephemeral: true });
let messages = await interaction.channel.messages.fetch({ let messages = await interaction.channel.messages.fetch({
limit: option limit: option,
}); });
if (member) messages = messages.filter(m => m.author.id === member.id); if (member) messages = messages.filter(m => m.author.id === member.id);
if (messages.length > option) messages.length = parseInt(option, 10); if (messages.length > option) messages.length = parseInt(option, 10);
@ -116,11 +116,11 @@ class Clear extends BaseCommand {
if (member) { if (member) {
interaction.replyT("moderation/clear:CLEARED_MEMBER", { interaction.replyT("moderation/clear:CLEARED_MEMBER", {
amount: `**${option}** ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`, amount: `**${option}** ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`,
username: member.user.tag username: member.user.tag,
}, { ephemeral: true, edit: true }); }, { ephemeral: true, edit: true });
} else { } else {
interaction.replyT("moderation/clear:CLEARED", { interaction.replyT("moderation/clear:CLEARED", {
amount: `**${option}** ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}` amount: `**${option}** ${client.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`,
}, { ephemeral: true, edit: true }); }, { ephemeral: true, edit: true });
} }
} }

View file

@ -18,7 +18,7 @@ class Clearwarns extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -39,13 +39,13 @@ class Clearwarns extends BaseCommand {
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
memberData.sanctions = []; memberData.sanctions = [];
memberData.save(); memberData.save();
interaction.success("moderation/clearwarns:SUCCESS", { interaction.success("moderation/clearwarns:SUCCESS", {
username: member.user.tag username: member.user.tag,
}); });
} }
} }

View file

@ -27,29 +27,29 @@ class Giveaway extends BaseCommand {
.setRequired(true)) .setRequired(true))
.addBooleanOption(option => option.setName("isdrop") .addBooleanOption(option => option.setName("isdrop")
.setDescription(client.translate("moderation/giveaway:ISDROP")) .setDescription(client.translate("moderation/giveaway:ISDROP"))
.setRequired(true)) .setRequired(true)),
) )
.addSubcommand(subcommand => subcommand.setName("reroll") .addSubcommand(subcommand => subcommand.setName("reroll")
.setDescription(client.translate("moderation/giveaway:REROLL")) .setDescription(client.translate("moderation/giveaway:REROLL"))
.addStringOption(option => option.setName("giveaway_id") .addStringOption(option => option.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID")) .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setRequired(true)) .setRequired(true)),
) )
.addSubcommand(subcommand => subcommand.setName("end") .addSubcommand(subcommand => subcommand.setName("end")
.setDescription(client.translate("moderation/giveaway:END")) .setDescription(client.translate("moderation/giveaway:END"))
.addStringOption(option => option.setName("giveaway_id") .addStringOption(option => option.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID")) .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setRequired(true)) .setRequired(true)),
) )
.addSubcommand(subcommand => subcommand.setName("delete") .addSubcommand(subcommand => subcommand.setName("delete")
.setDescription(client.translate("moderation/giveaway:DELETE")) .setDescription(client.translate("moderation/giveaway:DELETE"))
.addStringOption(option => option.setName("giveaway_id") .addStringOption(option => option.setName("giveaway_id")
.setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID")) .setDescription(client.translate("moderation/giveaway:GIVEAWAY_ID"))
.setRequired(true)) .setRequired(true)),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -99,8 +99,8 @@ class Giveaway extends BaseCommand {
noWinner: interaction.translate("moderation/giveaway:NO_WINNER"), noWinner: interaction.translate("moderation/giveaway:NO_WINNER"),
winners: interaction.translate("moderation/giveaway:WINNERS"), winners: interaction.translate("moderation/giveaway:WINNERS"),
endedAt: interaction.translate("moderation/giveaway:END_AT"), endedAt: interaction.translate("moderation/giveaway:END_AT"),
hostedBy: interaction.translate("moderation/giveaway:HOSTED_BY") hostedBy: interaction.translate("moderation/giveaway:HOSTED_BY"),
} },
}).then(() => { }).then(() => {
return interaction.success("moderation/giveaway:GIVEAWAY_CREATED", null, { ephemeral: true }); return interaction.success("moderation/giveaway:GIVEAWAY_CREATED", null, { ephemeral: true });
}); });
@ -110,13 +110,13 @@ class Giveaway extends BaseCommand {
client.giveawaysManager.reroll(giveaway_id, { client.giveawaysManager.reroll(giveaway_id, {
messages: { messages: {
congrat: interaction.translate("moderation/giveaway:REROLL_CONGRAT"), congrat: interaction.translate("moderation/giveaway:REROLL_CONGRAT"),
error: interaction.translate("moderation/giveaway:REROLL_ERROR") error: interaction.translate("moderation/giveaway:REROLL_ERROR"),
} },
}).then(() => { }).then(() => {
return interaction.success("moderation/giveaway:GIVEAWAY_REROLLED"); return interaction.success("moderation/giveaway:GIVEAWAY_REROLLED");
}).catch(() => { }).catch(() => {
return interaction.error("moderation/giveaway:NOT_FOUND_ENDED", { return interaction.error("moderation/giveaway:NOT_FOUND_ENDED", {
messageId: giveaway_id messageId: giveaway_id,
}, { ephemeral: true }); }, { ephemeral: true });
}); });
} else if (command === "end") { } else if (command === "end") {
@ -127,7 +127,7 @@ class Giveaway extends BaseCommand {
return interaction.success("moderation/giveaway:GIVEAWAY_ENDED"); return interaction.success("moderation/giveaway:GIVEAWAY_ENDED");
} catch (e) { } catch (e) {
return interaction.error("moderation/giveaway:NOT_FOUND", { return interaction.error("moderation/giveaway:NOT_FOUND", {
messageId: giveaway_id messageId: giveaway_id,
}, { ephemeral: true }); }, { ephemeral: true });
} }
} else if (command === "delete") { } else if (command === "delete") {
@ -137,7 +137,7 @@ class Giveaway extends BaseCommand {
return interaction.success("moderation/giveaway:GIVEAWAY_DELETED"); return interaction.success("moderation/giveaway:GIVEAWAY_DELETED");
}).catch(() => { }).catch(() => {
return interaction.error("moderation/giveaway:NOT_FOUND", { return interaction.error("moderation/giveaway:NOT_FOUND", {
messageId: giveaway_id messageId: giveaway_id,
}, { ephemeral: true }); }, { ephemeral: true });
}); });
} }

View file

@ -18,7 +18,7 @@ class Poll extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -61,7 +61,7 @@ class Poll extends BaseCommand {
await interaction.reply({ await interaction.reply({
content: interaction.translate("moderation/poll:SELECT_MENTION"), content: interaction.translate("moderation/poll:SELECT_MENTION"),
ephemeral: true, ephemeral: true,
components: [row] components: [row],
}); });
let mention = null; let mention = null;
@ -74,24 +74,24 @@ class Poll extends BaseCommand {
mention = "||@everyone||"; mention = "||@everyone||";
i.update({ i.update({
content: interaction.translate("moderation/poll:POLL_SENDED"), content: interaction.translate("moderation/poll:POLL_SENDED"),
components: [] components: [],
}); });
} else if (i.customId === "poll_here") { } else if (i.customId === "poll_here") {
mention = "||@here||"; mention = "||@here||";
i.update({ i.update({
content: interaction.translate("moderation/poll:POLL_SENDED"), content: interaction.translate("moderation/poll:POLL_SENDED"),
components: [] components: [],
}); });
} else if (i.customId === "poll_nothing") { } else if (i.customId === "poll_nothing") {
mention = null; mention = null;
i.update({ i.update({
content: interaction.translate("moderation/poll:POLL_SENDED"), content: interaction.translate("moderation/poll:POLL_SENDED"),
components: [] components: [],
}); });
} else if (i.customId === "poll_cancel") { } else if (i.customId === "poll_cancel") {
return i.update({ return i.update({
content: interaction.translate("misc:SELECT_CANCELED"), content: interaction.translate("misc:SELECT_CANCELED"),
components: [] components: [],
}); });
} }
@ -100,26 +100,26 @@ class Poll extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("moderation/poll:TITLE") name: interaction.translate("moderation/poll:TITLE"),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.addFields([ .addFields([
{ {
name: "\u200b", name: "\u200b",
value: question value: question,
}, },
{ {
name: "\u200b", name: "\u200b",
value: interaction.translate("moderation/poll:REACT", { value: interaction.translate("moderation/poll:REACT", {
success: cool.toString(), success: cool.toString(),
error: notcool.toString() error: notcool.toString(),
}) }),
} },
]); ]);
return interaction.channel.send({ return interaction.channel.send({
content: mention, content: mention,
embeds: [embed] embeds: [embed],
}).then(async m => { }).then(async m => {
await m.react(cool); await m.react(cool);
await m.react(notcool); await m.react(notcool);

View file

@ -18,7 +18,7 @@ class Unban extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -42,7 +42,7 @@ class Unban extends BaseCommand {
interaction.guild.bans.remove(id); interaction.guild.bans.remove(id);
interaction.success("moderation/unban:UNBANNED", { interaction.success("moderation/unban:UNBANNED", {
id id,
}); });
} }
} }

View file

@ -15,7 +15,7 @@ class Warn extends BaseCommand {
.setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers && PermissionFlagsBits.ManageMessages), .setDefaultMemberPermissions(PermissionFlagsBits.ModerateMembers && PermissionFlagsBits.ManageMessages),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -41,7 +41,7 @@ class Warn extends BaseCommand {
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
const modal = new ModalBuilder() const modal = new ModalBuilder()
@ -77,24 +77,24 @@ class Warn extends BaseCommand {
date: Date.now(), date: Date.now(),
type: "warn", type: "warn",
case: data.guildData.casesCount, case: data.guildData.casesCount,
reason reason,
}; };
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.addFields([ .addFields([
{ {
name: interaction.translate("common:USER"), name: interaction.translate("common:USER"),
value: `\`${member.user.tag}\` (${member.user.toString()})` value: `\`${member.user.tag}\` (${member.user.toString()})`,
}, },
{ {
name: interaction.translate("common:MODERATOR"), name: interaction.translate("common:MODERATOR"),
value: `\`${interaction.user.tag}\` (${interaction.user.toString()})` value: `\`${interaction.user.tag}\` (${interaction.user.toString()})`,
}, },
{ {
name: interaction.translate("common:REASON"), name: interaction.translate("common:REASON"),
value: reason, value: reason,
inline: true inline: true,
} },
]); ]);
if (banCount) { if (banCount) {
@ -104,20 +104,20 @@ class Warn extends BaseCommand {
username: member.user, username: member.user,
moderator: interaction.user.tag, moderator: interaction.user.tag,
server: interaction.guild.name, server: interaction.guild.name,
reason reason,
}) }),
}); });
caseInfo.type = "ban"; caseInfo.type = "ban";
embed.setAuthor({ embed.setAuthor({
name: interaction.translate("moderation/ban:CASE", { name: interaction.translate("moderation/ban:CASE", {
count: data.guildData.casesCount count: data.guildData.casesCount,
}) }),
}) })
.setColor(client.config.embed.color); .setColor(client.config.embed.color);
interaction.guild.members.ban(member); interaction.guild.members.ban(member);
interaction.success("moderation/setwarns:AUTO_BAN", { interaction.success("moderation/setwarns:AUTO_BAN", {
username: member.user.tag, username: member.user.tag,
count: `${banCount} ${client.getNoun(banCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}` count: `${banCount} ${client.getNoun(banCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`,
}); });
} }
} }
@ -129,20 +129,20 @@ class Warn extends BaseCommand {
username: member.user, username: member.user,
moderator: interaction.user.tag, moderator: interaction.user.tag,
server: interaction.guild.name, server: interaction.guild.name,
reason reason,
}) }),
}); });
caseInfo.type = "kick"; caseInfo.type = "kick";
embed.setAuthor({ embed.setAuthor({
name: interaction.translate("moderation/kick:CASE", { name: interaction.translate("moderation/kick:CASE", {
count: data.guildData.casesCount count: data.guildData.casesCount,
}) }),
}) })
.setColor(client.config.embed.color); .setColor(client.config.embed.color);
member.kick().catch(() => {}); member.kick().catch(() => {});
interaction.success("moderation/setwarns:AUTO_KICK", { interaction.success("moderation/setwarns:AUTO_KICK", {
username: member.user.tag, username: member.user.tag,
count: `${kickCount} ${client.getNoun(kickCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}` count: `${kickCount} ${client.getNoun(kickCount, interaction.translate("misc:NOUNS:WARNS:1"), interaction.translate("misc:NOUNS:WARNS:2"), interaction.translate("misc:NOUNS:WARNS:5"))}`,
}); });
} }
} }
@ -152,22 +152,22 @@ class Warn extends BaseCommand {
username: member.user.tag, username: member.user.tag,
server: interaction.guild.name, server: interaction.guild.name,
moderator: interaction.user.tag, moderator: interaction.user.tag,
reason reason,
}) }),
}); });
caseInfo.type = "warn"; caseInfo.type = "warn";
embed.setAuthor({ embed.setAuthor({
name: interaction.translate("moderation/warn:CASE", { name: interaction.translate("moderation/warn:CASE", {
caseNumber: data.guildData.casesCount caseNumber: data.guildData.casesCount,
}) }),
}).setColor(client.config.embed.color); }).setColor(client.config.embed.color);
submitted.reply({ submitted.reply({
content: interaction.translate("moderation/warn:WARNED", { content: interaction.translate("moderation/warn:WARNED", {
user: member.toString(), user: member.toString(),
reason reason,
}) }),
}); });
memberData.sanctions.push(caseInfo); memberData.sanctions.push(caseInfo);
@ -177,7 +177,7 @@ class Warn extends BaseCommand {
const channel = interaction.guild.channels.cache.get(data.guildData.plugins.modlogs); const channel = interaction.guild.channels.cache.get(data.guildData.plugins.modlogs);
if (!channel) return; if (!channel) return;
channel.send({ channel.send({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -18,7 +18,7 @@ class Warns extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -40,30 +40,30 @@ class Warns extends BaseCommand {
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("moderation/warns:SANCTIONS_OF", { name: interaction.translate("moderation/warns:SANCTIONS_OF", {
member: member.nickname || member.user.username member: member.nickname || member.user.username,
}), }),
iconURL: member.displayAvatarURL({ iconURL: member.displayAvatarURL({
extension: "png", extension: "png",
size: 512 size: 512,
}) }),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
if (memberData.sanctions.length === 0) { if (memberData.sanctions.length === 0) {
embed.setDescription(interaction.translate("moderation/warns:NO_SANCTIONS", { embed.setDescription(interaction.translate("moderation/warns:NO_SANCTIONS", {
member: member.nickname || member.user.username member: member.nickname || member.user.username,
})); }));
return interaction.reply({ return interaction.reply({
embeds: [embed] embeds: [embed],
}); });
} else { } else {
memberData.sanctions.forEach(sanction => { memberData.sanctions.forEach(sanction => {
@ -71,13 +71,13 @@ class Warns extends BaseCommand {
{ {
name: sanction.type + " | #" + sanction.case, name: sanction.type + " | #" + sanction.case,
value: `${interaction.translate("common:MODERATOR")}: <@${sanction.moderator}>\n${interaction.translate("common:REASON")}: ${sanction.reason}`, value: `${interaction.translate("common:MODERATOR")}: <@${sanction.moderator}>\n${interaction.translate("common:REASON")}: ${sanction.reason}`,
inline: true inline: true,
} },
]); ]);
}); });
} }
interaction.reply({ interaction.reply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -14,7 +14,7 @@ class Back extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**

View file

@ -19,7 +19,7 @@ class Clips extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -43,7 +43,7 @@ class Clips extends BaseCommand {
if (err) { if (err) {
interaction.editReply({ interaction.editReply({
content: "```js\n" + err + "```" content: "```js\n" + err + "```",
}); });
return console.log("Unable to read directory: " + err); return console.log("Unable to read directory: " + err);
} }
@ -76,7 +76,7 @@ class Clips extends BaseCommand {
await interaction.editReply({ await interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
@ -92,7 +92,7 @@ class Clips extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
} }
} else if (i.customId === "clips_next_page") { } else if (i.customId === "clips_next_page") {
@ -103,7 +103,7 @@ class Clips extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
} }
} else if (i.customId === "clips_jump_page") { } else if (i.customId === "clips_jump_page") {
@ -111,9 +111,9 @@ class Clips extends BaseCommand {
const msg = await interaction.followUp({ const msg = await interaction.followUp({
content: interaction.translate("misc:JUMP_TO_PAGE", { content: interaction.translate("misc:JUMP_TO_PAGE", {
length: embeds.length length: embeds.length,
}), }),
fetchReply: true fetchReply: true,
}); });
const filter = res => { const filter = res => {
@ -126,7 +126,7 @@ class Clips extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
if (collected.first().deletable) collected.first().delete(); if (collected.first().deletable) collected.first().delete();
@ -150,7 +150,7 @@ class Clips extends BaseCommand {
}); });
return interaction.editReply({ return interaction.editReply({
components: [row] components: [row],
}); });
}); });
} else { } else {
@ -165,7 +165,7 @@ class Clips extends BaseCommand {
const connection = joinVoiceChannel({ const connection = joinVoiceChannel({
channelId: voice.id, channelId: voice.id,
guildId: interaction.guild.id, guildId: interaction.guild.id,
adapterCreator: interaction.guild.voiceAdapterCreator adapterCreator: interaction.guild.voiceAdapterCreator,
}); });
const resource = createAudioResource(fs.createReadStream(`./clips/${query}.mp3`)); const resource = createAudioResource(fs.createReadStream(`./clips/${query}.mp3`));
@ -187,9 +187,9 @@ class Clips extends BaseCommand {
await interaction.editReply({ await interaction.editReply({
content: interaction.translate("music/clips:PLAYING", { content: interaction.translate("music/clips:PLAYING", {
clip: query clip: query,
}), }),
components: [] components: [],
}); });
} }
}); });
@ -215,7 +215,7 @@ function generateClipsEmbeds(interaction, clips) {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(interaction.client.config.embed.color) .setColor(interaction.client.config.embed.color)
.setFooter({ .setFooter({
text: interaction.client.config.embed.footer text: interaction.client.config.embed.footer,
}) })
.setTitle(interaction.translate("music/clips:CLIPS_LIST")) .setTitle(interaction.translate("music/clips:CLIPS_LIST"))
.setDescription(page) .setDescription(page)

View file

@ -20,11 +20,11 @@ class Loop extends BaseCommand {
{ name: client.translate("music/loop:AUTOPLAY"), value: "3" }, { name: client.translate("music/loop:AUTOPLAY"), value: "3" },
{ name: client.translate("music/loop:QUEUE"), value: "2" }, { name: client.translate("music/loop:QUEUE"), value: "2" },
{ name: client.translate("music/loop:TRACK"), value: "1" }, { name: client.translate("music/loop:TRACK"), value: "1" },
{ name: client.translate("music/loop:DISABLE"), value: "0" } { name: client.translate("music/loop:DISABLE"), value: "0" },
)), )),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**

View file

@ -15,7 +15,7 @@ class Nowplaying extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -41,34 +41,34 @@ class Nowplaying extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING") name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
}) })
.setThumbnail(track.thumbnail) .setThumbnail(track.thumbnail)
.addFields([ .addFields([
{ {
name: interaction.translate("music/nowplaying:T_TITLE"), name: interaction.translate("music/nowplaying:T_TITLE"),
value: `[${track.title}](${track.url})`, value: `[${track.title}](${track.url})`,
inline: true inline: true,
}, },
{ {
name: interaction.translate("music/nowplaying:T_AUTHOR"), name: interaction.translate("music/nowplaying:T_AUTHOR"),
value: track.author || interaction.translate("common:UNKNOWN"), value: track.author || interaction.translate("common:UNKNOWN"),
inline: true inline: true,
}, },
{ name: "\u200B", value: "\u200B", inline: true }, { name: "\u200B", value: "\u200B", inline: true },
{ {
name: interaction.translate("common:VIEWS"), name: interaction.translate("common:VIEWS"),
value: new Intl.NumberFormat(interaction.client.languages.find(language => language.name === interaction.guild.data.language).moment, { notation: "standard" }).format(track.views), value: new Intl.NumberFormat(interaction.client.languages.find(language => language.name === interaction.guild.data.language).moment, { notation: "standard" }).format(track.views),
inline: true inline: true,
}, },
{ {
name: interaction.translate("music/queue:ADDED"), name: interaction.translate("music/queue:ADDED"),
value: track.requestedBy.toString(), value: track.requestedBy.toString(),
inline: true inline: true,
}, },
{ {
name: interaction.translate("music/nowplaying:T_DURATION"), name: interaction.translate("music/nowplaying:T_DURATION"),
value: progressBar value: progressBar,
}, },
{ {
name: "\u200b", name: "\u200b",
@ -76,17 +76,17 @@ class Nowplaying extends BaseCommand {
queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") : queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") :
queue.repeatMode === QueueRepeatMode.QUEUE ? interaction.translate("music/nowplaying:QUEUE") : 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.TRACK ? interaction.translate("music/nowplaying:TRACK") : interaction.translate("common:DISABLED")
}\`` }\``,
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.setTimestamp(); .setTimestamp();
interaction.editReply({ interaction.editReply({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -17,7 +17,7 @@ class Play extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -43,8 +43,9 @@ class Play extends BaseCommand {
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT", null, { edit: true }); if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT", null, { edit: true });
try { try {
// eslint-disable-next-line no-var
var searchResult = await client.player.search(query, { var searchResult = await client.player.search(query, {
requestedBy: interaction.user requestedBy: interaction.user,
}); });
if (!searchResult.tracks[0] || !searchResult) if (!searchResult.tracks[0] || !searchResult)
@ -54,8 +55,8 @@ class Play extends BaseCommand {
return interaction.editReply({ return interaction.editReply({
content: interaction.translate("music/play:NO_RESULT", { content: interaction.translate("music/play:NO_RESULT", {
query, query,
error error,
}) }),
}); });
} }
@ -64,7 +65,7 @@ class Play extends BaseCommand {
autoSelfDeaf: true, autoSelfDeaf: true,
leaveOnEnd: true, leaveOnEnd: true,
leaveOnStop: true, leaveOnStop: true,
bufferingTimeout: 1000 bufferingTimeout: 1000,
}); });
if (searchResult.searched) { if (searchResult.searched) {
@ -125,14 +126,14 @@ class Play extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(interaction.translate("music/play:RESULTS_TITLE", { .setTitle(interaction.translate("music/play:RESULTS_TITLE", {
query query,
})) }))
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setDescription(searchResult.tracks.map(track => { .setDescription(searchResult.tracks.map(track => {
var views; let views;
if (track.raw.live) views = "🔴 LIVE"; if (track.raw.live) views = "🔴 LIVE";
else views = new Intl.NumberFormat(interaction.client.languages.find(language => language.name === interaction.guild.data.language).moment, { else views = new Intl.NumberFormat(interaction.client.languages.find(language => language.name === interaction.guild.data.language).moment, {
notation: "compact", compactDisplay: "short" notation: "compact", compactDisplay: "short",
}).format(track.views); }).format(track.views);
return `${searchResult.tracks.indexOf(track) + 1}. [${track.title}](${track.url})\n> ${interaction.translate("common:VIEWS")}: **${views}**\n`; return `${searchResult.tracks.indexOf(track) + 1}. [${track.title}](${track.url})\n> ${interaction.translate("common:VIEWS")}: **${views}**\n`;
@ -142,7 +143,7 @@ class Play extends BaseCommand {
await interaction.editReply({ await interaction.editReply({
content: interaction.translate("music/play:SEARCH_RESULTS"), content: interaction.translate("music/play:SEARCH_RESULTS"),
embeds: [embed], embeds: [embed],
components: [row1, row2, row3] components: [row1, row2, row3],
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
@ -153,7 +154,7 @@ class Play extends BaseCommand {
if (i.customId >= 1 && i.customId <= 10) { if (i.customId >= 1 && i.customId <= 10) {
i.deferUpdate(); i.deferUpdate();
var selected = searchResult.tracks[i.customId - 1]; const selected = searchResult.tracks[i.customId - 1];
queue.addTrack(selected); queue.addTrack(selected);
try { try {
@ -162,10 +163,10 @@ class Play extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: interaction.translate("music/play:ADDED_QUEUE", { content: interaction.translate("music/play:ADDED_QUEUE", {
songName: selected.title songName: selected.title,
}), }),
components: [], components: [],
embeds: [] embeds: [],
}); });
collector.stop(); collector.stop();
@ -175,21 +176,17 @@ class Play extends BaseCommand {
console.log(error); console.log(error);
return interaction.editReply({ return interaction.editReply({
content: interaction.translate("music/play:ERR_OCCURRED", { content: interaction.translate("music/play:ERR_OCCURRED", {
error error,
}) }),
}); });
} }
} else if (i.customId === "search_cancel") { } else if (i.customId === "search_cancel") {
i.deferUpdate(); i.deferUpdate();
rows.forEach(row => {
row.components.forEach(component => {
component.setDisabled(true);
});
});
interaction.editReply({ interaction.editReply({
components: [row1, row2, row3] content: interaction.translate("misc:SELECT_CANCELED"),
embeds: [],
components: [],
}); });
collector.stop(); collector.stop();
@ -207,7 +204,7 @@ class Play extends BaseCommand {
}); });
return interaction.editReply({ return interaction.editReply({
components: [row1, row2, row3] components: [row1, row2, row3],
}); });
} }
}); });
@ -223,16 +220,16 @@ class Play extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: interaction.translate("music/play:ADDED_QUEUE", { content: interaction.translate("music/play:ADDED_QUEUE", {
songName: searchResult.playlist ? searchResult.playlist.title : searchResult.tracks[0].title songName: searchResult.playlist ? searchResult.playlist.title : searchResult.tracks[0].title,
}) }),
}); });
} catch (error) { } catch (error) {
client.player.deleteQueue(interaction.guildId); client.player.deleteQueue(interaction.guildId);
console.log(error); console.log(error);
return interaction.editReply({ return interaction.editReply({
content: interaction.translate("music/play:ERR_OCCURRED", { content: interaction.translate("music/play:ERR_OCCURRED", {
error error,
}) }),
}); });
} }
} }

View file

@ -15,7 +15,7 @@ class Queue extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -65,7 +65,7 @@ class Queue extends BaseCommand {
await interaction.reply({ await interaction.reply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
@ -82,7 +82,7 @@ class Queue extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
} }
} else if (i.customId === "queue_next_page") { } else if (i.customId === "queue_next_page") {
@ -94,7 +94,7 @@ class Queue extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
} }
} else if (i.customId === "queue_jump_page") { } else if (i.customId === "queue_jump_page") {
@ -103,9 +103,9 @@ class Queue extends BaseCommand {
const msg = await interaction.followUp({ const msg = await interaction.followUp({
content: interaction.translate("misc:JUMP_TO_PAGE", { content: interaction.translate("misc:JUMP_TO_PAGE", {
length: embeds.length length: embeds.length,
}), }),
fetchReply: true fetchReply: true,
}); });
const filter = res => { const filter = res => {
@ -118,7 +118,7 @@ class Queue extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
if (collected.first().deletable) collected.first().delete(); if (collected.first().deletable) collected.first().delete();
@ -142,7 +142,7 @@ class Queue extends BaseCommand {
}); });
return interaction.editReply({ return interaction.editReply({
components: [row] components: [row],
}); });
}); });
} }

View file

@ -16,7 +16,7 @@ class Seek extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -41,7 +41,7 @@ class Seek extends BaseCommand {
queue.seek(time * 1000); queue.seek(time * 1000);
interaction.success("music/seek:SUCCESS", { interaction.success("music/seek:SUCCESS", {
time: `**${time}** ${client.getNoun(time, interaction.translate("misc:NOUNS:SECONDS:1"), interaction.translate("misc:NOUNS:SECONDS:2"), interaction.translate("misc:NOUNS:SECONDS:5"))}` time: `**${time}** ${client.getNoun(time, interaction.translate("misc:NOUNS:SECONDS:1"), interaction.translate("misc:NOUNS:SECONDS:2"), interaction.translate("misc:NOUNS:SECONDS:5"))}`,
}); });
} }
} }

View file

@ -14,7 +14,7 @@ class Shuffle extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**

View file

@ -14,7 +14,7 @@ class Skip extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**

View file

@ -17,7 +17,7 @@ class Skipto extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -46,7 +46,7 @@ class Skipto extends BaseCommand {
queue.skipTo(queue.tracks[position - 1]); queue.skipTo(queue.tracks[position - 1]);
interaction.success("music/skipto:SUCCESS", { interaction.success("music/skipto:SUCCESS", {
position: position position: position,
}); });
} else return interaction.error("music/skipto:ERROR", { position: position }); } else return interaction.error("music/skipto:ERROR", { position: position });
} }

View file

@ -14,7 +14,7 @@ class Stop extends BaseCommand {
.setDMPermission(false), .setDMPermission(false),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**

View file

@ -15,7 +15,7 @@ class NSFW extends BaseCommand {
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: false ownerOnly: false,
}); });
} }
/** /**
@ -39,8 +39,8 @@ class NSFW extends BaseCommand {
const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag => const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag =>
JSON.parse(JSON.stringify({ JSON.parse(JSON.stringify({
label: tag, label: tag,
value: tag value: tag,
})) })),
); );
const row = new ActionRowBuilder() const row = new ActionRowBuilder()
@ -48,14 +48,14 @@ class NSFW extends BaseCommand {
new SelectMenuBuilder() new SelectMenuBuilder()
.setCustomId("nsfw_select") .setCustomId("nsfw_select")
.setPlaceholder(client.translate("common:NOTHING_SELECTED")) .setPlaceholder(client.translate("common:NOTHING_SELECTED"))
.addOptions(tags) .addOptions(tags),
); );
const msg = await interaction.editReply({ const msg = await interaction.editReply({
content: interaction.translate("common:AVAILABLE_OPTIONS"), content: interaction.translate("common:AVAILABLE_OPTIONS"),
ephemeral: true, ephemeral: true,
fetchReply: true, fetchReply: true,
components: [row] components: [row],
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
@ -71,7 +71,7 @@ class NSFW extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.setTitle(res.title) .setTitle(res.title)
.setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`) .setDescription(`${interaction.translate("fun/memes:SUBREDDIT")}: **${res.subreddit}**\n${interaction.translate("common:AUTHOR")}: **${res.author}**\n${interaction.translate("fun/memes:UPS")}: **${res.ups}**`)
@ -79,14 +79,14 @@ class NSFW extends BaseCommand {
.setTimestamp(); .setTimestamp();
await interaction.editReply({ await interaction.editReply({
embeds: [embed] embeds: [embed],
}); });
} }
}); });
collector.on("end", () => { collector.on("end", () => {
return interaction.editReply({ return interaction.editReply({
components: [] components: [],
}); });
}); });
} }

View file

@ -20,7 +20,7 @@ class Announcement extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true ownerOnly: true,
}); });
} }
/** /**
@ -43,12 +43,12 @@ class Announcement extends BaseCommand {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.translate("owner/announcement:TITLE") name: interaction.translate("owner/announcement:TITLE"),
}) })
.setDescription(text) .setDescription(text)
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: interaction.user.tag text: interaction.user.tag,
}) })
.setTimestamp(); .setTimestamp();
@ -57,13 +57,13 @@ class Announcement extends BaseCommand {
const channel = guild.channels.cache.get(guild?.data.plugins.news); const channel = guild.channels.cache.get(guild?.data.plugins.news);
await channel.send({ await channel.send({
content: `${interaction.options.getBoolean("tag") ? "||@everyone|| " : ""}ВАЖНОЕ ОБЪЯВЛЕНИЕ!`, content: `${interaction.options.getBoolean("tag") ? "||@everyone|| " : ""}ВАЖНОЕ ОБЪЯВЛЕНИЕ!`,
embeds: [embed] embeds: [embed],
}); });
}); });
interaction.editReply({ interaction.editReply({
content: interaction.translate("owner/announcement:SENDED"), content: interaction.translate("owner/announcement:SENDED"),
ephemeral: true ephemeral: true,
}); });
} }
} }

View file

@ -22,14 +22,14 @@ class Debug extends BaseCommand {
{ name: client.translate("common:XP"), value: "xp" }, { name: client.translate("common:XP"), value: "xp" },
{ name: client.translate("common:CREDITS"), value: "credits" }, { name: client.translate("common:CREDITS"), value: "credits" },
{ name: client.translate("economy/transactions:BANK"), value: "bank" }, { name: client.translate("economy/transactions:BANK"), value: "bank" },
{ name: client.translate("common:REP"), value: "rep" } { name: client.translate("common:REP"), value: "rep" },
)) ))
.addUserOption(option => option.setName("user") .addUserOption(option => option.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setRequired(true)) .setRequired(true))
.addIntegerOption(option => option.setName("int") .addIntegerOption(option => option.setName("int")
.setDescription(client.translate("common:INT")) .setDescription(client.translate("common:INT"))
.setRequired(true)) .setRequired(true)),
) )
.addSubcommand(subcommand => subcommand.setName("add") .addSubcommand(subcommand => subcommand.setName("add")
.setDescription(client.translate("owner/debug:ADD")) .setDescription(client.translate("owner/debug:ADD"))
@ -41,18 +41,18 @@ class Debug extends BaseCommand {
{ name: client.translate("common:XP"), value: "xp" }, { name: client.translate("common:XP"), value: "xp" },
{ name: client.translate("common:CREDITS"), value: "credits" }, { name: client.translate("common:CREDITS"), value: "credits" },
{ name: client.translate("economy/transactions:BANK"), value: "bank" }, { name: client.translate("economy/transactions:BANK"), value: "bank" },
{ name: client.translate("common:REP"), value: "rep" } { name: client.translate("common:REP"), value: "rep" },
)) ))
.addUserOption(option => option.setName("user") .addUserOption(option => option.setName("user")
.setDescription(client.translate("common:USER")) .setDescription(client.translate("common:USER"))
.setRequired(true)) .setRequired(true))
.addIntegerOption(option => option.setName("int") .addIntegerOption(option => option.setName("int")
.setDescription(client.translate("owner/debug:INT")) .setDescription(client.translate("owner/debug:INT"))
.setRequired(true)) .setRequired(true)),
), ),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true ownerOnly: true,
}); });
} }
/** /**
@ -76,11 +76,11 @@ class Debug extends BaseCommand {
const member = interaction.options.getMember("user"); const member = interaction.options.getMember("user");
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: member.id id: member.id,
}); });
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
const int = interaction.options.getInteger("int"); const int = interaction.options.getInteger("int");
@ -90,7 +90,7 @@ class Debug extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -99,7 +99,7 @@ class Debug extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -108,7 +108,7 @@ class Debug extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -117,7 +117,7 @@ class Debug extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -126,7 +126,7 @@ class Debug extends BaseCommand {
await userData.save(); await userData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
} }
@ -135,11 +135,11 @@ class Debug extends BaseCommand {
const member = interaction.options.getMember("target"); const member = interaction.options.getMember("target");
if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true }); if (member.user.bot) return interaction.error("misc:BOT_USER", null, { ephemeral: true });
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: member.id id: member.id,
}); });
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
const int = interaction.options.getInteger("int"); const int = interaction.options.getInteger("int");
@ -149,7 +149,7 @@ class Debug extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -158,7 +158,7 @@ class Debug extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -167,7 +167,7 @@ class Debug extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -176,7 +176,7 @@ class Debug extends BaseCommand {
await memberData.save(); await memberData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
@ -185,7 +185,7 @@ class Debug extends BaseCommand {
await userData.save(); await userData.save();
return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, { return interaction.success(`owner/debug:SUCCESS_${type.toUpperCase()}`, {
username: member.toString(), username: member.toString(),
amount: int amount: int,
}, { ephemeral: true }); }, { ephemeral: true });
} }
} }

View file

@ -17,7 +17,7 @@ class Eval extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true ownerOnly: true,
}); });
} }
/** /**
@ -45,7 +45,7 @@ class Eval extends BaseCommand {
if (output.includes(client.token)) output = output.replace(client.token, "T0K3N"); if (output.includes(client.token)) output = output.replace(client.token, "T0K3N");
interaction.editReply({ interaction.editReply({
content: "```js\n" + output + "```" content: "```js\n" + output + "```",
}); });
}).catch(err => { }).catch(err => {
console.error(err); console.error(err);
@ -53,7 +53,7 @@ class Eval extends BaseCommand {
if (err.includes(client.token)) err = err.replace(client.token, "T0K3N"); if (err.includes(client.token)) err = err.replace(client.token, "T0K3N");
interaction.editReply({ interaction.editReply({
content: "```js\n" + err + "```" content: "```js\n" + err + "```",
}); });
}); });
} }

View file

@ -19,7 +19,7 @@ class Reload extends BaseCommand {
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true ownerOnly: true,
}); });
} }
/** /**
@ -47,7 +47,7 @@ class Reload extends BaseCommand {
autoUpdateDocs.update(client); autoUpdateDocs.update(client);
interaction.success("owner/reload:SUCCESS", { interaction.success("owner/reload:SUCCESS", {
command: cmd.command.name command: cmd.command.name,
}, { ephemeral: true }); }, { ephemeral: true });
} }
} }

View file

@ -19,7 +19,7 @@ class Say extends BaseCommand {
.setDescription(client.translate("common:CHANNEL"))), .setDescription(client.translate("common:CHANNEL"))),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true ownerOnly: true,
}); });
} }
/** /**
@ -45,12 +45,12 @@ class Say extends BaseCommand {
setTimeout(function () { setTimeout(function () {
interaction.channel.send({ interaction.channel.send({
content: message content: message,
}); });
interaction.replyT("owner/say:DONE", { interaction.replyT("owner/say:DONE", {
message, message,
channel: interaction.channel.toString() channel: interaction.channel.toString(),
}, { edit: true }); }, { edit: true });
}, 2000); }, 2000);
} else { } else {
@ -58,12 +58,12 @@ class Say extends BaseCommand {
setTimeout(function () { setTimeout(function () {
channel.send({ channel.send({
content: message content: message,
}); });
interaction.replyT("owner/say:DONE", { interaction.replyT("owner/say:DONE", {
message, message,
channel: channel.toString() channel: channel.toString(),
}, { edit: true }); }, { edit: true });
}, 2000); }, 2000);
} }

View file

@ -14,7 +14,7 @@ class Servers extends BaseCommand {
.setDMPermission(true), .setDMPermission(true),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,
ownerOnly: true ownerOnly: true,
}); });
} }
/** /**
@ -59,7 +59,7 @@ class Servers extends BaseCommand {
await interaction.editReply({ await interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
const filter = i => i.user.id === interaction.user.id; const filter = i => i.user.id === interaction.user.id;
@ -75,7 +75,7 @@ class Servers extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
} }
} else if (i.customId === "servers_next_page") { } else if (i.customId === "servers_next_page") {
@ -86,7 +86,7 @@ class Servers extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
} }
} else if (i.customId === "servers_jump_page") { } else if (i.customId === "servers_jump_page") {
@ -94,9 +94,9 @@ class Servers extends BaseCommand {
const msg = await interaction.followUp({ const msg = await interaction.followUp({
content: interaction.translate("misc:JUMP_TO_PAGE", { content: interaction.translate("misc:JUMP_TO_PAGE", {
length: embeds.length length: embeds.length,
}), }),
fetchReply: true fetchReply: true,
}); });
const filter = res => { const filter = res => {
@ -109,7 +109,7 @@ class Servers extends BaseCommand {
interaction.editReply({ interaction.editReply({
content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`, content: `${interaction.translate("common:PAGE")}: **${currentPage + 1}**/**${embeds.length}**`,
embeds: [embeds[currentPage]], embeds: [embeds[currentPage]],
components: [row] components: [row],
}); });
if (collected.first().deletable) collected.first().delete(); if (collected.first().deletable) collected.first().delete();
@ -133,7 +133,7 @@ class Servers extends BaseCommand {
}); });
return interaction.editReply({ return interaction.editReply({
components: [row] components: [row],
}); });
}); });
} }
@ -159,7 +159,7 @@ function generateServersEmbeds(interaction, servers) {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(interaction.client.config.embed.color) .setColor(interaction.client.config.embed.color)
.setFooter({ .setFooter({
text: interaction.client.config.embed.footer text: interaction.client.config.embed.footer,
}) })
.setTitle(interaction.translate("owner/servers:SERVERS_LIST")) .setTitle(interaction.translate("owner/servers:SERVERS_LIST"))
.setDescription(info) .setDescription(info)

View file

@ -18,20 +18,20 @@ module.exports = {
logs: "XXXXXXXXXXX", // The channel ID of logs logs: "XXXXXXXXXXX", // The channel ID of logs
port: 8080, // Dashboard port port: 8080, // Dashboard port
expressSessionPassword: "XXXXXXXXXXX", // Express session password (it can be what you want) expressSessionPassword: "XXXXXXXXXXX", // Express session password (it can be what you want)
failureURL: "https://dashboard.example.com" // url on which users will be redirected if they click the cancel button (discord authentication) failureURL: "https://dashboard.example.com", // url on which users will be redirected if they click the cancel button (discord authentication)
}, },
mongoDB: "mongodb://localhost:27017/discordbot", // The URl of the mongodb database mongoDB: "mongodb://localhost:27017/discordbot", // The URl of the mongodb database
/* For the embeds (embeded messages) */ /* For the embeds (embeded messages) */
embed: { embed: {
color: "#0091fc", // The default color for the embeds color: "#0091fc", // The default color for the embeds
footer: "Bot | v1.0" // And the default footer for the embeds footer: "Bot | v1.0", // And the default footer for the embeds
}, },
/* Bot's owner informations */ /* Bot's owner informations */
owner: { owner: {
id: "XXXXXXXXXXX", // The ID of the bot's owner id: "XXXXXXXXXXX", // The ID of the bot's owner
name: "XXXXXXXXXXX#1234" // And the name of the bot's owner name: "XXXXXXXXXXX#1234", // And the name of the bot's owner
}, },
/* The API keys that are required for certain commands */ /* The API keys that are required for certain commands */
/* Not used right now */ /* Not used right now */
apiKeys: {} apiKeys: {},
}; };

View file

@ -60,7 +60,7 @@ module.exports.init = async(client) => {
res.status(404).render("404", { res.status(404).render("404", {
user: req.userInfos, user: req.userInfos,
translate: req.translate, translate: req.translate,
currentURL: `${req.protocol}://${req.get("host")}${req.originalUrl}` currentURL: `${req.protocol}://${req.get("host")}${req.originalUrl}`,
}); });
}) })
.use(CheckAuth, function(err, req, res) { .use(CheckAuth, function(err, req, res) {
@ -70,7 +70,7 @@ module.exports.init = async(client) => {
res.status(500).render("500", { res.status(500).render("500", {
user: req.userInfos, user: req.userInfos,
translate: req.translate, translate: req.translate,
currentURL: `${req.protocol}://${req.get("host")}${req.originalUrl}` currentURL: `${req.protocol}://${req.get("host")}${req.originalUrl}`,
}); });
}); });

View file

@ -14,14 +14,13 @@ router.get("/login", async function(req, res) {
router.get("/callback", async (req, res) => { router.get("/callback", async (req, res) => {
if (!req.query.code) return res.redirect(req.client.config.dashboard.failureURL); if (!req.query.code) return res.redirect(req.client.config.dashboard.failureURL);
if (req.query.state && req.query.state.startsWith("invite")) { if (req.query.state && req.query.state.startsWith("invite"))
if (req.query.code) { if (req.query.code) {
const guildID = req.query.state.substr("invite".length, req.query.state.length); const guildID = req.query.state.substr("invite".length, req.query.state.length);
req.client.knownGuilds.push({ id: guildID, user: req.user.id }); req.client.knownGuilds.push({ id: guildID, user: req.user.id });
return res.redirect(`/manage/${guildID}`); return res.redirect(`/manage/${guildID}`);
} }
}
const redirectURL = req.client.states[req.query.state] || "/selector"; const redirectURL = req.client.states[req.query.state] || "/selector";
const params = new URLSearchParams(); const params = new URLSearchParams();
@ -33,8 +32,8 @@ router.get("/callback", async (req, res) => {
body: params.toString(), body: params.toString(),
headers: { headers: {
Authorization: `Basic ${btoa(`${req.client.user.id}:${req.client.config.dashboard.secret}`)}`, Authorization: `Basic ${btoa(`${req.client.user.id}:${req.client.config.dashboard.secret}`)}`,
"Content-Type": "application/x-www-form-urlencoded" "Content-Type": "application/x-www-form-urlencoded",
} },
}); });
// Fetch tokens (used to fetch user informations) // Fetch tokens (used to fetch user informations)
@ -44,14 +43,14 @@ router.get("/callback", async (req, res) => {
if (tokens.error || !tokens.access_token) return res.redirect(`/api/login&state=${req.query.state}`); if (tokens.error || !tokens.access_token) return res.redirect(`/api/login&state=${req.query.state}`);
const userData = { const userData = {
infos: null, infos: null,
guilds: null guilds: null,
}; };
while (!userData.infos || !userData.guilds) { while (!userData.infos || !userData.guilds) {
/* User infos */ /* User infos */
if (!userData.infos) { if (!userData.infos) {
response = await fetch("http://discordapp.com/api/users/@me", { response = await fetch("http://discordapp.com/api/users/@me", {
method: "GET", method: "GET",
headers: { Authorization: `Bearer ${tokens.access_token}` } headers: { Authorization: `Bearer ${tokens.access_token}` },
}); });
const json = await response.json(); const json = await response.json();
if (json.retry_after) await req.client.wait(json.retry_after); if (json.retry_after) await req.client.wait(json.retry_after);
@ -62,7 +61,7 @@ router.get("/callback", async (req, res) => {
if (!userData.guilds) { if (!userData.guilds) {
response = await fetch("https://discordapp.com/api/users/@me/guilds", { response = await fetch("https://discordapp.com/api/users/@me/guilds", {
method: "GET", method: "GET",
headers: { Authorization: `Bearer ${tokens.access_token}` } headers: { Authorization: `Bearer ${tokens.access_token}` },
}); });
const json = await response.json(); const json = await response.json();
if (json.retry_after) await req.client.wait(json.retry_after); if (json.retry_after) await req.client.wait(json.retry_after);

View file

@ -6,7 +6,7 @@ router.get("/", function (req, res) {
user: req.userInfos, user: req.userInfos,
translate: req.translate, translate: req.translate,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
site: req.client.config.dashboard.baseURL site: req.client.config.dashboard.baseURL,
}); });
}); });

View file

@ -7,13 +7,12 @@ const express = require("express"),
router.get("/:serverID", CheckAuth, async(req, res) => { router.get("/:serverID", CheckAuth, async(req, res) => {
// Check if the user has the permissions to edit this guild // Check if the user has the permissions to edit this guild
const guild = req.client.guilds.cache.get(req.params.serverID); const guild = req.client.guilds.cache.get(req.params.serverID);
if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID)) { if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID))
return res.render("404", { return res.render("404", {
user: req.userInfos, user: req.userInfos,
translate: req.translate, translate: req.translate,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
}); });
}
// Fetch guild informations // Fetch guild informations
const guildInfos = await utils.fetchGuild(guild.id, req.client, req.user.guilds); const guildInfos = await utils.fetchGuild(guild.id, req.client, req.user.guilds);
@ -26,20 +25,19 @@ router.get("/:serverID", CheckAuth, async(req, res) => {
translate: req.translate, translate: req.translate,
ChannelType, ChannelType,
bot: req.client, bot: req.client,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
}); });
}); });
router.post("/:serverID", CheckAuth, async(req, res) => { router.post("/:serverID", CheckAuth, async(req, res) => {
// Check if the user has the permissions to edit this guild // Check if the user has the permissions to edit this guild
const guild = req.client.guilds.cache.get(req.params.serverID); const guild = req.client.guilds.cache.get(req.params.serverID);
if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID)) { if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID))
return res.render("404", { return res.render("404", {
user: req.userInfos, user: req.userInfos,
translate: req.translate, translate: req.translate,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
}); });
}
const guildData = await req.client.findOrCreateGuild({ id: guild.id }); const guildData = await req.client.findOrCreateGuild({ id: guild.id });
const data = req.body; const data = req.body;
@ -57,7 +55,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => {
enabled: true, enabled: true,
message: data.message, message: data.message,
channel: guild.channels.cache.find(ch => "#" + ch.name === data.channel).id, channel: guild.channels.cache.find(ch => "#" + ch.name === data.channel).id,
withImage: data.withImage === "on" withImage: data.withImage === "on",
}; };
guildData.plugins.welcome = welcome; guildData.plugins.welcome = welcome;
guildData.markModified("plugins.welcome"); guildData.markModified("plugins.welcome");
@ -69,7 +67,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => {
enabled: false, enabled: false,
message: null, message: null,
channel: null, channel: null,
withImage: null withImage: null,
}; };
guildData.plugins.welcome = welcome; guildData.plugins.welcome = welcome;
guildData.markModified("plugins.welcome"); guildData.markModified("plugins.welcome");
@ -81,7 +79,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => {
enabled: true, enabled: true,
message: data.message, message: data.message,
channel: guild.channels.cache.find(ch => "#" + ch.name === data.channel).id, channel: guild.channels.cache.find(ch => "#" + ch.name === data.channel).id,
withImage: data.withImage === "on" withImage: data.withImage === "on",
}; };
guildData.plugins.goodbye = goodbye; guildData.plugins.goodbye = goodbye;
guildData.markModified("plugins.goodbye"); guildData.markModified("plugins.goodbye");
@ -93,7 +91,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => {
enabled: false, enabled: false,
message: null, message: null,
channel: null, channel: null,
withImage: null withImage: null,
}; };
guildData.plugins.goodbye = goodbye; guildData.plugins.goodbye = goodbye;
guildData.markModified("plugins.goodbye"); guildData.markModified("plugins.goodbye");
@ -103,7 +101,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => {
if (Object.prototype.hasOwnProperty.call(data, "autoroleEnable") || Object.prototype.hasOwnProperty.call(data, "autoroleUpdate")) { if (Object.prototype.hasOwnProperty.call(data, "autoroleEnable") || Object.prototype.hasOwnProperty.call(data, "autoroleUpdate")) {
const autorole = { const autorole = {
enabled: true, enabled: true,
role: guild.roles.cache.find(r => "@" + r.name === data.role).id role: guild.roles.cache.find(r => "@" + r.name === data.role).id,
}; };
guildData.plugins.autorole = autorole; guildData.plugins.autorole = autorole;
guildData.markModified("plugins.autorole"); guildData.markModified("plugins.autorole");
@ -113,7 +111,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => {
if (Object.prototype.hasOwnProperty.call(data, "autoroleDisable")) { if (Object.prototype.hasOwnProperty.call(data, "autoroleDisable")) {
const autorole = { const autorole = {
enabled: false, enabled: false,
role: null role: null,
}; };
guildData.plugins.autorole = autorole; guildData.plugins.autorole = autorole;
guildData.markModified("plugins.autorole"); guildData.markModified("plugins.autorole");

View file

@ -6,30 +6,29 @@ const express = require("express"),
router.get("/:serverID", CheckAuth, async (req, res) => { router.get("/:serverID", CheckAuth, async (req, res) => {
// Check if the user has the permissions to edit this guild // Check if the user has the permissions to edit this guild
const guild = req.client.guilds.cache.get(req.params.serverID); const guild = req.client.guilds.cache.get(req.params.serverID);
if (!guild) { if (!guild)
return res.render("404", { return res.render("404", {
user: req.userInfos, user: req.userInfos,
translate: req.translate, translate: req.translate,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
}); });
}
const memberData = await req.client.findOrCreateMember({ id: req.userInfos.id, guildId: guild.id }); const memberData = await req.client.findOrCreateMember({ id: req.userInfos.id, guildId: guild.id });
// Fetch guild informations // Fetch guild informations
const membersData = await req.client.membersData.find({ const membersData = await req.client.membersData.find({
guildID: guild.id guildID: guild.id,
}).lean(), }).lean(),
members = membersData.map((m) => { members = membersData.map((m) => {
return { return {
id: m.id, id: m.id,
money: m.money + m.bankSold money: m.money + m.bankSold,
}; };
}).sort((a, b) => b.money - a.money); }).sort((a, b) => b.money - a.money);
const leaderboards = { const leaderboards = {
money: members, money: members,
level: utils.sortArrayOfObjects("level", membersData) level: utils.sortArrayOfObjects("level", membersData),
}; };
for (const cat in leaderboards) { for (const cat in leaderboards) {
@ -39,7 +38,7 @@ router.get("/:serverID", CheckAuth, async (req, res) => {
const stats = { const stats = {
money: await utils.fetchUsers(leaderboards.money, req.client), money: await utils.fetchUsers(leaderboards.money, req.client),
level: await utils.fetchUsers(leaderboards.level, req.client) level: await utils.fetchUsers(leaderboards.level, req.client),
}; };
res.render("stats/guild", { res.render("stats/guild", {

View file

@ -10,7 +10,7 @@ router.get("/selector", CheckAuth, async(req, res) => {
res.render("selector", { res.render("selector", {
user: req.userInfos, user: req.userInfos,
translate: req.translate, translate: req.translate,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
}); });
}); });

View file

@ -9,7 +9,7 @@ router.get("/", CheckAuth, async function(req, res) {
bot: req.client, bot: req.client,
translate: req.translate, translate: req.translate,
printDate: req.printDate, printDate: req.printDate,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
}); });
}); });
@ -18,12 +18,11 @@ router.post("/", CheckAuth, async function(req, res) {
const data = req.body; const data = req.body;
if (data.bio) user.bio = data.bio; if (data.bio) user.bio = data.bio;
if (data.birthdate) { if (data.birthdate)
if (checkDate(data.birthdate)) { if (checkDate(data.birthdate)) {
user.birthdate = checkDate(data.birthdate); user.birthdate = checkDate(data.birthdate);
user.markModified("birthdate"); user.markModified("birthdate");
} }
}
await user.save(); await user.save();
res.redirect(303, "/profile"); res.redirect(303, "/profile");
@ -39,8 +38,9 @@ function checkDate(birthdate) {
if (!day || !month || !year) return false; if (!day || !month || !year) return false;
const match = birthdate.match(/\d+/g); const match = birthdate.match(/\d+/g);
if (!match) return false; if (!match) return false;
const tday = + match[0], tmonth = + match[1] - 1; const tday = +match[0],
let tyear = + match[2]; tmonth = +match[1] - 1;
let tyear = +match[2];
if (tyear < 100) tyear += tyear < 50 ? 2000 : 1900; if (tyear < 100) tyear += tyear < 50 ? 2000 : 1900;
const d = new Date(tyear, tmonth, tday); const d = new Date(tyear, tmonth, tday);
if (!(tday == d.getDate() && tmonth == d.getMonth() && tyear == d.getFullYear())) return false; if (!(tday == d.getDate() && tmonth == d.getMonth() && tyear == d.getFullYear())) return false;

View file

@ -6,22 +6,22 @@ const express = require("express"),
// Gets user page // Gets user page
router.get("/:userID/:serverID", CheckAuth, async function (req, res) { router.get("/:userID/:serverID", CheckAuth, async function (req, res) {
const guild = req.client.guilds.cache.get(req.params.serverID); const guild = req.client.guilds.cache.get(req.params.serverID);
if (!guild) { if (!guild)
return res.render("404", { return res.render("404", {
user: req.userInfos, user: req.userInfos,
translate: req.translate, translate: req.translate,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
}); });
}
const guildData = await req.client.findOrCreateGuild({ id: guild.id }); const guildData = await req.client.findOrCreateGuild({ id: guild.id });
const userInfos = await utils.fetchUser({ const userInfos = await utils.fetchUser({
id: req.params.userID id: req.params.userID,
}, req.client).catch(() => { }, req.client).catch(() => {
res.render("404", { res.render("404", {
user: req.userInfos, user: req.userInfos,
translate: req.translate, translate: req.translate,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
}); });
}); });
@ -32,7 +32,7 @@ router.get("/:userID/:serverID", CheckAuth, async function (req, res) {
bot: req.client, bot: req.client,
translate: req.translate, translate: req.translate,
printDate: req.printDate, printDate: req.printDate,
currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`,
}); });
}); });

View file

@ -25,13 +25,13 @@ async function fetchUser(userData, client, query) {
const user = await client.users.fetch(userData.id); const user = await client.users.fetch(userData.id);
const userDb = await client.findOrCreateUser({ const userDb = await client.findOrCreateUser({
id: user.id id: user.id,
}, true); }, true);
const userInfos = { const userInfos = {
...user.toJSON(), ...user.toJSON(),
...userDb, ...userDb,
...userData ...userData,
}; };
return userInfos; return userInfos;
@ -54,9 +54,9 @@ async function fetchUsers(array, client) {
...{ ...{
money: element.money, money: element.money,
level: element.level, level: element.level,
rep: element.rep rep: element.rep,
}, },
...user.toJSON() ...user.toJSON(),
}); });
}); });
}); });
@ -74,13 +74,13 @@ async function fetchUsers(array, client) {
async function fetchGuild(guildID, client, guilds) { async function fetchGuild(guildID, client, guilds) {
const guild = client.guilds.cache.get(guildID); const guild = client.guilds.cache.get(guildID);
const conf = await client.findOrCreateGuild({ const conf = await client.findOrCreateGuild({
id: guild.id id: guild.id,
}); });
return { return {
...guild, ...guild,
...conf.toJSON(), ...conf.toJSON(),
...guilds.find((g) => g.id === guild.id) ...guilds.find((g) => g.id === guild.id),
}; };
} }

View file

@ -5,7 +5,7 @@ class CommandHandler extends BaseEvent {
constructor() { constructor() {
super({ super({
name: "interactionCreate", name: "interactionCreate",
once: false once: false,
}); });
} }
@ -21,7 +21,7 @@ class CommandHandler extends BaseEvent {
const data = []; const data = [];
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: interaction.user.id id: interaction.user.id,
}); });
data.userData = userData; data.userData = userData;
@ -30,13 +30,13 @@ class CommandHandler extends BaseEvent {
if (interaction.inGuild()) { if (interaction.inGuild()) {
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
id: interaction.guildId id: interaction.guildId,
}); });
interaction.guild.data = data.guildData = guildData; interaction.guild.data = data.guildData = guildData;
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: interaction.member.id, id: interaction.member.id,
guildId: interaction.guildId guildId: interaction.guildId,
}); });
data.memberData = memberData; data.memberData = memberData;
} }
@ -50,8 +50,8 @@ class CommandHandler extends BaseEvent {
content: interaction.user.toString(), content: interaction.user.toString(),
files: [{ files: [{
name: "achievement_unlocked2.png", name: "achievement_unlocked2.png",
attachment: "./assets/img/achievements/achievement_unlocked2.png" attachment: "./assets/img/achievements/achievement_unlocked2.png",
}] }],
}); });
} }

View file

@ -5,7 +5,7 @@ class GuildCreate extends BaseEvent {
constructor() { constructor() {
super({ super({
name: "guildCreate", name: "guildCreate",
once: false once: false,
}); });
} }
@ -18,7 +18,7 @@ class GuildCreate extends BaseEvent {
const messageOptions = {}; const messageOptions = {};
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: guild.ownerId id: guild.ownerId,
}); });
if (!userData.achievements.invite.achieved) { if (!userData.achievements.invite.achieved) {
@ -26,7 +26,7 @@ class GuildCreate extends BaseEvent {
userData.achievements.invite.achieved = true; userData.achievements.invite.achieved = true;
messageOptions.files = [{ messageOptions.files = [{
name: "unlocked.png", name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked7.png" attachment: "./assets/img/achievements/achievement_unlocked7.png",
}]; }];
userData.markModified("achievements.invite"); userData.markModified("achievements.invite");
await userData.save(); await userData.save();
@ -34,12 +34,12 @@ class GuildCreate extends BaseEvent {
const thanksEmbed = new EmbedBuilder() const thanksEmbed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: "Спасибо что добавили меня на свой сервер!" name: "Спасибо что добавили меня на свой сервер!",
}) })
.setDescription("Чтобы получить список команд, используйте `/help`!.") .setDescription("Чтобы получить список команд, используйте `/help`!.")
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.setTimestamp(); .setTimestamp();
messageOptions.embeds = [thanksEmbed]; messageOptions.embeds = [thanksEmbed];
@ -53,12 +53,12 @@ class GuildCreate extends BaseEvent {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: guild.name, name: guild.name,
iconURL: guild.iconURL() iconURL: guild.iconURL(),
}) })
.setColor("#32CD32") .setColor("#32CD32")
.setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${client.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))} и **${bots}** ${client.getNoun(bots, client.translate("misc:NOUNS:BOTS:1"), client.translate("misc:NOUNS:BOTS:2"), client.translate("misc:NOUNS:BOTS:5"))}`); .setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${client.getNoun(users, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))} и **${bots}** ${client.getNoun(bots, client.translate("misc:NOUNS:BOTS:1"), client.translate("misc:NOUNS:BOTS:2"), client.translate("misc:NOUNS:BOTS:5"))}`);
client.channels.cache.get(client.config.support.logs).send({ client.channels.cache.get(client.config.support.logs).send({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -5,7 +5,7 @@ class GuildDelete extends BaseEvent {
constructor() { constructor() {
super({ super({
name: "guildDelete", name: "guildDelete",
once: false once: false,
}); });
} }
@ -18,12 +18,12 @@ class GuildDelete extends BaseEvent {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: guild.name, name: guild.name,
iconURL: guild.iconURL() iconURL: guild.iconURL(),
}) })
.setColor("#B22222") .setColor("#B22222")
.setDescription(`Вышел с сервера **${guild.name}**.`); .setDescription(`Вышел с сервера **${guild.name}**.`);
client.channels.cache.get(client.config.support.logs).send({ client.channels.cache.get(client.config.support.logs).send({
embeds: [embed] embeds: [embed],
}); });
} }
} }

View file

@ -8,9 +8,8 @@ Canvas.registerFont(resolve("./assets/fonts/KeepCalm-Medium.ttf"), { family: "Ke
const applyText = (canvas, text, defaultFontSize, width, font) => { const applyText = (canvas, text, defaultFontSize, width, font) => {
const ctx = canvas.getContext("2d"); const ctx = canvas.getContext("2d");
do { do ctx.font = `${(defaultFontSize -= 1)}px ${font}`;
ctx.font = `${(defaultFontSize -= 1)}px ${font}`; while (ctx.measureText(text).width > width);
} while (ctx.measureText(text).width > width);
return ctx.font; return ctx.font;
}; };
@ -19,7 +18,7 @@ class GuildMemberAdd extends BaseEvent {
constructor() { constructor() {
super({ super({
name: "guildMemberAdd", name: "guildMemberAdd",
once: false once: false,
}); });
} }
@ -34,23 +33,22 @@ class GuildMemberAdd extends BaseEvent {
await member.guild.members.fetch(); await member.guild.members.fetch();
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
id: member.guild.id id: member.guild.id,
}); });
member.guild.data = guildData; member.guild.data = guildData;
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: member.id, id: member.id,
guildId: member.guild.id guildId: member.guild.id,
}); });
if (memberData.mute.muted && memberData.mute.endDate > Date.now()) { if (memberData.mute.muted && memberData.mute.endDate > Date.now())
member.guild.channels.cache.forEach((channel) => { member.guild.channels.cache.forEach((channel) => {
channel.permissionOverwrites.edit(member.id, { channel.permissionOverwrites.edit(member.id, {
SEND_MESSAGES: false, SEND_MESSAGES: false,
ADD_REACTIONS: false, ADD_REACTIONS: false,
CONNECT: false CONNECT: false,
}).catch(() => {}); }).catch(() => {});
}); });
}
if (guildData.plugins.autorole.enabled) member.roles.add(guildData.plugins.autorole.role); if (guildData.plugins.autorole.enabled) member.roles.add(guildData.plugins.autorole.role);
@ -94,11 +92,11 @@ class GuildMemberAdd extends BaseEvent {
// Draw server name // Draw server name
ctx.font = applyText(canvas, client.translate("administration/welcome:IMG_WELCOME", { ctx.font = applyText(canvas, client.translate("administration/welcome:IMG_WELCOME", {
server: member.guild.name server: member.guild.name,
}, member.guild.data.language), 53, 625, "RubikMonoOne"); }, member.guild.data.language), 53, 625, "RubikMonoOne");
ctx.fillText(client.translate("administration/welcome:IMG_WELCOME", { ctx.fillText(client.translate("administration/welcome:IMG_WELCOME", {
server: member.guild.name server: member.guild.name,
}, member.guild.data.language), canvas.width - 700, canvas.height - 70); }, member.guild.data.language), canvas.width - 700, canvas.height - 70);
// Draw discriminator // Draw discriminator
@ -131,20 +129,16 @@ class GuildMemberAdd extends BaseEvent {
ctx.closePath(); ctx.closePath();
ctx.clip(); ctx.clip();
const avatar = await Canvas.loadImage(member.displayAvatarURL({ const avatar = await Canvas.loadImage(member.displayAvatarURL({
extension: "jpg" extension: "jpg",
})); }));
ctx.drawImage(avatar, 45, 90, 270, 270); ctx.drawImage(avatar, 45, 90, 270, 270);
const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "welcome-image.png" }); const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "welcome-image.png" });
channel.send({ channel.send({
content: message, content: message,
files: [attachment] files: [attachment],
}); });
} else { } else channel.send({ content: message });
channel.send({
content: message
});
}
} }
} }
} }

View file

@ -8,9 +8,8 @@ Canvas.registerFont(resolve("./assets/fonts/KeepCalm-Medium.ttf"), { family: "Ke
const applyText = (canvas, text, defaultFontSize, width, font) => { const applyText = (canvas, text, defaultFontSize, width, font) => {
const ctx = canvas.getContext("2d"); const ctx = canvas.getContext("2d");
do { do ctx.font = `${(defaultFontSize -= 1)}px ${font}`;
ctx.font = `${(defaultFontSize -= 1)}px ${font}`; while (ctx.measureText(text).width > width);
} while (ctx.measureText(text).width > width);
return ctx.font; return ctx.font;
}; };
@ -19,7 +18,7 @@ class GuildMemberRemove extends BaseEvent {
constructor() { constructor() {
super({ super({
name: "guildMemberRemove", name: "guildMemberRemove",
once: false once: false,
}); });
} }
@ -34,7 +33,7 @@ class GuildMemberRemove extends BaseEvent {
await member.guild.members.fetch(); await member.guild.members.fetch();
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
id: member.guild.id id: member.guild.id,
}); });
member.guild.data = guildData; member.guild.data = guildData;
@ -78,11 +77,11 @@ class GuildMemberRemove extends BaseEvent {
// Draw server name // Draw server name
ctx.font = applyText(canvas, client.translate("administration/goodbye:IMG_GOODBYE", { ctx.font = applyText(canvas, client.translate("administration/goodbye:IMG_GOODBYE", {
server: member.guild.name server: member.guild.name,
}, member.guild.data.language), 53, 625, "RubikMonoOne"); }, member.guild.data.language), 53, 625, "RubikMonoOne");
ctx.fillText(client.translate("administration/goodbye:IMG_GOODBYE", { ctx.fillText(client.translate("administration/goodbye:IMG_GOODBYE", {
server: member.guild.name server: member.guild.name,
}, member.guild.data.language), canvas.width - 700, canvas.height - 70); }, member.guild.data.language), canvas.width - 700, canvas.height - 70);
// Draw discriminator // Draw discriminator
@ -116,20 +115,16 @@ class GuildMemberRemove extends BaseEvent {
ctx.clip(); ctx.clip();
const avatar = await Canvas.loadImage(member.displayAvatarURL({ const avatar = await Canvas.loadImage(member.displayAvatarURL({
extension: "png", extension: "png",
size: 512 size: 512,
})); }));
ctx.drawImage(avatar, 45, 90, 270, 270); ctx.drawImage(avatar, 45, 90, 270, 270);
const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "goodbye-image.png" }); const attachment = new AttachmentBuilder(canvas.toBuffer(), { name: "goodbye-image.png" });
channel.send({ channel.send({
content: message, content: message,
files: [attachment] files: [attachment],
}); });
} else { } else channel.send({ content: message });
channel.send({
content: message
});
}
} }
} }
} }

View file

@ -4,7 +4,7 @@ class GuildMemberUpdate extends BaseEvent {
constructor() { constructor() {
super({ super({
name: "guildMemberRemove", name: "guildMemberRemove",
once: false once: false,
}); });
} }
@ -21,7 +21,7 @@ class GuildMemberUpdate extends BaseEvent {
if (newMember?.roles.cache.some(r => r.name === "Поддержавшие JaBa")) { if (newMember?.roles.cache.some(r => r.name === "Поддержавшие JaBa")) {
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: newMember.id id: newMember.id,
}); });
userData.achievements.tip.progress.now = 1; userData.achievements.tip.progress.now = 1;
userData.achievements.tip.achieved = true; userData.achievements.tip.achieved = true;
@ -31,8 +31,8 @@ class GuildMemberUpdate extends BaseEvent {
newMember.send({ newMember.send({
files: [{ files: [{
name: "achievement_unlocked5.png", name: "achievement_unlocked5.png",
attachment: "./assets/img/achievements/achievement_unlocked5.png" attachment: "./assets/img/achievements/achievement_unlocked5.png",
}] }],
}); });
} }
} }

View file

@ -6,7 +6,7 @@ class MessageCreate extends BaseEvent {
constructor() { constructor() {
super({ super({
name: "messageCreate", name: "messageCreate",
once: false once: false,
}); });
} }
@ -25,7 +25,7 @@ class MessageCreate extends BaseEvent {
if (message.guild && !message.member) await message.guild.members.fetch(message.author.id); if (message.guild && !message.member) await message.guild.members.fetch(message.author.id);
if (message.guild) { if (message.guild) {
const guild = await client.findOrCreateGuild({ const guild = await client.findOrCreateGuild({
id: message.guild.id id: message.guild.id,
}); });
message.guild.data = data.guildData = guild; message.guild.data = data.guildData = guild;
} }
@ -33,40 +33,38 @@ class MessageCreate extends BaseEvent {
if (message.guild) { if (message.guild) {
const memberData = await client.findOrCreateMember({ const memberData = await client.findOrCreateMember({
id: message.author.id, id: message.author.id,
guildId: message.guild.id guildId: message.guild.id,
}); });
data.memberData = memberData; data.memberData = memberData;
} }
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: message.author.id id: message.author.id,
}); });
data.userData = userData; data.userData = userData;
if (message.guild) { if (message.guild) {
await updateXp(client, message, data); await updateXp(client, message, data);
if (data.guildData.plugins.automod.enabled && !data.guildData.plugins.automod.ignored.includes(message.channel.id)) { if (data.guildData.plugins.automod.enabled && !data.guildData.plugins.automod.ignored.includes(message.channel.id))
if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content)) { if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content))
if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ManageMessages)) { if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ManageMessages)) {
message.delete(); message.delete();
return message.error("administration/automod:DELETED"); return message.error("administration/automod:DELETED");
} }
}
}
const afkReason = data.userData.afk; const afkReason = data.userData.afk;
if (afkReason) { if (afkReason) {
data.userData.afk = null; data.userData.afk = null;
await data.userData.save(); await data.userData.save();
message.replyT("general/afk:DELETED", { message.replyT("general/afk:DELETED", {
username: message.author.username username: message.author.username,
}, { mention: true }); }, { mention: true });
} }
message.mentions.users.forEach(async (u) => { message.mentions.users.forEach(async (u) => {
const userData = await client.findOrCreateUser({ const userData = await client.findOrCreateUser({
id: u.id id: u.id,
}); });
if (userData.afk) message.error("general/afk:IS_AFK", { user: u.tag, reason: userData.afk }); if (userData.afk) message.error("general/afk:IS_AFK", { user: u.tag, reason: userData.afk });
}); });
@ -87,9 +85,8 @@ async function updateXp(client, msg, data) {
level = parseInt(data.memberData.level), level = parseInt(data.memberData.level),
isInCooldown = xpCooldown[msg.author.id]; isInCooldown = xpCooldown[msg.author.id];
if (isInCooldown) { if (isInCooldown)
if (isInCooldown > Date.now()) return; if (isInCooldown > Date.now()) return;
}
const toWait = Date.now() + (60 * 1000); // 1 min const toWait = Date.now() + (60 * 1000); // 1 min
xpCooldown[msg.author.id] = toWait; xpCooldown[msg.author.id] = toWait;
@ -102,7 +99,7 @@ async function updateXp(client, msg, data) {
data.memberData.level = parseInt(level + 1, 10); data.memberData.level = parseInt(level + 1, 10);
data.memberData.exp = 0; data.memberData.exp = 0;
msg.replyT("misc:LEVEL_UP", { msg.replyT("misc:LEVEL_UP", {
level: data.memberData.level level: data.memberData.level,
}, { mention: false }); }, { mention: false });
} else data.memberData.exp = parseInt(newXp, 10); } else data.memberData.exp = parseInt(newXp, 10);

View file

@ -5,7 +5,7 @@ class Ready extends BaseEvent {
constructor() { constructor() {
super({ super({
name: "ready", name: "ready",
once: false once: false,
}); });
} }
/** /**
@ -20,7 +20,7 @@ class Ready extends BaseEvent {
client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready"); client.logger.log(`Loaded a total of ${commands.length} command(s).`, "ready");
client.logger.log(`${client.user.tag}, ready to serve ${tUsers} users in ${tServers} servers.`, "ready"); client.logger.log(`${client.user.tag}, ready to serve ${tUsers} users in ${tServers} servers.`, "ready");
client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"] , permissions: [ PermissionsBitField.Flags.Administrator ] })}`, "ready"); client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] })}`, "ready");
const birthdays = require("../helpers/birthdays"); const birthdays = require("../helpers/birthdays");
birthdays.init(client); birthdays.init(client);
@ -41,7 +41,7 @@ class Ready extends BaseEvent {
{ name: "help", type: ActivityType.Watching }, { name: "help", type: ActivityType.Watching },
{ name: `${commands.length} ${client.getNoun(commands.length, client.translate("misc:NOUNS:COMMANDS:1"), client.translate("misc:NOUNS:COMMANDS:2"), client.translate("misc:NOUNS:COMMANDS:5"))}`, type: ActivityType.Listening }, { name: `${commands.length} ${client.getNoun(commands.length, client.translate("misc:NOUNS:COMMANDS:1"), client.translate("misc:NOUNS:COMMANDS:2"), client.translate("misc:NOUNS:COMMANDS:5"))}`, type: ActivityType.Listening },
{ name: `${tServers} ${client.getNoun(tServers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}`, type: ActivityType.Watching }, { name: `${tServers} ${client.getNoun(tServers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}`, type: ActivityType.Watching },
{ name: `${tUsers} ${client.getNoun(tUsers, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}`, type: ActivityType.Watching } { name: `${tUsers} ${client.getNoun(tUsers, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}`, type: ActivityType.Watching },
]; ];
let i = 0; let i = 0;
@ -52,7 +52,7 @@ class Ready extends BaseEvent {
const toShow = status[i]; const toShow = status[i];
client.user.setActivity(`${toShow.name} | v${version}`, { client.user.setActivity(`${toShow.name} | v${version}`, {
type: toShow.type type: toShow.type,
}); });
if (status[i + 1]) i++; if (status[i + 1]) i++;

View file

@ -25,7 +25,7 @@ module.exports.update = function (client) {
categories.sort().forEach(cat => { categories.sort().forEach(cat => {
const categoriesArray = [ const categoriesArray = [
["Название", "Описание", "Использование", "Разрешено использование"] ["Название", "Описание", "Использование", "Разрешено использование"],
]; ];
const cmds = [...new Map(commands.filter(cmd => cmd.category === cat).map(v => [v.constructor.name, v])).values()]; const cmds = [...new Map(commands.filter(cmd => cmd.category === cat).map(v => [v.constructor.name, v])).values()];
@ -38,7 +38,7 @@ module.exports.update = function (client) {
`**${cmd.command.name}** ${cmd.aliases.length ? `**(${cmd.aliases.join(", ")})**` : ""}`, `**${cmd.command.name}** ${cmd.aliases.length ? `**(${cmd.aliases.join(", ")})**` : ""}`,
client.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`), client.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:DESCRIPTION`),
`${cmd.command.name} ${client.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`)}`, `${cmd.command.name} ${client.translate(`${cmd.category.toLowerCase()}/${cmd.command.name}:USAGE`)}`,
cmd.guildOnly ? "Только на сервере" : "На сервере и в ЛС бота" cmd.guildOnly ? "Только на сервере" : "На сервере и в ЛС бота",
]); ]);
}); });
text += `${table(categoriesArray)}\n\n`; text += `${table(categoriesArray)}\n\n`;

View file

@ -14,7 +14,7 @@ module.exports.init = async function (client) {
client.guilds.cache.forEach(async guild => { client.guilds.cache.forEach(async guild => {
const guildData = await client.findOrCreateGuild({ const guildData = await client.findOrCreateGuild({
id: guild.id id: guild.id,
}); });
if (guildData.plugins.birthdays) { if (guildData.plugins.birthdays) {
@ -36,12 +36,12 @@ module.exports.init = async function (client) {
name: client.user.username, name: client.user.username,
iconURL: client.user.displayAvatarURL({ iconURL: client.user.displayAvatarURL({
extension: "png", extension: "png",
size: 512 size: 512,
}) }),
}) })
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}) })
.addFields([ .addFields([
{ {
@ -49,13 +49,13 @@ module.exports.init = async function (client) {
value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", { value: client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", {
name: user.username, name: user.username,
user: user.id, user: user.id,
age: `**${age}** ${client.getNoun(age, client.translate("misc:NOUNS:AGE:1"), client.translate("misc:NOUNS:AGE:2"), client.translate("misc:NOUNS:AGE:5"))}` age: `**${age}** ${client.getNoun(age, client.translate("misc:NOUNS:AGE:1"), client.translate("misc:NOUNS:AGE:2"), client.translate("misc:NOUNS:AGE:5"))}`,
}) }),
} },
]); ]);
const msg = await channel.send({ const msg = await channel.send({
embeds: [embed] embeds: [embed],
}); });
await msg.react("🎉"); await msg.react("🎉");
} }

View file

@ -28,23 +28,23 @@ module.exports.init = function (client) {
mustSent.forEach(r => { mustSent.forEach(r => {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: client.translate("general/remindme:TITLE") name: client.translate("general/remindme:TITLE"),
}) })
.setDescription(client.translate("general/remindme:CREATED", { .setDescription(client.translate("general/remindme:CREATED", {
time: moment(r.createdAt).locale(client.defaultLanguage).format("dddd, Do MMMM YYYY, HH:mm:ss") time: moment(r.createdAt).locale(client.defaultLanguage).format("dddd, Do MMMM YYYY, HH:mm:ss"),
})) }))
.addFields([ .addFields([
{ {
name: client.translate("common:MESSAGE"), name: client.translate("common:MESSAGE"),
value: r.message value: r.message,
} },
]) ])
.setColor(client.config.embed.color) .setColor(client.config.embed.color)
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer,
}); });
dUser.send({ dUser.send({
embeds: [embed] embeds: [embed],
}); });
}); });
user.reminds = user.reminds.filter(r => r.sendAt >= dateNow); user.reminds = user.reminds.filter(r => r.sendAt >= dateNow);

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