Переход на discord.js 14

Фиксы
Подготовка старых команд к d.js 14
This commit is contained in:
JonnyBro 2022-07-31 17:08:00 +05:00
parent 4b857b830b
commit d7b2790200
104 changed files with 1571 additions and 2441 deletions

View file

@ -1,145 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js"),
backup = require("discord-backup");
backup.setStorageFolder(__dirname + "/../../backups");
class Backup extends Command {
constructor(client) {
super(client, {
name: "backup",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["ba"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ADMINISTRATOR"],
nsfw: false,
ownerOnly: false,
cooldown: 20000
});
}
async run(message, args, data) {
const status = args[0];
if (!status) return message.error("administration/backup:MISSING_STATUS");
if (status === "create") {
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
backup.create(message.guild).then((backup) => {
m.delete();
message.success("administration/backup:SUCCESS_PUBLIC");
message.author.send(message.translate("administration/backup:SUCCESS_PRIVATE", {
backupID: backup.id
})).catch(() => {
backup.remove(backup.id);
message.error("misc:CANNOT_DM");
});
}).catch((err) => {
console.error(err);
return message.error("misc:ERR_OCCURRED");
});
} else if (status === "load") {
const backupID = args[1];
if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID");
backup.fetch(backupID).then(async () => {
message.sendT("administration/backup:CONFIRMATION");
const filter = m => m.author.id === message.author.id;
const collector = message.channel.createMessageCollector({
filter,
time: 20000
});
collector.on("collect", async msg => {
if (msg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
message.author.send(message.translate("administration/backup:START_LOADING"));
backup.load(backupID, message.guild).then(() => {
backup.remove(backupID);
message.author.send(message.translate("administration/backup:LOAD_SUCCESS"));
collector.stop();
}).catch((err) => {
console.error(err);
return message.error("misc:ERR_OCCURRED");
});
}
});
collector.on("end", (_, reason) => {
if (reason === "time") return message.error("misc:TIMES_UP");
});
}).catch((err) => {
console.error(err);
return message.error("administration/backup:NO_BACKUP_FOUND", {
backupID
});
});
} else if (status === "info") {
const backupID = args[1];
if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID");
backup.fetch(backupID).then(async (backupInfo) => {
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("administration/backup:TITLE_INFO")
})
.addField(message.translate("administration/backup:TITLE_ID"), backupInfo.id, true)
.addField(message.translate("administration/backup:TITLE_SERVER_ID"), backupInfo.data.guildID.toString(), true)
.addField(message.translate("administration/backup:TITLE_SIZE"), `${backupInfo.size} kb`, true)
.addField(message.translate("administration/backup:TITLE_CREATED_AT"), this.client.printDate(new Date(backupInfo.data.createdTimestamp)), true)
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
message.reply({
embeds: [embed]
});
}).catch((err) => {
console.error(err);
return message.error("administration/backup:NO_BACKUP_FOUND", {
backupID
});
});
} else if (status === "remove") {
const backupID = args[1];
if (!backupID) return message.error("administration/backup:MISSING_BACKUP_ID");
backup.fetch(backupID).then(async () => {
message.sendT("administration/backup:REMOVE_CONFIRMATION");
const filter = m => m.author.id === message.author.id;
const collector = message.channel.createMessageCollector({
filter,
time: 20000
});
collector.on("collect", async msg => {
if (msg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
backup.remove(backupID).then(async () => {
message.success("administration/backup:SUCCESS_REMOVED");
});
collector.stop();
}
});
collector.on("end", (_, reason) => {
if (reason === "time") return message.error("misc:TIMES_UP");
});
}).catch((err) => {
console.error(err);
return message.error("administration/backup:NO_BACKUP_FOUND", {
backupID
});
});
} else {
return message.error("administration/backup:MISSING_STATUS");
}
}
}
module.exports = Backup;

View file

@ -20,44 +20,48 @@ class Configuration extends Command {
async run(message, args, data) { async run(message, args, data) {
const guildData = data.guild; const guildData = data.guild;
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.guild.name, name: message.guild.name,
iconURL: message.guild.iconURL({ iconURL: message.guild.iconURL()
dynamic: true
})
}) })
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer
}); });
// Guild prefix embed.addFields([
embed.addField(message.translate("administration/configuration:PREFIX_TITLE"), guildData.prefix); { // Guild prefix
name: message.translate("administration/configuration:PREFIX_TITLE"),
// Ignored channels value: guildData.prefix
embed.addField(message.translate("administration/configuration:IGNORED_CHANNELS_TITLE"), guildData.ignoredChannels.length > 0 ? guildData.ignoredChannels.map((ch) => `<#${ch}>`).join(", ") : message.translate("administration/configuration:NO_IGNORED_CHANNELS")); },
{ // Ignored channels
// Autorole plugin name: message.translate("administration/configuration:IGNORED_CHANNELS_TITLE"),
embed.addField(message.translate("administration/configuration:AUTOROLE_TITLE"), guildData.plugins.autorole.enabled ? message.translate("administration/configuration:AUTOROLE_CONTENT", { value: guildData.ignoredChannels.length > 0 ? guildData.ignoredChannels.map((ch) => `<#${ch}>`).join(", ") : message.translate("administration/configuration:NO_IGNORED_CHANNELS")
},
{ // Autorole plugin
name: message.translate("administration/configuration:AUTOROLE_TITLE"),
value: guildData.plugins.autorole.enabled ? message.translate("administration/configuration:AUTOROLE_CONTENT", {
roleName: `<@&${guildData.plugins.autorole.role}>` roleName: `<@&${guildData.plugins.autorole.role}>`
}) : message.translate("administration/configuration:AUTOROLE_DISABLED")); }) : message.translate("administration/configuration:AUTOROLE_DISABLED")
},
// Welcome plugin { // Welcome plugin
embed.addField(message.translate("administration/configuration:WELCOME_TITLE"), guildData.plugins.welcome.enabled ? message.translate("administration/configuration:WELCOME_CONTENT", { name: message.translate("administration/configuration:WELCOME_TITLE"),
value: guildData.plugins.welcome.enabled ? message.translate("administration/configuration:WELCOME_CONTENT", {
channel: `<#${guildData.plugins.welcome.channel}>`, channel: `<#${guildData.plugins.welcome.channel}>`,
withImage: guildData.plugins.welcome.withImage ? message.translate("common:YES") : message.translate("common:NO") withImage: guildData.plugins.welcome.withImage ? message.translate("common:YES") : message.translate("common:NO")
}) : message.translate("administration/configuration:WELCOME_DISABLED")); }) : message.translate("administration/configuration:WELCOME_DISABLED")
},
// Goodbye plugin { // Goodbye plugin
embed.addField(message.translate("administration/configuration:GOODBYE_TITLE"), guildData.plugins.goodbye.enabled ? message.translate("administration/configuration:GOODBYE_CONTENT", { name: message.translate("administration/configuration:GOODBYE_TITLE"),
value: guildData.plugins.goodbye.enabled ? message.translate("administration/configuration:GOODBYE_CONTENT", {
channel: `<#${guildData.plugins.goodbye.channel}>`, channel: `<#${guildData.plugins.goodbye.channel}>`,
withImage: guildData.plugins.goodbye.withImage ? message.translate("common:YES") : message.translate("common:NO") withImage: guildData.plugins.goodbye.withImage ? message.translate("common:YES") : message.translate("common:NO")
}) : message.translate("administration/configuration:GOODBYE_DISABLED")); }) : message.translate("administration/configuration:GOODBYE_DISABLED")
},
// Special channels { // Special channels
embed.addField(message.translate("administration/configuration:SPECIAL_CHANNELS"), name: message.translate("administration/configuration:SPECIAL_CHANNELS"),
message.translate("administration/configuration:SUGGESTIONS", { value: message.translate("administration/configuration:SUGGESTIONS", {
channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : message.translate("common:NOT_DEFINED") channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : message.translate("common:NOT_DEFINED")
}) + "\n" + }) + "\n" +
message.translate("administration/configuration:REPORTS", { message.translate("administration/configuration:REPORTS", {
@ -69,25 +73,30 @@ class Configuration extends Command {
message.translate("administration/configuration:BIRTHDAYS", { message.translate("administration/configuration:BIRTHDAYS", {
channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : message.translate("common:NOT_DEFINED") channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : message.translate("common:NOT_DEFINED")
}) })
); },
{ // Auto sanctions
// Auto sanctions name: message.translate("administration/configuration:AUTO_SANCTIONS"),
embed.addField(message.translate("administration/configuration:AUTO_SANCTIONS"), (guildData.plugins.warnsSanctions.kick ? message.translate("administration/configuration:KICK_CONTENT", { value: (guildData.plugins.warnsSanctions.kick ? message.translate("administration/configuration:KICK_CONTENT", {
count: guildData.plugins.warnsSanctions.kick count: guildData.plugins.warnsSanctions.kick
}) : message.translate("administration/configuration:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? message.translate("administration/configuration:BAN_CONTENT", { }) : message.translate("administration/configuration:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? message.translate("administration/configuration:BAN_CONTENT", {
count: guildData.plugins.warnsSanctions.ban count: guildData.plugins.warnsSanctions.ban
}) : message.translate("administration/configuration:BAN_NOT_DEFINED"))); }) : message.translate("administration/configuration:BAN_NOT_DEFINED"))
},
// Automod plugin { // Automod plugin
embed.addField(message.translate("administration/configuration:AUTOMOD_TITLE"), guildData.plugins.automod.enabled ? message.translate("administration/configuration:AUTOMOD_CONTENT", { name: message.translate("administration/configuration:AUTOMOD_TITLE"),
value: guildData.plugins.automod.enabled ? message.translate("administration/configuration:AUTOMOD_CONTENT", {
channels: guildData.plugins.automod.ignored.map((ch) => `<#${ch}>`) channels: guildData.plugins.automod.ignored.map((ch) => `<#${ch}>`)
}) : message.translate("administration/configuration:AUTOMOD_DISABLED")); }) : message.translate("administration/configuration:AUTOMOD_DISABLED")
},
// Auto-delete mod commands { // Auto-delete mod commands
embed.addField(message.translate("administration/configuration:AUTODELETEMOD"), guildData.autoDeleteModCommands ? message.translate("administration/configuration:AUTODELETEMOD_ENABLED") : message.translate("administration/configuration:AUTODELETEMOD_DISABLED")); name: message.translate("administration/configuration:AUTODELETEMOD"),
value: guildData.autoDeleteModCommands ? message.translate("administration/configuration:AUTODELETEMOD_ENABLED") : message.translate("administration/configuration:AUTODELETEMOD_DISABLED")
// Dashboard link },
embed.addField(message.translate("administration/configuration:DASHBOARD_TITLE"), `[${message.translate("administration/configuration:DASHBOARD_CONTENT")}](${data.config.dashboard.baseURL})`); { // Dashboard link
name: message.translate("administration/configuration:DASHBOARD_TITLE"),
value: `[${message.translate("administration/configuration:DASHBOARD_CONTENT")}](${data.config.dashboard.baseURL})`
}
]);
message.reply({ message.reply({
embeds: [embed] embeds: [embed]

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
{ Util } = require("discord.js"); { parseEmoji } = require("discord.js");
class Stealemoji extends Command { class Stealemoji extends Command {
constructor(client) { constructor(client) {
@ -21,7 +21,7 @@ class Stealemoji extends Command {
if (!args.length) return message.error("administration/stealemoji:MISSING_EMOJI"); if (!args.length) return message.error("administration/stealemoji:MISSING_EMOJI");
for (const rawEmoji of args) { for (const rawEmoji of args) {
const parsedEmoji = Util.parseEmoji(rawEmoji); const parsedEmoji = parseEmoji(rawEmoji);
const extension = parsedEmoji.animated ? "gif" : "png"; const extension = parsedEmoji.animated ? "gif" : "png";
message.guild.emojis message.guild.emojis

View file

@ -26,7 +26,7 @@ class Achievements extends Command {
id: member.id id: member.id
})); }));
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("economy/achievements:TITLE") name: message.translate("economy/achievements:TITLE")
}) })
@ -35,41 +35,64 @@ class Achievements extends Command {
text: data.config.embed.footer text: data.config.embed.footer
}); });
embed.addField(message.translate("economy/achievements:SEND_CMD"), message.translate("economy/achievements:PROGRESS", { embed.addFields([
{
name: message.translate("economy/achievements:SEND_CMD"),
value: message.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))
})); })
embed.addField(message.translate("economy/achievements:CLAIM_SALARY"), message.translate("economy/achievements:PROGRESS", { },
{
name: message.translate("economy/achievements:CLAIM_SALARY"),
value: message.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))
})); })
embed.addField(message.translate("economy/achievements:MARRY"), message.translate("economy/achievements:PROGRESS", { },
{
name: message.translate("economy/achievements:MARRY"),
value: message.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))
})); })
embed.addField(message.translate("economy/achievements:SLOTS"), message.translate("economy/achievements:PROGRESS", { },
{
name: message.translate("economy/achievements:SLOTS"),
value: message.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))
})); })
embed.addField(message.translate("economy/achievements:TIP"), message.translate("economy/achievements:PROGRESS", { },
{
name: message.translate("economy/achievements:TIP"),
value: message.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))
})); })
embed.addField(message.translate("economy/achievements:REP"), message.translate("economy/achievements:PROGRESS", { },
{
name: message.translate("economy/achievements:REP"),
value: message.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))
})); })
embed.addField(message.translate("economy/achievements:INVITE"), message.translate("economy/achievements:PROGRESS", { },
{
name: message.translate("economy/achievements:INVITE"),
value: message.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))
})); })
}
]);
message.reply({ message.reply({
embeds: [embed] embeds: [embed]

View file

@ -45,14 +45,12 @@ class Leaderboard extends Command {
money += `${data.money}\n`; money += `${data.money}\n`;
} }
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("economy/leaderboard:TABLE", { name: message.translate("economy/leaderboard:TABLE", {
name: message.guild.name name: message.guild.name
}), }),
iconURL: message.guild.iconURL({ iconURL: message.guild.iconURL()
dynamic: true
})
}) })
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.addFields({ .addFields({
@ -93,14 +91,12 @@ class Leaderboard extends Command {
xp += `${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}\n`; xp += `${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}\n`;
} }
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("economy/leaderboard:TABLE", { name: message.translate("economy/leaderboard:TABLE", {
name: message.guild.name name: message.guild.name
}), }),
iconURL: message.guild.iconURL({ iconURL: message.guild.iconURL()
dynamic: true
})
}) })
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.addFields({ .addFields({
@ -142,14 +138,12 @@ class Leaderboard extends Command {
rep += `${data.rep}\n`; rep += `${data.rep}\n`;
} }
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("economy/leaderboard:TABLE", { name: message.translate("economy/leaderboard:TABLE", {
name: message.guild.name name: message.guild.name
}), }),
iconURL: message.guild.iconURL({ iconURL: message.guild.iconURL()
dynamic: true
})
}) })
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.addFields({ .addFields({

View file

@ -48,20 +48,33 @@ class Money extends Command {
globalMoney += data.bankSold; globalMoney += data.bankSold;
}); });
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("economy/money:TITLE", { name: message.translate("economy/money:TITLE", {
username: member.user.username username: member.user.username
}), }),
iconURL: member.user.displayAvatarURL({ iconURL: member.user.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })
.addField(message.translate("economy/profile:CASH"), `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) .addFields([
.addField(message.translate("economy/profile:BANK"), `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) {
.addField(message.translate("economy/profile:GLOBAL"), `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) name: message.translate("economy/profile:CASH"),
value: `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true
},
{
name: message.translate("economy/profile:BANK"),
value: `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true
},
{
name: message.translate("economy/profile:GLOBAL"),
value: `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true
}
])
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer

View file

@ -51,32 +51,78 @@ class Profile extends Command {
globalMoney += data.bankSold; globalMoney += data.bankSold;
}); });
const profileEmbed = new Discord.MessageEmbed() const profileEmbed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("economy/profile:TITLE", { name: message.translate("economy/profile:TITLE", {
username: member.user.tag username: member.user.tag
}), }),
iconURL: member.user.displayAvatarURL({ iconURL: member.user.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })
.setImage("attachment://achievements.png") .setImage("attachment://achievements.png")
.addField(this.client.customEmojis.link + " " + message.translate("economy/profile:LINK"), `[${message.translate("economy/profile:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/user/${member.user.id}/${message.guild.id})`) .addFields([
.addField(message.translate("economy/profile:BIO"), userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")) {
.addField(message.translate("economy/profile:CASH"), `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) name: this.client.customEmojis.link + " " + message.translate("economy/profile:LINK"),
.addField(message.translate("economy/profile:BANK"), `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) value: `[${message.translate("economy/profile:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/user/${member.user.id}/${message.guild.id})`
.addField(message.translate("economy/profile:GLOBAL"), `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) },
.addField(message.translate("economy/profile:REPUTATION"), `**${userData.rep}** ${message.getNoun(userData.rep, message.translate("misc:NOUNS:POINTS:1"), message.translate("misc:NOUNS:POINTS:2"), message.translate("misc:NOUNS:POINTS:5"))}`, true) {
.addField(message.translate("economy/profile:LEVEL"), `**${memberData.level}**`, true) name: message.translate("economy/profile:BIO"),
.addField(message.translate("economy/profile:EXP"), `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`, true) value: userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")
.addField(message.translate("economy/profile:REGISTERED"), this.client.printDate(new Date(memberData.registeredAt)), true) },
.addField(message.translate("economy/profile:BIRTHDATE"), (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE") : this.client.printDate(new Date(userData.birthdate))), true) {
.addField(message.translate("economy/profile:LOVER"), (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag), true) name: message.translate("economy/profile:CASH"),
.addField(message.translate("economy/profile:ACHIEVEMENTS"), message.translate("economy/profile:ACHIEVEMENTS_CONTENT", { value: `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true
},
{
name: message.translate("economy/profile:BANK"),
value: `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true
},
{
name: message.translate("economy/profile:GLOBAL"),
value: `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
inline: true
},
{
name: message.translate("economy/profile:REPUTATION"),
value: `**${userData.rep}** ${message.getNoun(userData.rep, message.translate("misc:NOUNS:POINTS:1"), message.translate("misc:NOUNS:POINTS:2"), message.translate("misc:NOUNS:POINTS:5"))}`,
inline: true
},
{
name: message.translate("economy/profile:LEVEL"),
value:`**${memberData.level}**`,
inline: true
},
{
name: message.translate("economy/profile:EXP"),
value: `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`,
inline: true
},
{
name: message.translate("economy/profile:REGISTERED"),
value: this.client.printDate(new Date(memberData.registeredAt)),
inline: true
},
{
name: message.translate("economy/profile:BIRTHDATE"),
value: (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE") : this.client.printDate(new Date(userData.birthdate))),
inline: true
},
{
name: message.translate("economy/profile:LOVER"),
value: (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag),
inline: true
},
{
name: message.translate("economy/profile:ACHIEVEMENTS"),
value: message.translate("economy/profile:ACHIEVEMENTS_CONTENT", {
prefix: data.guild.prefix prefix: data.guild.prefix
})) })
}
])
.setColor(data.config.embed.color) // Sets the color of the embed .setColor(data.config.embed.color) // Sets the color of the embed
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer

View file

@ -18,12 +18,11 @@ class Transactions extends Command {
} }
async run(message, args, data) { async run(message, args, data) {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("economy/transactions:EMBED_TRANSACTIONS"), name: message.translate("economy/transactions:EMBED_TRANSACTIONS"),
iconURL: message.author.displayAvatarURL({ iconURL: message.author.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })
@ -43,8 +42,20 @@ class Transactions extends Command {
if (transactions.length < 1) { if (transactions.length < 1) {
embed.setDescription(message.translate("economy/transactions:NO_TRANSACTIONS")); embed.setDescription(message.translate("economy/transactions:NO_TRANSACTIONS"));
} else { } else {
if (sortedTransactions[0].length > 0) embed.addField(message.translate("economy/transactions:T_GOT"), sortedTransactions[0].join("\n"), true); if (sortedTransactions[0].length > 0) embed.addFields([
if (sortedTransactions[1].length > 0) embed.addField(message.translate("economy/transactions:T_SEND"), sortedTransactions[1].join("\n"), true); {
name: message.translate("economy/transactions:T_GOT"),
value: sortedTransactions[0].join("\n"),
inline: true
}
]);
if (sortedTransactions[1].length > 0) embed.addFields([
{
name: message.translate("economy/transactions:T_SEND"),
value: sortedTransactions[1].join("\n"),
inline: true
}
]);
} }
message.reply({ message.reply({

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"); { parseEmoji, EmbedBuilder } = require("discord.js");
class Work extends Command { class Work extends Command {
constructor(client) { constructor(client) {
@ -39,12 +39,11 @@ class Work extends Command {
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1; data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
await data.memberData.save(); await data.memberData.save();
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setFooter({ .setFooter({
text: message.translate("economy/work:AWARD"), text: message.translate("economy/work:AWARD"),
iconURL: message.author.displayAvatarURL({ iconURL: message.author.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })
@ -61,22 +60,38 @@ class Work extends Command {
if (data.memberData.workStreak >= 5) { if (data.memberData.workStreak >= 5) {
won += 200; won += 200;
embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", { embed.addFields([
{
name: message.translate("economy/work:SALARY"),
value: message.translate("economy/work:SALARY_CONTENT", {
won: `${won} ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` won: `${won} ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
})) })
.addField(message.translate("economy/work:STREAK"), message.translate("economy/work:STREAK_CONTENT")); },
{
name: message.translate("economy/work:STREAK"),
value: message.translate("economy/work:STREAK_CONTENT")
}
]);
data.memberData.workStreak = 0; data.memberData.workStreak = 0;
} else { } else {
for (let i = 0; i < award.length; i++) { for (let i = 0; i < award.length; i++) {
if (data.memberData.workStreak > i) { if (data.memberData.workStreak > i) {
const letter = Discord.Util.parseEmoji(award[i]).name.split("_")[1]; const letter = parseEmoji(award[i]).name.split("_")[1];
award[i] = `:regional_indicator_${letter.toLowerCase()}:`; award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
} }
} }
embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", { embed.addFields([
{
name: message.translate("economy/work:SALARY"),
value: message.translate("economy/work:SALARY_CONTENT", {
won: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` won: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
})) })
.addField(message.translate("economy/work:STREAK"), award.join("")); },
{
name: message.translate("economy/work:STREAK"),
value: award.join("")
}
]);
} }
const info = { const info = {

View file

@ -1,3 +1,4 @@
const { ApplicationCommandType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Mention extends BaseCommand { class Mention extends BaseCommand {
@ -9,11 +10,11 @@ class Mention extends BaseCommand {
super({ super({
command: { command: {
name: "mention", name: "mention",
type: 2 // Type 2 is USER COMMAND. type: ApplicationCommandType.User
}, },
aliases: ["m"], // Application command aliases. aliases: [],
dirname: __dirname, dirname: __dirname,
guildOnly: true // Determines whether your command is only guild. guildOnly: true
}); });
} }
/** /**

View file

@ -1,35 +0,0 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const BaseCommand = require("../../base/BaseCommand");
class Ping extends BaseCommand {
/**
*
* @param {import("../../base/JaBa")} client
*/
constructor() {
super({
command: new SlashCommandBuilder()
.setName("ping")
.setDescription("Ping command."), // This option is included in type 1. You can configure this option directly with the SlashCommandBuilder feature.
aliases: ["p"], // Application command aliases.
dirname: __dirname,
guildOnly: true // Determines whether your command is only guild.
});
}
/**
*
* @param {import("../../base/JaBa")} client
*/
async onLoad() {
//...
}
/**
*
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").CommandInteraction} interaction
*/
async execute(client, interaction) {
return interaction.reply({ content: "Pong!", ephemeral: true });
}
}
module.exports = Ping;

View file

@ -1,3 +1,4 @@
const { ApplicationCommandType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Repeat extends BaseCommand { class Repeat extends BaseCommand {
@ -8,12 +9,12 @@ class Repeat extends BaseCommand {
constructor() { constructor() {
super({ super({
command: { command: {
name: "repeat", // Application command name. name: "repeat",
type: 3 // Type 3 is MESSAGE COMMAND. type: ApplicationCommandType.Message
}, },
aliases: ["r"], // Application command aliases. aliases: [],
dirname: __dirname, dirname: __dirname,
guildOnly: true // Determines whether your command is only guild. guildOnly: true
}); });
} }
/** /**

View file

@ -1,31 +0,0 @@
const Command = require("../../base/Command");
class Eightball extends Command {
constructor(client) {
super(client, {
name: "8ball",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["8b"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args) {
if (!args[0] || !message.content.endsWith("?")) return message.error("fun/8ball:ERR_QUESTION");
const answerN = this.client.functions.randomNum(1, 20);
const answer = message.translate(`fun/8ball:RESPONSE_${answerN}`);
message.reply({
content: answer
});
}
}
module.exports = Eightball;

View file

@ -1,34 +0,0 @@
const Command = require("../../base/Command"),
figlet = require("figlet"),
util = require("util"),
figletAsync = util.promisify(figlet);
class Ascii extends Command {
constructor(client) {
super(client, {
name: "ascii",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args) {
const text = args.join(" ");
if (!text || text.length > 20) return message.error("fun/ascii:TEXT_MISSING");
const rendered = await figletAsync(text);
message.reply({
content: "```" + rendered + "```"
});
}
}
module.exports = Ascii;

View file

@ -1,25 +0,0 @@
const Command = require("../../base/Command");
class Flip extends Command {
constructor(client) {
super(client, {
name: "flip",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["dice", "coin"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message) {
const isHeads = Math.random() > 0.5;
isHeads ? message.sendT("fun/flip:HEADS") : message.sendT("fun/flip:TAILS");
}
}
module.exports = Flip;

View file

@ -1,30 +0,0 @@
const Command = require("../../base/Command");
class Lmg extends Command {
constructor(client) {
super(client, {
name: "lmg",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["lmgtfy"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args) {
const question = args.join(" ");
if (!question) return message.error("fun/lmg:MISSING");
const encodedQuestion = question.replace(/[' '_]/g, "+");
await message.reply({
content: `<https://letmegooglethat.com/?q=${encodedQuestion}>`
});
message.delete().catch(() => {});
}
}
module.exports = Lmg;

View file

@ -1,59 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js"),
md5 = require("md5");
class Lovecalc extends Command {
constructor(client) {
super(client, {
name: "lovecalc",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["lc"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const firstMember = message.mentions.members.filter(m => m.id !== message.author.id).first();
if (!firstMember) return message.error("fun/lovecalc:MISSING");
const secondMember = message.mentions.members
.filter(m => m.id !== firstMember.id)
.filter(m => m.id !== message.author.id)
.first() || message.member;
if (!secondMember) return message.error("fun/lovecalc:MISSING");
const members = [firstMember, secondMember].sort((a, b) => parseInt(a.id, 10) - parseInt(b.id, 10));
const hash = md5(`${members[0].id}${members[1].user.username}${members[0].user.username}${members[1].id}`);
const string = hash
.split("")
.filter(e => !isNaN(e))
.join("");
const percent = parseInt(string.substr(0, 2), 10);
const embed = new Discord.MessageEmbed()
.setAuthor({
name: `❤️ ${message.translate("fun/lovecalc:DESCRIPTION")}`
})
.setDescription(message.translate("fun/lovecalc:CONTENT", {
percent,
firstUsername: firstMember.user.username,
secondUsername: secondMember.user.username
}))
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
message.reply({
embeds: [embed]
});
}
}
module.exports = Lovecalc;

View file

@ -1,78 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js"),
fetch = require("node-fetch");
class Memes extends Command {
constructor(client) {
super(client, {
name: "memes",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["mem"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const tag = args[0];
const subs = ["memes", "dankmemes", "me_irl", "wholesomememes"];
if (tag === "list") {
const embed = new Discord.MessageEmbed()
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
})
.setTitle(message.translate("fun/memes:EMBED_TITLE"))
.setDescription(subs.join("\n"))
.setTimestamp();
message.reply({
embeds: [embed]
});
} else if (!tag) {
const m = await message.sendT("fun/memes:SEARCHING_RANDOM");
const res = await fetch("https://meme-api.herokuapp.com/gimme/").then(response => response.json());
const embed = new Discord.MessageEmbed()
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
})
.setTitle(`${res.title}\n${message.translate("fun/memes:SUBREDDIT")}: ${res.subreddit}\n${message.translate("common:AUTHOR")}: ${res.author}\n${message.translate("fun/memes:UPS")}: ${res.ups}`)
.setImage(res.url)
.setTimestamp();
m.edit({
content: null,
embeds: [embed]
});
} else if (subs.includes(tag)) {
const m = await message.sendT("fun/memes:SEARCHING", {
tag
});
const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json());
const embed = new Discord.MessageEmbed()
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
})
.setTitle(`${res.title}\n${message.translate("fun/memes:SUBREDDIT")}: ${res.subreddit}\n${message.translate("common:AUTHOR")}: ${res.author}\n${message.translate("fun/memes:UPS")}: ${res.ups}`)
.setImage(res.url)
.setTimestamp();
m.edit({
content: null,
embeds: [embed]
});
} else return message.error("fun/memes:NOT_FOUND");
}
}
module.exports = Memes;

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"); { PermissionsBitField } = require("discord.js");
class Activity extends Command { class Activity extends Command {
constructor(client) { constructor(client) {
@ -22,7 +22,7 @@ class Activity extends Command {
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
const perms = voice.permissionsFor(this.client.user); const perms = voice.permissionsFor(this.client.user);
if (!perms.has(Discord.Permissions.FLAGS.CONNECT) || !perms.has(Discord.Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT"); if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return message.error("music/play:VOICE_CHANNEL_CONNECT");
const activities = [ const activities = [
"betrayal", "betrayal",
@ -43,7 +43,7 @@ class Activity extends Command {
switch (activity) { switch (activity) {
case "betrayal": case "betrayal":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "betrayal").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "betrayal").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Betrayal.io") .setTitle("Betrayal.io")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Betrayal.io", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Betrayal.io", channel: voice.name })}](${invite.code})**`)
@ -61,7 +61,7 @@ class Activity extends Command {
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST"); if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "checkers").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "checkers").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Checkers In The Park") .setTitle("Checkers In The Park")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Checkers In The Park", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Checkers In The Park", channel: voice.name })}](${invite.code})**`)
@ -79,7 +79,7 @@ class Activity extends Command {
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST"); if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "chess").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "chess").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Chess In The Park") .setTitle("Chess In The Park")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Chess In The Park", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Chess In The Park", channel: voice.name })}](${invite.code})**`)
@ -95,7 +95,7 @@ class Activity extends Command {
case "sketchheads": case "sketchheads":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "sketchheads").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "sketchheads").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Sketch Heads") .setTitle("Sketch Heads")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Sketch Heads", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Sketch Heads", channel: voice.name })}](${invite.code})**`)
@ -113,7 +113,7 @@ class Activity extends Command {
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST"); if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "ocho").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "ocho").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Ocho") .setTitle("Ocho")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Ocho", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Ocho", channel: voice.name })}](${invite.code})**`)
@ -129,7 +129,7 @@ class Activity extends Command {
case "fishing": case "fishing":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "fishing").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "fishing").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Fishington.io") .setTitle("Fishington.io")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Fishington.io", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Fishington.io", channel: voice.name })}](${invite.code})**`)
@ -145,7 +145,7 @@ class Activity extends Command {
case "lettertile": case "lettertile":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "lettertile").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "lettertile").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Letter Tile") .setTitle("Letter Tile")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Letter Tile", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Letter Tile", channel: voice.name })}](${invite.code})**`)
@ -163,7 +163,7 @@ class Activity extends Command {
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST"); if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "poker").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "poker").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Poker Night") .setTitle("Poker Night")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Poker Night", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Poker Night", channel: voice.name })}](${invite.code})**`)
@ -181,7 +181,7 @@ class Activity extends Command {
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST"); if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "spellcast").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "spellcast").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Spell Cast") .setTitle("Spell Cast")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Spell Cast", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Spell Cast", channel: voice.name })}](${invite.code})**`)
@ -197,7 +197,7 @@ class Activity extends Command {
case "wordsnack": case "wordsnack":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "wordsnack").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "wordsnack").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Words Snack") .setTitle("Words Snack")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Words Snack", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Words Snack", channel: voice.name })}](${invite.code})**`)
@ -213,7 +213,7 @@ class Activity extends Command {
case "puttparty": case "puttparty":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "puttparty").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "puttparty").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Puttparty") .setTitle("Puttparty")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Puttparty", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Puttparty", channel: voice.name })}](${invite.code})**`)
@ -229,7 +229,7 @@ class Activity extends Command {
case "youtube": case "youtube":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "youtube").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "youtube").then(async invite => {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle("Youtube Together") .setTitle("Youtube Together")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Youtube Together", channel: voice.name })}](${invite.code})**`) .setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Youtube Together", channel: voice.name })}](${invite.code})**`)
@ -244,7 +244,7 @@ class Activity extends Command {
break; break;
default: { default: {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle(message.translate("general/activity:TITLE")) .setTitle(message.translate("general/activity:TITLE"))
.setDescription(activities.join("\n")) .setDescription(activities.join("\n"))
.setColor(data.config.embed.color) .setColor(data.config.embed.color)

View file

@ -20,7 +20,6 @@ class Avatar extends Command {
let user = await this.client.resolveUser(args[0]); let user = await this.client.resolveUser(args[0]);
if (!user) user = message.author; if (!user) user = message.author;
const avatarURL = user.displayAvatarURL({ const avatarURL = user.displayAvatarURL({
dynamic: true,
size: 512 size: 512
}); });

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"); { EmbedBuilder, parseEmoji } = require("discord.js");
class EmojiInfo extends Command { class EmojiInfo extends Command {
constructor(client) { constructor(client) {
@ -21,9 +21,9 @@ class EmojiInfo extends Command {
const rawEmoji = args[0]; const rawEmoji = args[0];
if (!rawEmoji) return message.error("administration/stealemoji:MISSING_EMOJI"); if (!rawEmoji) return message.error("administration/stealemoji:MISSING_EMOJI");
const parsedEmoji = Discord.Util.parseEmoji(rawEmoji); const parsedEmoji = parseEmoji(rawEmoji);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("general/emoji:TITLE", { name: message.translate("general/emoji:TITLE", {
emoji: parsedEmoji.name emoji: parsedEmoji.name
@ -33,9 +33,20 @@ class EmojiInfo extends Command {
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer
}) })
.addField(message.translate("general/emoji:NAME"), parsedEmoji.name) .addFields([
.addField(message.translate("general/emoji:ANIMATED"), parsedEmoji.animated ? message.translate("common:YES") : message.translate("common:NO")) {
.addField(message.translate("general/emoji:ID"), parsedEmoji.id ? parsedEmoji.id.toString() : message.translate("general/emoji:STANDART")); name: message.translate("general/emoji:NAME"),
value: parsedEmoji.name
},
{
name: message.translate("general/emoji:ANIMATED"),
value: parsedEmoji.animated ? message.translate("common:YES") : message.translate("common:NO")
},
{
name: message.translate("general/emoji:ID"),
value: parsedEmoji.id ? parsedEmoji.id.toString() : message.translate("general/emoji:STANDART")
}
]);
message.reply({ message.reply({
embeds: [embed] embeds: [embed]

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"); { PermissionsBitField, EmbedBuilder } = require("discord.js");
class Help extends Command { class Help extends Command {
constructor(client) { constructor(client) {
@ -40,17 +40,34 @@ class Help extends Command {
prefix: message.guild ? data.guild.prefix : "" prefix: message.guild ? data.guild.prefix : ""
}); });
const groupEmbed = new Discord.MessageEmbed() const groupEmbed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("general/help:CMD_TITLE", { name: message.translate("general/help:CMD_TITLE", {
cmd: cmd.help.name cmd: cmd.help.name
}) })
}) })
.addField(message.translate("general/help:FIELD_DESCRIPTION"), description) .addFields([
.addField(message.translate("general/help:FIELD_USAGE"), usage) {
.addField(message.translate("general/help:FIELD_EXAMPLES"), examples) name: message.translate("general/help:FIELD_DESCRIPTION"),
.addField(message.translate("general/help:FIELD_ALIASES"), cmd.help.aliases.length > 0 ? cmd.help.aliases.map(a => "`" + a + "`").join("\n") : message.translate("general/help:NO_ALIAS")) value: description
.addField(message.translate("general/help:FIELD_PERMISSIONS"), cmd.conf.memberPermissions.length > 0 ? cmd.conf.memberPermissions.map((p) => `\`${p}\``).join("\n") : message.translate("general/help:NO_REQUIRED_PERMISSION")) },
{
name: message.translate("general/help:FIELD_USAGE"),
value: usage
},
{
name: message.translate("general/help:FIELD_EXAMPLES"),
value: examples
},
{
name: message.translate("general/help:FIELD_ALIASES"),
value: cmd.help.aliases.length > 0 ? cmd.help.aliases.map(a => "`" + a + "`").join("\n") : message.translate("general/help:NO_ALIAS")
},
{
name: message.translate("general/help:FIELD_PERMISSIONS"),
value: cmd.conf.memberPermissions.length > 0 ? cmd.conf.memberPermissions.map((p) => `\`${p}\``).join("\n") : message.translate("general/help:NO_REQUIRED_PERMISSION")
}
])
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer
@ -73,7 +90,7 @@ class Help extends Command {
const emojis = this.client.customEmojis; const emojis = this.client.customEmojis;
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setDescription(message.translate("general/help:INFO", { .setDescription(message.translate("general/help:INFO", {
prefix: message.guild ? data.guild.prefix : "" prefix: message.guild ? data.guild.prefix : ""
})) }))
@ -83,27 +100,32 @@ class Help extends Command {
}); });
categories.sort().forEach((cat) => { categories.sort().forEach((cat) => {
const tCommands = commands.filter((cmd) => cmd.help.category === cat); const tCommands = commands.filter((cmd) => cmd.help.category === cat);
embed.addField(`${emojis.categories[cat.toLowerCase()]} ${cat} - (${tCommands.size})`, `${tCommands.map((cmd) => `\`${cmd.help.name}\``).join(", ")}`); embed.addFields([
{
name: `${emojis.categories[cat.toLowerCase()]} ${cat} - (${tCommands.size})`,
value: `${tCommands.map((cmd) => `\`${cmd.help.name}\``).join(", ")}`
}
]);
}); });
if (message.guild) { embed.addFields([
if (data.guild.customCommands.length > 0) embed.addField(`${emojis.categories.custom} ${message.guild.name} | ${message.translate("general/help:CUSTOM_COMMANDS")} - (${data.guild.customCommands.length})`, data.guild.customCommands.map((cmd) => `\`${cmd.name}\``).join(", ")); {
} name: "\u200B",
value: message.translate("misc:STATS_FOOTER", {
embed.addField("\u200B", message.translate("misc:STATS_FOOTER", {
dashboardLink: this.client.config.dashboard.baseURL, dashboardLink: this.client.config.dashboard.baseURL,
docsLink: `${this.client.config.dashboard.baseURL}/docs/`, docsLink: `${this.client.config.dashboard.baseURL}/docs/`,
inviteLink: this.client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR] }), inviteLink: this.client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator] }),
donateLink: "https://qiwi.com/n/JONNYBRO/", donateLink: "https://qiwi.com/n/JONNYBRO/",
owner: data.config.owner.id owner: data.config.owner.id
})); })
}
]);
embed.setAuthor({ embed.setAuthor({
name: message.translate("general/help:TITLE", { name: message.translate("general/help:TITLE", {
name: this.client.user.username name: this.client.user.username
}), }),
iconURL: this.client.user.displayAvatarURL({ iconURL: this.client.user.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}); });

View file

@ -1,55 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Invite extends Command {
constructor(client) {
super(client, {
name: "invite",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["i"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const inviteLink = this.client.generateInvite({
scopes: ["bot", "applications.commands"],
permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR]
});
const donateLink = "https://qiwi.com/n/JONNYBRO/";
if (args[0] && args[0] === "copy") return message.reply({
content: inviteLink
});
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("general/invite:LINKS")
})
.setDescription(message.translate("general/invite:TIP", {
prefix: data.guild.prefix || ""
}))
.addField(message.translate("general/invite:ADD"), message.translate("general/invite:CLICK", {
link: inviteLink
}))
.addField(message.translate("general/invite:SUPPORT"), message.translate("general/invite:CLICK", {
link: donateLink
}) + `\n*для других способов пишите в ЛС <@${data.config.owner.id}> (указывайте ваш Discord тэг чтобы я мог выдать вам ачивку)*`)
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
message.reply({
embeds: [embed]
});
}
}
module.exports = Invite;

View file

@ -1,72 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Invites extends Command {
constructor(client) {
super(client, {
name: "invites",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["invs"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_GUILD"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
let member = await this.client.resolveMember(args[0], message.guild);
if (!member) member = message.member;
const invites = await message.guild.invites.fetch().catch(() => {});
if (!invites) return message.error("misc:ERR_OCCURRED");
const memberInvites = invites.filter((i) => i.inviter && i.inviter.id === member.user.id);
if (memberInvites.size <= 0) {
if (member === message.member) {
return message.error("general/invites:NOBODY_AUTHOR");
} else {
return message.error("general/invites:NOBODY_MEMBER", {
member: member.user.tag
});
}
}
const content = memberInvites.map((i) => {
return message.translate("general/invites:CODE", {
uses: i.uses,
code: i.code,
channel: i.channel.toString()
});
}).join("\n");
let index = 0;
memberInvites.forEach((invite) => index += invite.uses);
const embed = new Discord.MessageEmbed()
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
})
.setAuthor({
name: message.translate("general/invites:TRACKER")
})
.setDescription(message.translate("general/invites:TITLE", {
member: member.user.tag,
guild: message.guild.name
}))
.addField(message.translate("general/invites:FIELD_INVITED"), message.translate("general/invites:FIELD_MEMBERS", {
total: index
}))
.addField(message.translate("general/invites:FIELD_CODES"), content);
message.reply({
embeds: [embed]
});
}
}
module.exports = Invites;

View file

@ -60,15 +60,35 @@ class Minecraft extends Command {
if (!json) return m.error("general/minecraft:FAILED", null, { edit: true }); if (!json) return m.error("general/minecraft:FAILED", null, { edit: true });
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: json.name name: json.name
}) })
.addField(message.translate("general/minecraft:FIELD_STATUS"), message.translate("general/minecraft:ONLINE")) .addFields([
.addField(message.translate("general/minecraft:FIELD_CONNECTED"), `**${(json.raw.players ? json.raw.players.online : json.players.length)}** ${message.getNoun((json.raw.players ? json.raw.players.online : json.players.length), message.translate("misc:NOUNS:PLAYERS:1"), message.translate("misc:NOUNS:PLAYERS:2"), message.translate("misc:NOUNS:PLAYERS:5"))} / **${(json.raw.players ? json.raw.players.max : json.maxplayers)}** ${message.getNoun((json.raw.players ? json.raw.players.max : json.maxplayers), message.translate("misc:NOUNS:PLAYERS:1"), message.translate("misc:NOUNS:PLAYERS:2"), message.translate("misc:NOUNS:PLAYERS:5"))}`) {
.addField(message.translate("general/minecraft:FIELD_IP"), json.connect, true) name: message.translate("general/minecraft:FIELD_STATUS"),
.addField(message.translate("general/minecraft:FIELD_VERSION"), json.raw.vanilla.raw.version.name, true) value: message.translate("general/minecraft:ONLINE")
.addField(message.translate("general/minecraft:FIELD_PING"), json.raw.vanilla.ping.toString()) },
{
name: message.translate("general/minecraft:FIELD_CONNECTED"),
value: `**${(json.raw.players ? json.raw.players.online : json.players.length)}** ${message.getNoun((json.raw.players ? json.raw.players.online : json.players.length), message.translate("misc:NOUNS:PLAYERS:1"), message.translate("misc:NOUNS:PLAYERS:2"), message.translate("misc:NOUNS:PLAYERS:5"))} / **${(json.raw.players ? json.raw.players.max : json.maxplayers)}** ${message.getNoun((json.raw.players ? json.raw.players.max : json.maxplayers), message.translate("misc:NOUNS:PLAYERS:1"), message.translate("misc:NOUNS:PLAYERS:2"), message.translate("misc:NOUNS:PLAYERS:5"))}`
},
{
name: message.translate("general/minecraft:FIELD_IP"),
value: json.connect,
inline: true
},
{
name: message.translate("general/minecraft:FIELD_VERSION"),
value: json.raw.vanilla.raw.version.name,
inline: true
},
{
name: message.translate("general/minecraft:FIELD_PING"),
value: json.raw.vanilla.ping.toString()
}
])
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setThumbnail(favicon) .setThumbnail(favicon)
.setFooter({ .setFooter({

View file

@ -1,50 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
const permissions = Object.keys(Discord.Permissions.FLAGS);
class Permissions extends Command {
constructor(client) {
super(client, {
name: "permissions",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["perms"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message) {
const member = message.mentions.members.first() || message.member;
const mPermissions = message.channel.permissionsFor(member);
const total = {
denied: 0,
allowed: 0
};
let text = `**${message.translate("general/permissions:TITLE", { user: member.user.username, channel: message.channel.name })}**\n`;
permissions.forEach((perm) => {
if (perm === "REQUEST_TO_SPEAK") return;
if (!mPermissions.has(perm)) {
text += `${message.translate(`misc:PERMISSIONS:${perm}`)}\n`;
total.denied++;
} else {
text += `${message.translate(`misc:PERMISSIONS:${perm}`)}\n`;
total.allowed++;
}
});
text += `\n${total.allowed} ✅ | ${total.denied}`;
message.reply({
content: text
});
}
}
module.exports = Permissions;

View file

@ -1,88 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Quote extends Command {
constructor(client) {
super(client, {
name: "quote",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["qu"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
function embed(m) {
const embed = new Discord.MessageEmbed()
.setAuthor({
name: m.author.tag,
iconURL: m.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
.setDescription(m.content)
.setColor(m.member ? m.member.roles.highest ? m.member.roles.highest.color : data.config.embed.color : data.config.embed.color)
.setFooter({
text: m.guild.name + " | #" + m.channel.name
})
.setTimestamp(m.createdTimestamp);
if (m.attachments.size > 0) embed.setImage(m.attachments.first().url);
return embed;
}
const msgID = args[0];
if (isNaN(msgID)) {
message.error("general/quote:MISSING_ID").then(() => {
if (message.deletable) message.delete();
});
return;
}
let channel = args[1];
if (args[1]) {
channel = this.client.channels.cache.get(args[1]);
if (!channel) {
message.error("general/quote:NO_MESSAGE_ID").then(() => {
if (message.deletable) message.delete();
});
return;
}
}
if (!channel) {
message.channel.messages.fetch(msgID).catch(() => {
message.error("general/quote:NO_MESSAGE_ID").then(() => {
if (message.deletable) message.delete();
});
return;
}).then((msg) => {
if (message.deletable) message.delete();
message.reply({
embeds: [embed(msg)]
});
});
} else {
channel.messages.fetch(msgID).then((msg) => {
if (message.deletable) message.delete();
message.reply({
embeds: [embed(msg)]
});
}).catch(() => {
message.error("general/quote:NO_MESSAGE_ID").then(() => {
if (message.deletable) message.delete();
});
return;
});
}
}
}
module.exports = Quote;

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"); { EmbedBuilder, parseEmoji} = require("discord.js");
class Report extends Command { class Report extends Command {
constructor(client) { constructor(client) {
@ -30,28 +30,45 @@ class Report extends Command {
const rep = args.slice(1).join(" "); const rep = args.slice(1).join(" ");
if (!rep) return message.error("general/report:MISSING_REASON"); if (!rep) return message.error("general/report:MISSING_REASON");
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("general/report:TITLE", { name: message.translate("general/report:TITLE", {
user: member.user.tag user: member.user.tag
}), }),
iconURL: message.author.displayAvatarURL({ iconURL: message.author.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })
.addField(message.translate("common:AUTHOR"), message.author.tag, true) .addFields([
.addField(message.translate("common:DATE"), this.client.printDate(new Date(Date.now())), true) {
.addField(message.translate("common:REASON"), rep, true) name: message.translate("common:AUTHOR"),
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) value: message.author.tag,
inline: true
},
{
name: message.translate("common:DATE"),
value: this.client.printDate(new Date(Date.now())),
inline: true
},
{
name: message.translate("common:REASON"),
value: rep,
inline: true
},
{
name: message.translate("common:USER"),
value: `\`${member.user.tag}\` (${member.user.toString()})`,
inline: true
}
])
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer
}); });
const success = Discord.Util.parseEmoji(this.client.customEmojis.success).id; const success = parseEmoji(this.client.customEmojis.cool).id;
const error = Discord.Util.parseEmoji(this.client.customEmojis.error).id; const error = parseEmoji(this.client.customEmojis.notcool).id;
repChannel.send({ repChannel.send({
embeds: [embed] embeds: [embed]

View file

@ -31,32 +31,62 @@ class Serverinfo extends Command {
await guild.members.fetch(); await guild.members.fetch();
const owner = await guild.fetchOwner(); const owner = await guild.fetchOwner();
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: guild.name, name: guild.name,
iconURL: guild.iconURL({ iconURL: guild.iconURL()
dynamic: true
}) })
}) .setThumbnail(guild.iconURL())
.setThumbnail(guild.iconURL({ .addFields([
dynamic: true {
})) name: this.client.customEmojis.link + " " + message.translate("general/serverinfo:LINK"),
.addField(this.client.customEmojis.link + " " + message.translate("general/serverinfo:LINK"), `[${message.translate("general/serverinfo:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/stats/${guild.id})`) value: `[${message.translate("general/serverinfo:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/stats/${guild.id})`
.addField(this.client.customEmojis.title + message.translate("common:NAME"), guild.name, true) },
.addField(this.client.customEmojis.calendar + message.translate("common:CREATION"), this.client.printDate(guild.createdAt), true) {
.addField(this.client.customEmojis.users + message.translate("common:MEMBERS"), name: this.client.customEmojis.title + message.translate("common:NAME"),
`${guild.members.cache.filter(m => !m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => !m.user.bot).size, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}` + value: guild.name,
"\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => m.user.bot).size, message.translate("misc:NOUNS:BOTS:1"), message.translate("misc:NOUNS:BOTS:2"), message.translate("misc:NOUNS:BOTS:5"))}`, true inline: true
) },
.addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel ? guild.afkChannel.toString() : message.translate("general/serverinfo:NO_AFK_CHANNEL"), true) {
.addField(this.client.customEmojis.id + message.translate("common:ID"), guild.id, true) name: this.client.customEmojis.calendar + message.translate("common:CREATION"),
.addField(this.client.customEmojis.crown + message.translate("common:OWNER"), owner.toString(), true) value: this.client.printDate(guild.createdAt),
.addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount.toString() || "0", true) inline: true
.addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"), },
`${guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size, message.translate("misc:NOUNS:TEXT:1"), message.translate("misc:NOUNS:TEXT:2"), message.translate("misc:NOUNS:TEXT:5"))}` + {
name: this.client.customEmojis.users + message.translate("common:MEMBERS"),
value: `${guild.members.cache.filter(m => !m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => !m.user.bot).size, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}` +
"\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => m.user.bot).size, message.translate("misc:NOUNS:BOTS:1"), message.translate("misc:NOUNS:BOTS:2"), message.translate("misc:NOUNS:BOTS:5"))}`,
inline: true
},
{
name: this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"),
value: guild.afkChannel ? guild.afkChannel.toString() : message.translate("general/serverinfo:NO_AFK_CHANNEL"),
inline: true
},
{
name: this.client.customEmojis.id + message.translate("common:ID"),
value: guild.id,
inline: true
},
{
name: this.client.customEmojis.crown + message.translate("common:OWNER"),
value: owner.toString(),
inline: true
},
{
name: this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"),
value: guild.premiumSubscriptionCount.toString() || "0",
inline: true
},
{
name: this.client.customEmojis.channels + message.translate("common:CHANNELS"),
value: `${guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size, message.translate("misc:NOUNS:TEXT:1"), message.translate("misc:NOUNS:TEXT:2"), message.translate("misc:NOUNS:TEXT:5"))}` +
"\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size, message.translate("misc:NOUNS:VOICE:1"), message.translate("misc:NOUNS:VOICE:2"), message.translate("misc:NOUNS:VOICE:5"))}` + "\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size, message.translate("misc:NOUNS:VOICE:1"), message.translate("misc:NOUNS:VOICE:2"), message.translate("misc:NOUNS:VOICE:5"))}` +
"\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size, message.translate("misc:NOUNS:CATEGORY:1"), message.translate("misc:NOUNS:CATEGORY:2"), message.translate("misc:NOUNS:CATEGORY:5"))}`, true "\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size, message.translate("misc:NOUNS:CATEGORY:1"), message.translate("misc:NOUNS:CATEGORY:2"), message.translate("misc:NOUNS:CATEGORY:5"))}`,
) inline: true
}
])
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer

View file

@ -27,7 +27,7 @@ class ShortURL extends Command {
if (body === "Error: Please enter a valid URL to shorten") return message.error("general/shorturl:MISSING_URL"); if (body === "Error: Please enter a valid URL to shorten") return message.error("general/shorturl:MISSING_URL");
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"); { PermissionsBitField, EmbedBuilder } = require("discord.js");
class Staff extends Command { class Staff extends Command {
constructor(client) { constructor(client) {
@ -19,16 +19,24 @@ class Staff extends Command {
async run(message, args, data) { async run(message, args, data) {
await message.guild.members.fetch(); await message.guild.members.fetch();
const administrators = message.guild.members.cache.filter((m) => m.permissions.has(Discord.Permissions.FLAGS.ADMINISTRATOR) && !m.user.bot); const administrators = message.guild.members.cache.filter((m) => m.permissions.has(PermissionsBitField.Flags.Administrator) && !m.user.bot);
const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.permissions.has(Discord.Permissions.FLAGS.MANAGE_MESSAGES) && !m.user.bot); const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.permissions.has(PermissionsBitField.Flags.ManageMessages) && !m.user.bot);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("general/staff:TITLE", { name: message.translate("general/staff:TITLE", {
guild: message.guild.name guild: message.guild.name
}) })
}) })
.addField(message.translate("general/staff:ADMINS"), (administrators.size > 0 ? administrators.map((a) => `${a.presence ? this.client.customEmojis.status[a.presence.status] : this.client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : message.translate("general/staff:NO_ADMINS"))) .addFields([
.addField(message.translate("general/staff:MODS"), (moderators.size > 0 ? moderators.map((m) => `${m.presence ? this.client.customEmojis.status[m.presence.status] : this.client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : message.translate("general/staff:NO_MODS"))) {
name: message.translate("general/staff:ADMINS"),
value: (administrators.size > 0 ? administrators.map((a) => `${a.presence ? this.client.customEmojis.status[a.presence.status] : this.client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : message.translate("general/staff:NO_ADMINS"))
},
{
name: message.translate("general/staff:MODS"),
value: (moderators.size > 0 ? moderators.map((m) => `${m.presence ? this.client.customEmojis.status[m.presence.status] : this.client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : message.translate("general/staff:NO_MODS"))
}
])
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"); { PermissionsBitField, EmbedBuilder, version } = require("discord.js");
class Stats extends Command { class Stats extends Command {
constructor(client) { constructor(client) {
@ -22,7 +22,7 @@ class Stats extends Command {
const users = this.client.users.cache.size - hiddenGuild.memberCount; const users = this.client.users.cache.size - hiddenGuild.memberCount;
const servers = this.client.guilds.cache.size - 1; const servers = this.client.guilds.cache.size - 1;
const statsEmbed = new Discord.MessageEmbed() const statsEmbed = new EmbedBuilder()
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer
@ -31,29 +31,56 @@ class Stats extends Command {
name: message.translate("common:STATS") name: message.translate("common:STATS")
}) })
.setDescription(message.translate("general/stats:MADE")) .setDescription(message.translate("general/stats:MADE"))
.addField(this.client.customEmojis.stats + " " + message.translate("general/stats:COUNTS_TITLE"), message.translate("general/stats:COUNTS_CONTENT", { .addFields([
{
name: this.client.customEmojis.stats + " " + message.translate("general/stats:COUNTS_TITLE"),
value: message.translate("general/stats:COUNTS_CONTENT", {
servers: servers, servers: servers,
users: users users: users
}), true) }),
.addField(this.client.customEmojis.version + " " + message.translate("general/stats:VERSIONS_TITLE"), `\`Discord.js : v${Discord.version}\`\n\`Nodejs : v${process.versions.node}\``, true) inline: true
.addField(this.client.customEmojis.ram + " " + message.translate("general/stats:RAM_TITLE"), `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``, true) },
.addField(this.client.customEmojis.status.online + " " + message.translate("general/stats:ONLINE_TITLE"), message.translate("general/stats:ONLINE_CONTENT", { {
time: this.client.convertTime(Date.now() + this.client.uptime, "from", true) name: this.client.customEmojis.version + " " + message.translate("general/stats:VERSIONS_TITLE"),
})) value: `\`Discord.js: v${version}\`\n\`Nodejs: v${process.versions.node}\``,
.addField(this.client.customEmojis.voice + " " + message.translate("general/stats:MUSIC_TITLE"), message.translate("general/stats:MUSIC_CONTENT", { inline: true
},
{
name: this.client.customEmojis.ram + " " + message.translate("general/stats:RAM_TITLE"),
value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``,
inline: true
},
{
name: this.client.customEmojis.status.online + " " + message.translate("general/stats:ONLINE_TITLE"),
value: message.translate("general/stats:ONLINE_CONTENT", {
time: this.client.convertTime(Date.now() + this.client.uptime, true, true)
})
},
{
name: this.client.customEmojis.voice + " " + message.translate("general/stats:MUSIC_TITLE"),
value: message.translate("general/stats:MUSIC_CONTENT", {
count: `${this.client.player.voices.collection.size} ${message.getNoun(this.client.player.voices.collection.size, message.translate("misc:NOUNS:SERVERS:1"), message.translate("misc:NOUNS:SERVERS:2"), message.translate("misc:NOUNS:SERVERS:5"))}` count: `${this.client.player.voices.collection.size} ${message.getNoun(this.client.player.voices.collection.size, message.translate("misc:NOUNS:SERVERS:1"), message.translate("misc:NOUNS:SERVERS:2"), message.translate("misc:NOUNS:SERVERS:5"))}`
})) })
.addField(message.translate("general/stats:CREDITS_TITLE"), message.translate("general/stats:CREDITS_CONTENT", { },
{
name: message.translate("general/stats:CREDITS_TITLE"),
value: message.translate("general/stats:CREDITS_CONTENT", {
donators: ["**`Добрый Спецназ#8801`** - Тестер, генератор идей"].join("\n"), donators: ["**`Добрый Спецназ#8801`** - Тестер, генератор идей"].join("\n"),
translators: ["**`Jonny_Bro#4226`** - :flag_ru:", "**`[ДАННЫЕ УДАЛЕНЫ]#4507`** - :flag_ua:"].join("\n") translators: ["**`Jonny_Bro#4226`** - :flag_ru:", "**`[ДАННЫЕ УДАЛЕНЫ]#4507`** - :flag_ua: (НЕ ОБНОВЛЕН!)"].join("\n")
})) })
.addField(this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", { },
{
name: this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"),
value: message.translate("misc:STATS_FOOTER", {
dashboardLink: this.client.config.dashboard.baseURL, dashboardLink: this.client.config.dashboard.baseURL,
docsLink: `${this.client.config.dashboard.baseURL}/docs/`, docsLink: `${this.client.config.dashboard.baseURL}/docs/`,
inviteLink: this.client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR] }), inviteLink: this.client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] }),
donateLink: "https://qiwi.com/n/JONNYBRO/", donateLink: "https://qiwi.com/n/JONNYBRO/",
owner: data.config.owner.id owner: data.config.owner.id
})); })
}
]);
message.reply({ message.reply({
embeds: [statsEmbed] embeds: [statsEmbed]
}); });

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"); { EmbedBuilder, parseEmoji } = require("discord.js");
class Suggest extends Command { class Suggest extends Command {
constructor(client) { constructor(client) {
@ -26,27 +26,39 @@ class Suggest extends Command {
const sugg = args.join(" "); const sugg = args.join(" ");
if (!sugg) return message.error("general/suggest:MISSING_CONTENT"); if (!sugg) return message.error("general/suggest:MISSING_CONTENT");
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("general/suggest:TITLE", { name: message.translate("general/suggest:TITLE", {
user: message.author.username user: message.author.username
}), }),
iconURL: message.author.displayAvatarURL({ iconURL: message.author.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })
.addField(message.translate("common:AUTHOR"), `\`${message.author.username}#${message.author.discriminator}\``, true) .addFields([
.addField(message.translate("common:DATE"), this.client.printDate(new Date(Date.now())), true) {
.addField(message.translate("common:CONTENT"), sugg) name: message.translate("common:AUTHOR"),
value: `\`${message.author.username}#${message.author.discriminator}\``,
inline: true
},
{
name: message.translate("common:DATE"),
value: this.client.printDate(new Date(Date.now())),
inline: true
},
{
name: message.translate("common:CONTENT"),
value: sugg
}
])
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer
}); });
const success = Discord.Util.parseEmoji(this.client.customEmojis.cool).id; const success = parseEmoji(this.client.customEmojis.cool).id;
const error = Discord.Util.parseEmoji(this.client.customEmojis.notcool).id; const error = parseEmoji(this.client.customEmojis.notcool).id;
suggChannel.send({ suggChannel.send({
embeds: [embed] embeds: [embed]

View file

@ -1,72 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js"),
translate = require("@k3rn31p4nic/google-translate-api");
const langs = ["afrikaans", "albanian", "amharic", "arabic", "armenian", "azerbaijani", "bangla", "basque", "belarusian", "bengali", "bosnian", "bulgarian", "burmese", "catalan", "cebuano", "chichewa", "corsican", "croatian", "czech", "danish", "dutch", "english", "esperanto", "estonian", "filipino", "finnish", "french", "frisian", "galician", "georgian", "german", "greek", "gujarati", "haitian creole", "hausa", "hawaiian", "hebrew", "hindi", "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian", "japanese", "javanese", "kannada", "kazakh", "khmer", "korean", "kurdish (kurmanji)", "kyrgyz", "lao", "latin", "latvian", "lithuanian", "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese", "maori", "marathi", "mongolian", "myanmar (burmese)", "nepali", "norwegian", "nyanja", "pashto", "persian", "polish", "portugese", "punjabi", "romanian", "russian", "samoan", "scottish gaelic", "serbian", "sesotho", "shona", "sindhi", "sinhala", "slovak", "slovenian", "somali", "spanish", "sundanese", "swahili", "swedish", "tajik", "tamil", "telugu", "thai", "turkish", "ukrainian", "urdu", "uzbek", "vietnamese", "welsh", "xhosa", "yiddish", "yoruba", "zulu"];
class Translate extends Command {
constructor(client) {
super(client, {
name: "translate",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["tran"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args, data) {
if (args[0] === "langs-list") {
const langsList = "```css\n" + (langs.map((lang, i) => `${i + 1} - ${lang}`).join("\n")) + "```";
message.author.send(langsList).then(() => {
message.success("general/translate:LIST_SENT");
}).catch(() => {
message.error("misc:CANNOT_DM");
});
return;
}
const pWait = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
if (!args[0]) return pWait.error("general/translate:MISSING_LANGUAGE", { prefix: data.guild.prefix }, { edit: true });
if (!args[1]) return pWait.error("general/translate:MISSING_CONTENT", null, { edit: true });
// Gets different args
const language = args[0].toLowerCase();
const toTranslate = args.slice(1).join(" ");
if (!langs.includes(language)) return pWait.error("general/translate:INVALID_LANGUAGE", { prefix: data.guild.prefix, search: language }, { edit: true });
const translated = await translate(toTranslate, { to: language });
const resEmbed = new Discord.MessageEmbed()
.setAuthor({
name: "Переводчик",
iconURL: this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
.addField(translated.from.language.iso, "```" + toTranslate + "```")
.addField(language, "```" + translated.text + "```")
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
return pWait.edit({
content: null,
embeds: [resEmbed]
});
}
}
module.exports = Translate;

View file

@ -39,27 +39,44 @@ class Userinfo extends Command {
let member = null; let member = null;
if (message.guild) member = await message.guild.members.fetch(user).catch(() => {}); if (message.guild) member = await message.guild.members.fetch(user).catch(() => {});
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: `${user.tag} (${user.id})`, name: `${user.tag} (${user.id})`,
iconURL: user.displayAvatarURL({ iconURL: user.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })
.setThumbnail(user.displayAvatarURL({ .setThumbnail(user.displayAvatarURL())
dynamic: true .addFields([
})) {
.addField(":man: " + message.translate("common:USERNAME"), user.username, true) name: ":man: " + message.translate("common:USERNAME"),
.addField(this.client.customEmojis.discriminator + " " + message.translate("common:DISCRIMINATOR"), user.discriminator, true) value: member.nickname || user.username,
.addField(this.client.customEmojis.bot + " " + message.translate("common:ROBOT"), (user.bot ? message.translate("common:YES") : message.translate("common:NO")), true) inline: true
.addField(this.client.customEmojis.calendar + " " + message.translate("common:CREATION"), this.client.printDate(user.createdAt), true) },
.addField(this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"), user.displayAvatarURL({ {
name: this.client.customEmojis.discriminator + " " + message.translate("common:DISCRIMINATOR"),
value: user.discriminator,
inline: true
},
{
name: this.client.customEmojis.bot + " " + message.translate("common:ROBOT"),
value: (user.bot ? message.translate("common:YES") : message.translate("common:NO")),
inlinee: true
},
{
name: this.client.customEmojis.calendar + " " + message.translate("common:CREATION"),
value: this.client.printDate(user.createdAt),
inline: true
},
{
name: this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"),
value: member.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
})) })
}
])
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer
@ -67,22 +84,58 @@ class Userinfo extends Command {
if (displayPresence) { if (displayPresence) {
if (member.presence.activities[0].name === "Custom Status") { if (member.presence.activities[0].name === "Custom Status") {
embed.addField(this.client.customEmojis.games + " " + message.translate("common:GAME"), (member.presence.activities[0] ? `Пользовательский статус\n${member.presence.activities[0].state || message.translate("common:NOT_DEFINED")}` : message.translate("general/userinfo:NO_GAME")), true); embed.addFields([
embed.addField(this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"), message.translate("common:STATUS_" + (member.presence.status.toUpperCase())), true); {
name: this.client.customEmojis.games + " " + message.translate("common:GAME"),
value: (member.presence.activities[0] ? `Пользовательский статус\n${member.presence.activities[0].state || message.translate("common:NOT_DEFINED")}` : message.translate("general/userinfo:NO_GAME")),
inline: true
},
{
name: this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"),
value: message.translate("common:STATUS_" + (member.presence.status.toUpperCase())),
inline: true
}
]);
} else { } else {
embed.addField(this.client.customEmojis.games + " " + message.translate("common:GAME"), (member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : message.translate("general/userinfo:NO_GAME")), true); embed.addFields([
embed.addField(this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"), message.translate("common:STATUS_" + (member.presence.status.toUpperCase())), true); {
name: this.client.customEmojis.games + " " + message.translate("common:GAME"),
value: (member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : message.translate("general/userinfo:NO_GAME")),
inline: true
},
{
name: this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"),
value: message.translate("common:STATUS_" + (member.presence.status.toUpperCase())),
inline: true
}
]);
} }
} }
if (member) { if (member) {
// embed.addField(this.client.customEmojis.up + " " + message.translate("general/userinfo:ROLE"), (member.roles.highest ? member.roles.highest : message.translate("general/userinfo:NO_ROLE")), true) embed.addFields([
embed.addField(this.client.customEmojis.calendar2 + " " + message.translate("common:JOIN"), this.client.printDate(member.joinedAt), true); {
embed.addField(this.client.customEmojis.color + " " + message.translate("common:COLOR"), member.displayHexColor, true); name: this.client.customEmojis.calendar2 + " " + message.translate("common:JOIN"),
embed.addField(this.client.customEmojis.pencil + " " + message.translate("common:NICKNAME"), (member.nickname ? member.nickname : message.translate("general/userinfo:NO_NICKNAME")), true); value: this.client.printDate(member.joinedAt),
embed.addField(this.client.customEmojis.roles + " " + message.translate("common:ROLES"), (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 9).join(", ") + " " + message.translate("general/userinfo:MORE_ROLES", { inline: true
},
{
name: this.client.customEmojis.color + " " + message.translate("common:COLOR"),
value: member.displayHexColor,
inline: true
},
{
name: this.client.customEmojis.pencil + " " + message.translate("common:NICKNAME"),
value: (member.nickname ? member.nickname : message.translate("general/userinfo:NO_NICKNAME")),
inline: true
},
{
name: this.client.customEmojis.roles + " " + message.translate("common:ROLES"),
value: (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 9).join(", ") + " " + message.translate("general/userinfo:MORE_ROLES", {
count: member.roles.cache.size - 10 count: member.roles.cache.size - 10
}) : (member.roles.cache.size < 1) ? message.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", "))); }) : (member.roles.cache.size < 1) ? message.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", "))
}
]);
} }
message.reply({ message.reply({

View file

@ -24,7 +24,7 @@ class Whois extends Command {
const whois = await fetch(`http://ip-api.com/json/${args[0]}?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,zip,timezone,currency,isp,org,as,mobile,proxy,hosting,query`).then(response => response.json()); const whois = await fetch(`http://ip-api.com/json/${args[0]}?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,zip,timezone,currency,isp,org,as,mobile,proxy,hosting,query`).then(response => response.json());
if (whois.status === "fail") { if (whois.status === "fail") {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setDescription(whois.message) .setDescription(whois.message)
.setTitle(message.translate("general/whois:ERROR", { .setTitle(message.translate("general/whois:ERROR", {
ip: args[0] ip: args[0]
@ -39,7 +39,7 @@ class Whois extends Command {
}); });
} }
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle(message.translate("general/whois:INFO_ABOUT", { .setTitle(message.translate("general/whois:INFO_ABOUT", {
ip: args[0] ip: args[0]
})) }))
@ -49,14 +49,14 @@ class Whois extends Command {
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.addFields( .addFields(
{ name: "IP", value: whois.query, inline: true }, { name: "IP", value: whois.query, inline: true },
{ name: message.translate("general/whois:COUNTRY"), value: `${whois.country || "Неизвестно"} (${whois.countryCode || "Неизвестно"})`, inline: true }, { name: message.translate("general/whois:COUNTRY"), value: `${whois.country || message.translate("common:UNKNOWN")} (${whois.countryCode || message.translate("common:UNKNOWN")})`, inline: true },
{ name: message.translate("general/whois:REGION"), value: `${whois.regionName || "Неизвестно"} (${whois.region || "Неизвестно"})`, inline: true }, { name: message.translate("general/whois:REGION"), value: `${whois.regionName || message.translate("common:UNKNOWN")} (${whois.region || message.translate("common:UNKNOWN")})`, inline: true },
{ name: message.translate("general/whois:CITY"), value: `${whois.city || "Неизвестно"}`, inline: true }, { name: message.translate("general/whois:CITY"), value: `${whois.city || message.translate("common:UNKNOWN")}`, inline: true },
{ name: message.translate("general/whois:ZIP"), value: `${whois.zip || "Неизвестно"}`, inline: true }, { name: message.translate("general/whois:ZIP"), value: `${whois.zip || message.translate("common:UNKNOWN")}`, inline: true },
{ name: message.translate("general/whois:TIMEZONE"), value: `${whois.timezone || "Неизвестно"}`, inline: true }, { name: message.translate("general/whois:TIMEZONE"), value: `${whois.timezone || message.translate("common:UNKNOWN")}`, inline: true },
{ name: message.translate("general/whois:CONTINENT"), value: `${whois.continent || "Неизвестно"} (${whois.continentCode || "Неизвестно"})`, inline: true }, { name: message.translate("general/whois:CONTINENT"), value: `${whois.continent || message.translate("common:UNKNOWN")} (${whois.continentCode || message.translate("common:UNKNOWN")})`, inline: true },
{ name: message.translate("general/whois:CURRENCY"), value: `${whois.currency || "Неизвестно"}`, inline: true }, { name: message.translate("general/whois:CURRENCY"), value: `${whois.currency || message.translate("common:UNKNOWN")}`, inline: true },
{ name: message.translate("general/whois:ISP"), value: `${whois.isp || "Неизвестно"}`, inline: true } { name: message.translate("general/whois:ISP"), value: `${whois.isp || message.translate("common:UNKNOWN")}`, inline: true }
) )
.setTimestamp(); .setTimestamp();

View file

@ -77,7 +77,7 @@ class Announcement extends Command {
collector.on("end", (collected, reason) => { collector.on("end", (collected, reason) => {
if (reason === "time") return message.error("misc:TIMES_UP"); if (reason === "time") return message.error("misc:TIMES_UP");
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("moderation/announcement:TITLE") name: message.translate("moderation/announcement:TITLE")
}) })

View file

@ -1,112 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Ban extends Command {
constructor(client) {
super(client, {
name: "ban",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["b"],
memberPermissions: ["BAN_MEMBERS"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const user = await this.client.resolveUser(args[0]);
if (!user) return message.error("moderation/ban:MISSING_MEMBER");
const memberData = message.guild.members.cache.get(user.id) ? await this.client.findOrCreateMember({
id: user.id,
guildID: message.guild.id
}) : null;
if (user.id === message.author.id) return message.error("moderation/ban:YOURSELF");
// If the user is already banned
const banned = await message.guild.bans.fetch();
if (banned.some((m) => m.user.id === user.id)) return message.error("moderation/ban:ALREADY_BANNED", {
username: user.tag
});
// Gets the ban reason
let reason = args.slice(1).join(" ");
if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED");
const member = await message.guild.members.fetch(user.id).catch(() => {});
if (member) {
const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (!member.bannable) return message.error("moderation/ban:MISSING_PERM");
}
await user.send(message.translate("moderation/ban:BANNED_DM", {
username: user.tag,
server: message.guild.name,
moderator: message.author.tag,
reason
})).catch(() => {});
// Ban the user
message.guild.members.ban(user, {
reason
}).then(() => {
// Send a success message in the current channel
message.reply({
content: message.translate("moderation/ban:BANNED", {
username: user.tag,
server: message.guild.name,
moderator: message.author.tag,
reason
})
});
const caseInfo = {
channel: message.channel.id,
moderator: message.author.id,
date: Date.now(),
type: "ban",
case: data.guild.casesCount,
reason
};
if (memberData) {
memberData.sanctions.push(caseInfo);
memberData.save();
}
data.guild.casesCount++;
data.guild.save();
if (data.guild.plugins.modlogs) {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if (!channel) return;
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("moderation/ban:CASE", {
count: data.guild.casesCount
})
})
.addField(message.translate("common:USER"), `\`${user.tag}\` (${user.toString()})`, true)
.addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true)
.addField(message.translate("common:REASON"), reason, true)
.setColor("#e02316");
channel.send({
embeds: [embed]
});
}
}).catch((err) => {
console.log(err);
return message.error("moderation/ban:MISSING_PERM");
});
}
}
module.exports = Ban;

View file

@ -1,100 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Kick extends Command {
constructor(client) {
super(client, {
name: "kick",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["k"],
memberPermissions: ["KICK_MEMBERS"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "KICK_MEMBERS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("moderation/kick:MISSING_MEMBER");
if (member.id === message.author.id) return message.error("moderation/kick:YOURSELF");
const memberData = await this.client.findOrCreateMember({
id: member.id,
guildID: message.guild.id
});
// Gets the kcik reason
let reason = args.slice(1).join(" ");
if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED");
const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (!member.kickable) return message.error("moderation/kick:MISSING_PERM");
await member.send({
content: message.translate("moderation/kick:KICKED_DM", {
username: member.user.tag,
server: message.guild.name,
moderator: message.author.tag,
reason
})
});
// Kick the user
member.kick(reason).then(() => {
// Send a success message in the current channel
message.reply({
content: message.translate("moderation/kick:KICKED", {
username: member.user.tag,
server: message.guild.name,
moderator: message.author.tag,
reason
})
});
data.guild.casesCount++;
data.guild.save();
const caseInfo = {
channel: message.channel.id,
moderator: message.author.id,
date: Date.now(),
type: "kick",
case: data.guild.casesCount,
reason,
};
memberData.sanctions.push(caseInfo);
memberData.save();
if (data.guild.plugins.modlogs) {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if (!channel) return;
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("moderation/kick:CASE", {
count: data.guild.casesCount
})
})
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true)
.addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true)
.addField(message.translate("common:REASON"), reason, true)
.setColor("#e88709");
channel.send({
embeds: [embed]
});
}
}).catch(() => {
return message.error("moderation/kick:MISSING_PERM");
});
}
}
module.exports = Kick;

View file

@ -1,113 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js"),
ms = require("ms");
class Mute extends Command {
constructor(client) {
super(client, {
name: "mute",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["m"],
memberPermissions: ["MANAGE_MESSAGES"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_CHANNELS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("moderation/mute:MISSING_MEMBER");
if (member.id === message.author.id) return message.error("moderation/mute:YOURSELF");
const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
const memberData = await this.client.findOrCreateMember({
id: member.id,
guildID: message.guild.id
});
const time = args[1];
if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME");
let reason = args.slice(2).join(" ");
if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED");
message.guild.channels.cache.forEach((channel) => {
channel.permissionOverwrites.edit(member.id, {
SEND_MESSAGES: false,
ADD_REACTIONS: false,
CONNECT: false
}).catch(() => {});
});
member.send({
content: message.translate("moderation/mute:MUTED_DM", {
username: member.user.username,
server: message.guild.name,
moderator: message.author.tag,
time,
reason
})
});
message.success("moderation/mute:MUTED", {
username: member.user.tag,
server: message.guild.name,
moderator: message.author.tag,
time,
reason
});
data.guild.casesCount++;
const caseInfo = {
channel: message.channel.id,
moderator: message.author.id,
date: Date.now(),
type: "mute",
case: data.guild.casesCount,
reason,
time
};
memberData.mute.muted = true;
memberData.mute.endDate = Date.now() + ms(time);
memberData.mute.case = data.guild.casesCount;
memberData.sanctions.push(caseInfo);
memberData.markModified("sanctions");
memberData.markModified("mute");
await memberData.save();
await data.guild.save();
this.client.databaseCache.mutedUsers.set(`${member.id}${message.guild.id}`, memberData);
if (data.guild.plugins.modlogs) {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if (!channel) return;
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("moderation/mute:CASE", {
count: data.guild.casesCount
})
})
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true)
.addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true)
.addField(message.translate("common:REASON"), reason, true)
.addField(message.translate("common:DURATION"), time, true)
.addField(message.translate("common:EXPIRY"), this.client.printDate(new Date(Date.now() + ms(time))), true)
.setColor("#f44271");
channel.send({
embeds: [embed]
});
}
}
}
module.exports = Mute;

View file

@ -85,15 +85,20 @@ class Poll extends Command {
this.client.emojis.cache.find(e => e.name === error) this.client.emojis.cache.find(e => e.name === error)
]; ];
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("moderation/poll:TITLE") name: message.translate("moderation/poll:TITLE")
}) })
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.addField(question, message.translate("moderation/poll:REACT", { .addFields([
{
name: question,
value: message.translate("moderation/poll:REACT", {
success: emojis[0].toString(), success: emojis[0].toString(),
error: emojis[1].toString() error: emojis[1].toString()
})); })
}
]);
message.channel.send({ message.channel.send({
content: mention, content: mention,

View file

@ -1,47 +0,0 @@
const Command = require("../../base/Command");
class Unmute extends Command {
constructor(client) {
super(client, {
name: "unmute",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["um"],
memberPermissions: ["MANAGE_MESSAGES"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_CHANNELS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args) {
const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.success("moderation/unmute:MISSING_MEMBER");
const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
const memberData = await this.client.findOrCreateMember({
id: member.id,
guildID: message.guild.id
});
if (memberData.mute.muted) {
memberData.mute.endDate = Date.now();
memberData.markModified("mute");
memberData.save();
message.success("moderation/unmute:SUCCESS", {
username: member.user.tag
});
} else {
message.error("moderation/unmute:NOT_MUTED", {
username: member.user.tag
});
}
}
}
module.exports = Unmute;

View file

@ -0,0 +1,60 @@
const Command = require("../../base/Command");
class Untimeout extends Command {
constructor(client) {
super(client, {
name: "untimeout",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["untimeout"],
memberPermissions: ["BAN_MEMBERS"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args) {
let user = null;
if (!args[0]) return message.error("moderation/unban:MISSING_ID");
// Check if the arg is an ID or a username
const isId = !isNaN(args[0]);
if (isId) {
// Try to find a user with that ID
await this.client.users.fetch(args[0]).then((u) => {
// if a user was found
user = u;
}).catch(() => {});
} else if (!isId) {
const arr = args[0].split("#");
if (arr.length < 2) {
return message.error("misc:NO_USER_FOUND_ID", {
id: args[0]
});
}
user = this.client.users.filter((u) => u.username === arr[0]).find((u) => u.discriminator === arr[1]);
}
if (!user) return message.error("misc:NO_USER_FOUND_ID", { id: args[0] });
// check if the user is banned
const banned = await message.guild.bans.fetch();
if (!banned.some((e) => e.user.id === user.id)) return message.success("moderation/unban:NOT_BANNED", { username: user.tag });
// Unban user
message.guild.members.unban(user).catch(() => {});
// Send a success message in the current channel
message.success("moderation/unban:UNBANNED", {
username: user.tag,
server: message.guild.name
});
}
}
module.exports = Untimeout;

View file

@ -53,10 +53,22 @@ class Warn extends Command {
reason reason
}; };
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`) .addFields([
.addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`) {
.addField(message.translate("common:REASON"), reason, true); name: message.translate("common:USER"),
value: `\`${member.user.tag}\` (${member.user.toString()})`
},
{
name: message.translate("common:MODERATOR"),
value: `\`${message.author.tag}\` (${message.author.toString()})`
},
{
name: message.translate("common:REASON"),
value: reason,
inline: true
}
]);
if (banCount) { if (banCount) {
if (sanctions >= banCount) { if (sanctions >= banCount) {

View file

@ -26,12 +26,11 @@ class Warns extends Command {
guildID: message.guild.id guildID: message.guild.id
}); });
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: user.tag, name: user.tag,
iconURL: user.displayAvatarURL({ iconURL: user.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })
@ -49,7 +48,13 @@ class Warns extends Command {
}); });
} else { } else {
memberData.sanctions.forEach((s) => { memberData.sanctions.forEach((s) => {
embed.addField(s.type + " | #" + s.case, `${message.translate("common:MODERATOR")}: <@${s.moderator}>\n${message.translate("common:REASON")}: ${s.reason}`, true); embed.addFields([
{
name: s.type + " | #" + s.case,
value: `${message.translate("common:MODERATOR")}: <@${s.moderator}>\n${message.translate("common:REASON")}: ${s.reason}`,
inline: true
}
]);
}); });
} }
message.reply({ message.reply({

View file

@ -25,7 +25,7 @@ class Back extends Command {
if (!queue) return message.error("music/play:NOT_PLAYING"); if (!queue) return message.error("music/play:NOT_PLAYING");
if (!queue.previousSongs[0]) return message.error("music/back:NO_PREV_SONG"); if (!queue.previousSongs[0]) return message.error("music/back:NO_PREV_SONG");
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("music/back:DESCRIPTION") name: message.translate("music/back:DESCRIPTION")
}) })

View file

@ -28,7 +28,7 @@ class Clips extends Command {
clips.push(file.substring(0, file.length - 4)); clips.push(file.substring(0, file.length - 4));
}); });
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setTitle(message.translate("music/clips:EMBED_TITLE")) .setTitle(message.translate("music/clips:EMBED_TITLE"))
.setDescription(clips.join("\n")) .setDescription(clips.join("\n"))
.setColor(data.config.embed.color) .setColor(data.config.embed.color)

View file

@ -26,7 +26,7 @@ class Jump extends Command {
if (!queue) return message.error("music/play:NOT_PLAYING"); if (!queue) return message.error("music/play:NOT_PLAYING");
if (number < 0) return message.error("music/jump:NO_PREV_SONG", { prefix: data.guild.prefix }); if (number < 0) return message.error("music/jump:NO_PREV_SONG", { prefix: data.guild.prefix });
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("music/jump:SUCCESS") name: message.translate("music/jump:SUCCESS")
}) })

View file

@ -1,14 +1,14 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"); Discord = require("discord.js");
class Np extends Command { class Nowplaying extends Command {
constructor(client) { constructor(client) {
super(client, { super(client, {
name: "np", name: "nowplaying",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: ["nowplaying"], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
@ -39,15 +39,29 @@ class Np extends Command {
: message.translate("music/np:DISABLED") : message.translate("music/np:DISABLED")
}\``; }\``;
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("music/queue:TITLE") name: message.translate("music/queue:TITLE")
}) })
.setThumbnail(track.thumbnail) .setThumbnail(track.thumbnail)
.addField(message.translate("music/np:T_TITLE"), `[${track.name}](${track.url})`) .addFields([
.addField(message.translate("music/np:T_CHANNEL"), track.uploader.name ? track.uploader.name : "Отсутствует") {
.addField(message.translate("music/np:T_DURATION"), `${queue.formattedCurrentTime} / ${track.duration > 1 ? track.formattedDuration : message.translate("music/play:LIVE")}`) name: message.translate("music/np:T_TITLE"),
.addField(message.translate("music/np:T_CONF"), status(queue)) value: `[${track.name}](${track.url})`
},
{
name: message.translate("music/np:T_CHANNEL"),
value: track.uploader.name || message.translate("common:UNKNOWN")
},
{
name: message.translate("music/np:T_DURATION"),
value: `${queue.formattedCurrentTime} / ${track.duration > 1 ? track.formattedDuration : message.translate("music/play:LIVE")}`
},
{
name: message.translate("music/np:T_CONF"),
value: status(queue)
}
])
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter({ .setFooter({
text: data.config.embed.footer text: data.config.embed.footer
@ -60,4 +74,4 @@ class Np extends Command {
} }
} }
module.exports = Np; module.exports = Nowplaying;

View file

@ -1,5 +1,5 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
{ Permissions } = require("discord.js"); { PermissionsBitField } = require("discord.js");
class Play extends Command { class Play extends Command {
constructor(client) { constructor(client) {
@ -25,7 +25,7 @@ class Play extends Command {
// Check my permissions // Check my permissions
const perms = voice.permissionsFor(this.client.user); const perms = voice.permissionsFor(this.client.user);
if (!perms.has(Permissions.FLAGS.CONNECT) || !perms.has(Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT"); if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return message.error("music/play:VOICE_CHANNEL_CONNECT");
try { try {
this.client.player.play(message.member.voice.channel, args.join(" "), { this.client.player.play(message.member.voice.channel, args.join(" "), {

View file

@ -1,6 +1,6 @@
const Command = require("../../base/Command"), const Command = require("../../base/Command"),
Discord = require("discord.js"), Discord = require("discord.js"),
Pagination = require("discord-paginationembed"); Pagination = require("customizable-discordjs-pagination");
class Queue extends Command { class Queue extends Command {
constructor(client) { constructor(client) {
@ -26,14 +26,17 @@ class Queue extends Command {
if (!queue) return message.error("music/play:NOT_PLAYING"); if (!queue) return message.error("music/play:NOT_PLAYING");
if (queue.songs.length === 1) { if (queue.songs.length === 1) {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("music/queue:TITLE"), name: message.translate("music/queue:TITLE"),
iconURL: message.guild.iconURL({ iconURL: message.guild.iconURL()
dynamic: true
}) })
}) .addFields([
.addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*${message.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`) {
name: message.translate("music/np:CURRENTLY_PLAYING"),
value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${message.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`
}
])
.setColor(data.config.embed.color); .setColor(data.config.embed.color);
return message.reply({ return message.reply({
embeds: [embed] embeds: [embed]
@ -46,11 +49,14 @@ class Queue extends Command {
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setAuthor({ .setAuthor({
name: message.translate("music/queue:TITLE"), name: message.translate("music/queue:TITLE"),
iconURL: message.guild.iconURL({ iconURL: message.guild.iconURL()
dynamic: true
}) })
}) .addFields([
.addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*${message.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`); {
name: message.translate("music/np:CURRENTLY_PLAYING"),
value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${message.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`
}
]);
FieldsEmbed FieldsEmbed
.setArray(queue.songs[1] ? queue.songs.slice(1, queue.songs.length) : []) .setArray(queue.songs[1] ? queue.songs.slice(1, queue.songs.length) : [])
.setAuthorizedUsers([message.author.id]) .setAuthorizedUsers([message.author.id])

View file

@ -25,7 +25,7 @@ class Skip extends Command {
if (!queue) return message.error("music/play:NOT_PLAYING"); if (!queue) return message.error("music/play:NOT_PLAYING");
if (!queue.songs[1]) return message.error("music/skip:NO_NEXT_SONG"); if (!queue.songs[1]) return message.error("music/skip:NO_NEXT_SONG");
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("music/skip:SUCCESS") name: message.translate("music/skip:SUCCESS")
}) })

View file

@ -24,7 +24,7 @@ class Stop extends Command {
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
if (!queue) return message.error("music/play:NOT_PLAYING"); if (!queue) return message.error("music/play:NOT_PLAYING");
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ .setAuthor({
name: message.translate("music/stop:DESCRIPTION") name: message.translate("music/stop:DESCRIPTION")
}) })

View file

@ -4,7 +4,7 @@ const path = require("path");
class BaseCommand { class BaseCommand {
constructor(options, client) { constructor(options, client) {
/** /**
* @type {import("@discordjs/builders").SlashCommandBuilder | import("discord.js").ApplicationCommandData} * @type {import("discord.js").SlashCommandBuilder | import("discord.js").ApplicationCommandData}
*/ */
this.command = options.command; this.command = options.command;
/** /**

View file

@ -1,14 +1,13 @@
const { MessageEmbed, Client, Collection } = require("discord.js"), const { EmbedBuilder, Client, Collection } = require("discord.js"),
{ GiveawaysManager } = require("discord-giveaways"), { GiveawaysManager } = require("discord-giveaways"),
{ SoundCloudPlugin } = require("@distube/soundcloud"), { SoundCloudPlugin } = require("@distube/soundcloud"),
{ SpotifyPlugin } = require("@distube/spotify"), { SpotifyPlugin } = require("@distube/spotify"),
{ YtDlpPlugin } = require("@distube/yt-dlp"), { YtDlpPlugin } = require("@distube/yt-dlp"),
{ SlashCommandBuilder } = require("@discordjs/builders"), { SlashCommandBuilder } = require("discord.js"),
{ REST } = require("@discordjs/rest"), { REST } = require("@discordjs/rest"),
{ Routes } = require("discord-api-types/v9"); { Routes } = require("discord-api-types/v10");
const util = require("util"), const BaseEvent = require("./BaseEvent.js"),
BaseEvent = require("./BaseEvent.js"),
BaseCommand = require("./BaseCommand.js"), BaseCommand = require("./BaseCommand.js"),
AmeClient = require("amethyste-api"), AmeClient = require("amethyste-api"),
path = require("path"), path = require("path"),
@ -33,7 +32,7 @@ class JaBa extends Client {
this.languages = require("../languages/language-meta"); // Load the bot's languages this.languages = require("../languages/language-meta"); // Load the bot's languages
this.commands = new Collection(); // Creates new commands collection this.commands = new Collection(); // Creates new commands collection
this.logger = require("../helpers/logger"); // Load the logger file this.logger = require("../helpers/logger"); // Load the logger file
this.wait = util.promisify(setTimeout); // client.wait(1000) - Wait 1 second this.wait = require("node:timers/promises").setTimeout; // client.wait(1000) - Wait 1 second
this.functions = require("../helpers/functions"); // Load the functions file this.functions = require("../helpers/functions"); // Load the functions file
this.guildsData = require("../base/Guild"); // Guild mongoose model this.guildsData = require("../base/Guild"); // Guild mongoose model
this.usersData = require("../base/User"); // User mongoose model this.usersData = require("../base/User"); // User mongoose model
@ -59,7 +58,7 @@ class JaBa extends Client {
new SoundCloudPlugin(), new SoundCloudPlugin(),
new YtDlpPlugin() new YtDlpPlugin()
], ],
youtubeDL: false, directLink: true,
emitNewSongOnly: true, emitNewSongOnly: true,
leaveOnEmpty: true, leaveOnEmpty: true,
leaveOnFinish: true, leaveOnFinish: true,
@ -88,7 +87,7 @@ class JaBa extends Client {
.on("addList", (queue, playlist) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE_COUNT", { songCount: `**${playlist.songs.length}** ${this.getNoun(playlist.songs.length, this.translate("misc:NOUNS:TRACKS:1"), this.translate("misc:NOUNS:TRACKS:1"), this.translate("misc:NOUNS:TRACKS:2"), this.translate("misc:NOUNS:TRACKS:5"))}` }, queue.textChannel.guild.data.language) })) .on("addList", (queue, playlist) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE_COUNT", { songCount: `**${playlist.songs.length}** ${this.getNoun(playlist.songs.length, this.translate("misc:NOUNS:TRACKS:1"), this.translate("misc:NOUNS:TRACKS:1"), this.translate("misc:NOUNS:TRACKS:2"), this.translate("misc:NOUNS:TRACKS:5"))}` }, queue.textChannel.guild.data.language) }))
.on("searchResult", (message, result) => { .on("searchResult", (message, result) => {
let i = 0; let i = 0;
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setDescription(result.map(song => `**${++i} -** ${song.name}`).join("\n")) .setDescription(result.map(song => `**${++i} -** ${song.name}`).join("\n"))
.setFooter({ text: this.translate("music/play:RESULTS_FOOTER", null, message.guild.data.language) }) .setFooter({ text: this.translate("music/play:RESULTS_FOOTER", null, message.guild.data.language) })
.setColor(this.config.embed.color); .setColor(this.config.embed.color);
@ -126,7 +125,7 @@ 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(); }); var 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({ version: "9" }).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++) {
const folder = folders[index]; const folder = folders[index];

53
commands/Fun/8ball.js Normal file
View file

@ -0,0 +1,53 @@
const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Eightball extends BaseCommand {
/**
*
* @param {import("../base/JaBa")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("8ball")
.setDescription(client.translate("fun/8ball:DESCRIPTION"))
.addStringOption(option =>
option.setName("question")
.setDescription(client.translate("fun/8ball:QUESTION"))
.setRequired(true)),
aliases: [],
dirname: __dirname,
guildOnly: true,
ownerOnly: false
});
}
/**
*
* @param {import("../../base/JaBa")} client
*/
async onLoad() {
//...
}
/**
*
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").CommandInteraction} interaction
* @param {Array} data
*/
async execute(client, interaction) {
await interaction.deferReply();
const question = interaction.options.getString("question");
if (!question.endsWith("?")) return interaction.replyT("fun/8ball:ERR_QUESTION", null, { ephemeral: true });
const answerN = client.functions.randomNum(1, 20);
const answer = interaction.translate(`fun/8ball:RESPONSE_${answerN}`);
await client.wait(2000);
interaction.editReply({
content: answer
});
}
}
module.exports = Eightball;

47
commands/Fun/lmgtfy.js Normal file
View file

@ -0,0 +1,47 @@
const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class LMGTFY extends BaseCommand {
/**
*
* @param {import("../base/JaBa")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("lmgtfy")
.setDescription(client.translate("fun/lmgtfy:DESCRIPTION"))
.addStringOption(option =>
option.setName("question")
.setDescription(client.translate("fun/8ball:QUESTION"))
.setRequired(true)),
aliases: [],
dirname: __dirname,
guildOnly: true,
ownerOnly: false
});
}
/**
*
* @param {import("../../base/JaBa")} client
*/
async onLoad() {
//...
}
/**
*
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").CommandInteraction} interaction
* @param {Array} data
*/
async execute(client, interaction) {
const question = interaction.options.getString("question").replace(/[' '_]/g, "+");
interaction.reply({
content: `<https://letmegooglethat.com/?q=${question}>`,
ephemeral: true
});
}
}
module.exports = LMGTFY;

74
commands/Fun/lovecalc.js Normal file
View file

@ -0,0 +1,74 @@
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"),
md5 = require("md5");
class Lovecalc extends BaseCommand {
/**
*
* @param {import("../base/JaBa")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("lovecalc")
.setDescription(client.translate("fun/lovecalc:DESCRIPTION"))
.addUserOption(option =>
option.setName("first_member")
.setDescription(client.translate("common:USER"))
.setRequired(true))
.addUserOption(option =>
option.setName("second_member")
.setDescription(client.translate("common:USER"))),
aliases: [],
dirname: __dirname,
guildOnly: true,
ownerOnly: false
});
}
/**
*
* @param {import("../../base/JaBa")} client
*/
async onLoad() {
//...
}
/**
*
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").CommandInteraction} interaction
* @param {Array} data
*/
async execute(client, interaction) {
const firstMember = interaction.options.getMember("first_member");
const secondMember = interaction.options.getMember("second_member") || interaction.user;
const members = [firstMember, secondMember].sort((a, b) => parseInt(a.id, 10) - parseInt(b.id, 10));
const hash = md5(`${members[0].id}${members[1].user.username}${members[0].user.username}${members[1].id}`);
const string = hash
.split("")
.filter(e => !isNaN(e))
.join("");
const percent = parseInt(string.substr(0, 2), 10);
const embed = new EmbedBuilder()
.setAuthor({
name: `❤️ ${interaction.translate("fun/lovecalc:DESCRIPTION")}`
})
.setDescription(interaction.translate("fun/lovecalc:CONTENT", {
percent,
firstMember: firstMember,
secondMember: secondMember
}))
.setColor(client.config.embed.color)
.setFooter({
text: client.config.embed.footer
});
interaction.reply({
embeds: [embed]
});
}
}
module.exports = Lovecalc;

81
commands/Fun/memes.js Normal file
View file

@ -0,0 +1,81 @@
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch");
class Memes extends BaseCommand {
/**
*
* @param {import("../base/JaBa")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("memes")
.setDescription(client.translate("fun/memes:DESCRIPTION")),
aliases: [],
dirname: __dirname,
guildOnly: true,
ownerOnly: false
});
}
/**
*
* @param {import("../../base/JaBa")} client
*/
async onLoad() {
//...
}
/**
*
* @param {import("../../base/JaBa")} client
* @param {import("discord.js").CommandInteraction} interaction
* @param {Array} data
*/
async execute(client, interaction) {
const tags = ["memes", "dankmemes", "me_irl", "wholesomememes"].map(tag =>
JSON.parse(JSON.stringify({
label: tag,
value: tag
}))
);
const row = new ActionRowBuilder()
.addComponents(
new SelectMenuBuilder()
.setCustomId("memes_select")
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
.addOptions(tags)
);
const msg = await interaction.reply({
content: interaction.translate("common:AVAILABLE_CATEGORIES"),
components: [row],
fetchReply: true
});
const collector = new InteractionCollector(client, {
message: msg,
idle: 60 * 1000
});
collector.on("collect", async (msg) => {
const tag = msg?.values[0];
const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json());
const embed = new EmbedBuilder()
.setColor(client.config.embed.color)
.setFooter({
text: client.config.embed.footer
})
.setTitle(`${res.title}\n${interaction.translate("fun/memes:SUBREDDIT")}: ${res.subreddit}\n${interaction.translate("common:AUTHOR")}: ${res.author}\n${interaction.translate("fun/memes:UPS")}: ${res.ups}`)
.setImage(res.url)
.setTimestamp();
msg.update({
embeds: [embed]
});
});
}
}
module.exports = Memes;

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder } = require("@discordjs/builders"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Ping extends BaseCommand { class Ping extends BaseCommand {

View file

@ -1,6 +1,4 @@
const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector } = require("discord.js");
const { SlashCommandBuilder } = require("@discordjs/builders"),
{ MessageEmbed, MessageActionRow, MessageSelectMenu, InteractionCollector } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"), const BaseCommand = require("../../base/BaseCommand"),
fetch = require("node-fetch"); fetch = require("node-fetch");
@ -39,35 +37,35 @@ 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,
description: "",
value: tag value: tag
})) }))
); );
const row = new MessageActionRow() const row = new ActionRowBuilder()
.addComponents( .addComponents(
new MessageSelectMenu() new SelectMenuBuilder()
.setCustomId("nsfw_select") .setCustomId("nsfw_select")
.setPlaceholder(client.translate("nsfw/nsfw:NOTHING_SELECTED")) .setPlaceholder(client.translate("common:NOTHING_SELECTED"))
.addOptions(tags) .addOptions(tags)
); );
const msg = await interaction.reply({ const msg = await interaction.reply({
content: interaction.translate("nsfw/nsfw:AVAILABLE_CATEGORIES"), content: interaction.translate("common:AVAILABLE_CATEGORIES"),
ephemeral: true, ephemeral: true,
components: [row] components: [row],
fetchReply: true
}); });
const collector = new InteractionCollector(client, { const collector = new InteractionCollector(client, {
message: msg, message: msg,
time: 60 * 1000 idle: 60 * 1000
}); });
collector.on("collect", async (msg) => { collector.on("collect", async (msg) => {
const tag = msg?.values[0]; const tag = msg?.values[0];
const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json()); const res = await fetch(`https://meme-api.herokuapp.com/gimme/${tag}`).then(response => response.json());
const embed = new MessageEmbed() 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

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder } = require("@discordjs/builders"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Debug extends BaseCommand { class Debug extends BaseCommand {

View file

@ -1,5 +1,5 @@
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
const { SlashCommandBuilder } = require("@discordjs/builders"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Eval extends BaseCommand { class Eval extends BaseCommand {
@ -14,7 +14,7 @@ class Eval extends BaseCommand {
.setDescription(client.translate("owner/eval:DESCRIPTION")) .setDescription(client.translate("owner/eval:DESCRIPTION"))
.addStringOption(option => .addStringOption(option =>
option.setName("code") option.setName("code")
.setDescription(client.translate("owner/eval:USAGE")) .setDescription(client.translate("owner/eval:CODE"))
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,

View file

@ -1,5 +1,5 @@
const { SlashCommandBuilder } = require("@discordjs/builders"), const { SlashCommandBuilder } = require("discord.js");
BaseCommand = require("../../base/BaseCommand"), const BaseCommand = require("../../base/BaseCommand"),
i18next = require("i18next"), i18next = require("i18next"),
autoUpdateDocs = require("../../helpers/autoUpdateDocs"); autoUpdateDocs = require("../../helpers/autoUpdateDocs");
@ -15,7 +15,7 @@ class Reload extends BaseCommand {
.setDescription(client.translate("owner/reload:DESCRIPTION")) .setDescription(client.translate("owner/reload:DESCRIPTION"))
.addStringOption(option => .addStringOption(option =>
option.setName("command") option.setName("command")
.setDescription(client.translate("owner/reload:USAGE")) .setDescription(client.translate("owner/reload:COMMAND"))
.setRequired(true)), .setRequired(true)),
aliases: [], aliases: [],
dirname: __dirname, dirname: __dirname,

View file

@ -1,4 +1,4 @@
const { SlashCommandBuilder } = require("@discordjs/builders"); const { SlashCommandBuilder } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Say extends BaseCommand { class Say extends BaseCommand {
@ -38,7 +38,7 @@ class Say extends BaseCommand {
* @param {Array} data * @param {Array} data
*/ */
async execute(client, interaction) { async execute(client, interaction) {
interaction.deferReply({ ephemeral: true }); await interaction.deferReply({ ephemeral: true });
const message = interaction.options.getString("message"); const message = interaction.options.getString("message");
const channel = interaction.options.getChannel("channel"); const channel = interaction.options.getChannel("channel");

View file

@ -1,5 +1,4 @@
const { SlashCommandBuilder } = require("@discordjs/builders"), const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
{ MessageEmbed } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand"); const BaseCommand = require("../../base/BaseCommand");
class Servers extends BaseCommand { class Servers extends BaseCommand {
@ -44,12 +43,11 @@ class Servers extends BaseCommand {
.slice(0, 10) .slice(0, 10)
.join("\n"); .join("\n");
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: interaction.user.tag, name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ iconURL: interaction.user.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })

View file

@ -80,7 +80,7 @@ router.get("/callback", async (req, res) => {
const userDB = await req.client.findOrCreateUser(req.session.user.id); const userDB = await req.client.findOrCreateUser(req.session.user.id);
const logsChannel = req.client.channels.cache.get(req.client.config.dashboard.logs); const logsChannel = req.client.channels.cache.get(req.client.config.dashboard.logs);
if (!userDB.logged && logsChannel && user) { if (!userDB.logged && logsChannel && user) {
const embed = new Discord.MessageEmbed() const embed = new Discord.EmbedBuilder()
.setAuthor({ name: user.username, iconURL: user.displayAvatarURL() }) .setAuthor({ name: user.username, iconURL: user.displayAvatarURL() })
.setColor(req.client.config.embed.color) .setColor(req.client.config.embed.color)
.setDescription(req.client.translate("dashboard:FIRST_LOGIN", { user: user.tag })); .setDescription(req.client.translate("dashboard:FIRST_LOGIN", { user: user.tag }));

View file

@ -1,4 +1,4 @@
const { Permissions } = require("discord.js"); const { PermissionsBitField } = require("discord.js");
/** /**
* Fetch user informations (stats, guilds, etc...) * Fetch user informations (stats, guilds, etc...)
@ -12,8 +12,8 @@ async function fetchUser(userData, client, query) {
userData.guilds.forEach((guild) => { userData.guilds.forEach((guild) => {
if (!client.guilds.cache.get(guild.id)) return; if (!client.guilds.cache.get(guild.id)) return;
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const perms = new Permissions(BigInt(guild.permissions)); const perms = new PermissionsBitField(BigInt(guild.permissions));
if (perms.has(Permissions.FLAGS.MANAGE_GUILD)) guild.admin = true; if (perms.has(PermissionsBitField.Flags.ManageGuild)) guild.admin = true;
guild.settingsUrl = (client.guilds.cache.get(guild.id) ? `/manage/${guild.id}/` : `https://discordapp.com/oauth2/authorize?client_id=${client.user.id}&scope=bot&permissions=8&guild_id=${guild.id}`); guild.settingsUrl = (client.guilds.cache.get(guild.id) ? `/manage/${guild.id}/` : `https://discordapp.com/oauth2/authorize?client_id=${client.user.id}&scope=bot&permissions=8&guild_id=${guild.id}`);
guild.statsUrl = (client.guilds.cache.get(guild.id) ? `/stats/${guild.id}/` : `https://discordapp.com/oauth2/authorize?client_id=${client.user.id}&scope=bot&permissions=8&guild_id=${guild.id}`); guild.statsUrl = (client.guilds.cache.get(guild.id) ? `/stats/${guild.id}/` : `https://discordapp.com/oauth2/authorize?client_id=${client.user.id}&scope=bot&permissions=8&guild_id=${guild.id}`);

View file

@ -1,4 +1,5 @@
const BaseEvent = require("../base/BaseEvent"); const BaseEvent = require("../base/BaseEvent");
const { InteractionType } = require("discord.js");
class CommandHandler extends BaseEvent { class CommandHandler extends BaseEvent {
constructor() { constructor() {
@ -14,7 +15,7 @@ class CommandHandler extends BaseEvent {
* @param {import("discord.js").Interaction} interaction * @param {import("discord.js").Interaction} interaction
*/ */
async execute(client, interaction) { async execute(client, interaction) {
if (interaction.type !== "APPLICATION_COMMAND" && !interaction.isCommand()) return; if (interaction.type !== InteractionType.ApplicationCommand && !interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName); const command = client.commands.get(interaction.commandName);
const data = []; const data = [];

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require("discord.js"), const { EmbedBuilder } = require("discord.js"),
BaseEvent = require("../../base/BaseEvent"); BaseEvent = require("../../base/BaseEvent");
class GuildCreate extends BaseEvent { class GuildCreate extends BaseEvent {
@ -31,7 +31,7 @@ class GuildCreate extends BaseEvent {
await userData.save(); await userData.save();
} }
const thanksEmbed = new MessageEmbed() const thanksEmbed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: "Спасибо что добавили меня на свой сервер!" name: "Спасибо что добавили меня на свой сервер!"
}) })
@ -49,12 +49,10 @@ class GuildCreate extends BaseEvent {
const users = guild.members.cache.filter((m) => !m.user.bot).size; const users = guild.members.cache.filter((m) => !m.user.bot).size;
const bots = guild.members.cache.filter((m) => m.user.bot).size; const bots = guild.members.cache.filter((m) => m.user.bot).size;
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: guild.name, name: guild.name,
iconURL: guild.iconURL({ iconURL: guild.iconURL()
dynamic: true
})
}) })
.setColor("#32CD32") .setColor("#32CD32")
.setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${this.client.getNoun(users, this.client.translate("misc:NOUNS:USERS:1"), this.client.translate("misc:NOUNS:USERS:2"), this.client.translate("misc:NOUNS:USERS:5"))} (из них **${bots}** ${this.client.getNoun(bots, this.client.translate("misc:NOUNS:BOTS:1"), this.client.translate("misc:NOUNS:BOTS:2"), this.client.translate("misc:NOUNS:BOTS:5"))})`); .setDescription(`Зашёл на сервер **${guild.name}**. На нём **${users}** ${this.client.getNoun(users, this.client.translate("misc:NOUNS:USERS:1"), this.client.translate("misc:NOUNS:USERS:2"), this.client.translate("misc:NOUNS:USERS:5"))} (из них **${bots}** ${this.client.getNoun(bots, this.client.translate("misc:NOUNS:BOTS:1"), this.client.translate("misc:NOUNS:BOTS:2"), this.client.translate("misc:NOUNS:BOTS:5"))})`);

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require("discord.js"), const { EmbedBuilder } = require("discord.js"),
BaseEvent = require("../../base/BaseEvent"); BaseEvent = require("../../base/BaseEvent");
class GuildDelete extends BaseEvent { class GuildDelete extends BaseEvent {
@ -13,12 +13,10 @@ class GuildDelete extends BaseEvent {
* @param {import("discord.js").Guild} guild * @param {import("discord.js").Guild} guild
*/ */
async execute(guild) { async execute(guild) {
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: guild.name, name: guild.name,
iconURL: guild.iconURL({ iconURL: guild.iconURL()
dynamic: true
})
}) })
.setColor("#B22222") .setColor("#B22222")
.setDescription(`Вышел с сервера **${guild.name}**.`); .setDescription(`Вышел с сервера **${guild.name}**.`);

View file

@ -1,6 +1,6 @@
const Canvas = require("canvas"), const Canvas = require("canvas"),
BaseEvent = require("../../base/BaseEvent"), BaseEvent = require("../../base/BaseEvent"),
{ MessageAttachment } = require("discord.js"), { AttachmentBuilder } = require("discord.js"),
{ resolve } = require("path"); { resolve } = require("path");
// Register assets fonts // Register assets fonts
@ -139,7 +139,7 @@ class GuildMemberAdd extends BaseEvent {
})); }));
ctx.drawImage(avatar, 45, 90, 270, 270); ctx.drawImage(avatar, 45, 90, 270, 270);
const attachment = new MessageAttachment(canvas.toBuffer(), "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]

View file

@ -1,6 +1,6 @@
const Canvas = require("canvas"), const Canvas = require("canvas"),
BaseEvent = require("../../base/BaseEvent"), BaseEvent = require("../../base/BaseEvent"),
{ MessageAttachment } = require("discord.js"), { AttachmentBuilder } = require("discord.js"),
{ resolve } = require("path"); { resolve } = require("path");
// Register assets fonts // Register assets fonts
@ -122,7 +122,7 @@ class GuildMemberRemove extends BaseEvent {
})); }));
ctx.drawImage(avatar, 45, 90, 270, 270); ctx.drawImage(avatar, 45, 90, 270, 270);
const attachment = new MessageAttachment(canvas.toBuffer(), "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]

View file

@ -1,4 +1,4 @@
const { Permissions } = require("discord.js"), const { PermissionsBitField } = require("discord.js"),
xpCooldown = {}, xpCooldown = {},
BaseEvent = require("../base/BaseEvent"); BaseEvent = require("../base/BaseEvent");
@ -54,7 +54,7 @@ class MessageCreate extends BaseEvent {
if (data.guild.plugins.automod.enabled && !data.guild.plugins.automod.ignored.includes(message.channel.id)) { if (data.guild.plugins.automod.enabled && !data.guild.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(Permissions.FLAGS.MANAGE_MESSAGES)) { if (!message.channel.permissionsFor(message.member).has(PermissionsBitField.Flags.ManageMessages)) {
message.delete(); message.delete();
message.author.send("```" + message.content + "```"); message.author.send("```" + message.content + "```");
return message.error("administration/automod:DELETED", { return message.error("administration/automod:DELETED", {

View file

@ -1,5 +1,5 @@
const BaseEvent = require("../base/BaseEvent"), const BaseEvent = require("../base/BaseEvent"),
{ Permissions } = require("discord.js"); { PermissionsBitField } = require("discord.js");
class Ready extends BaseEvent { class Ready extends BaseEvent {
constructor() { constructor() {
@ -21,7 +21,7 @@ class Ready extends BaseEvent {
// Logs some informations using logger // Logs some informations using logger
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: [Permissions.FLAGS.ADMINISTRATOR] })}`, "ready"); client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"] , permissions: [ PermissionsBitField.Flags.Administrator ] })}`, "ready");
// Discord Together // Discord Together
const discordtogether = require("../helpers/discordTogether"); const discordtogether = require("../helpers/discordTogether");
@ -56,7 +56,6 @@ class Ready extends BaseEvent {
]; ];
let i = 0; let i = 0;
setTimeout
setInterval(async function () { setInterval(async function () {
hiddenGuild = await client.guilds.fetch("568120814776614924"); hiddenGuild = await client.guilds.fetch("568120814776614924");
tUsers = client.users.cache.size - hiddenGuild.memberCount; tUsers = client.users.cache.size - hiddenGuild.memberCount;

View file

@ -1,5 +1,5 @@
const { CronJob } = require("cron"), const { CronJob } = require("cron"),
{ MessageEmbed } = require("discord.js"); { EmbedBuilder } = require("discord.js");
module.exports.init = async function (client) { module.exports.init = async function (client) {
new CronJob("0 5 * * *", async function () { new CronJob("0 5 * * *", async function () {
@ -26,12 +26,11 @@ module.exports.init = async function (client) {
const age = currentYear - year; const age = currentYear - year;
if (currentMonth === month && currentDay === day) { if (currentMonth === month && currentDay === day) {
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: client.user.username, name: client.user.username,
iconURL: client.user.displayAvatarURL({ iconURL: client.user.displayAvatarURL({
size: 512, size: 512,
dynamic: true,
format: "png" format: "png"
}) })
}) })
@ -39,11 +38,16 @@ module.exports.init = async function (client) {
.setFooter({ .setFooter({
text: client.config.embed.footer text: client.config.embed.footer
}) })
.addField(client.translate("economy/birthdate:HAPPY_BIRTHDAY"), client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", { .addFields([
{
name: client.translate("economy/birthdate:HAPPY_BIRTHDAY"),
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]
}); });

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require("discord.js"); const { EmbedBuilder } = require("discord.js");
module.exports.init = function (client) { module.exports.init = function (client) {
client.usersData client.usersData
@ -18,14 +18,22 @@ module.exports.init = function (client) {
const mustSent = reminds.filter((r) => r.sendAt < dateNow); const mustSent = reminds.filter((r) => r.sendAt < dateNow);
if (mustSent.length > 0) { if (mustSent.length > 0) {
mustSent.forEach((r) => { mustSent.forEach((r) => {
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setAuthor({ .setAuthor({
name: client.translate("general/remindme:TITLE") name: client.translate("general/remindme:TITLE")
}) })
.addField(client.translate("common:CREATION"), client.translate("general/remindme:CREATED", { .addFields([
{
name: client.translate("common:CREATION"),
value: client.translate("general/remindme:CREATED", {
time: client.convertTime(r.createdAt, "from") time: client.convertTime(r.createdAt, "from")
})) })
.addField(client.translate("common:MESSAGE"), r.message) },
{
name: client.translate("common: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

View file

@ -1,4 +1,4 @@
const { MessageEmbed } = require("discord.js"); const { EmbedBuilder } = require("discord.js");
module.exports.init = async function (client) { module.exports.init = async function (client) {
client.membersData client.membersData
@ -33,7 +33,7 @@ module.exports.init = async function (client) {
}); });
} }
const user = member ? member.user : await client.users.fetch(memberData.id); const user = member ? member.user : await client.users.fetch(memberData.id);
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setDescription(guild.translate("moderation/unmute:SUCCESS_CASE", { .setDescription(guild.translate("moderation/unmute:SUCCESS_CASE", {
user: user.toString(), user: user.toString(),
usertag: user.tag, usertag: user.tag,

View file

@ -1,4 +1,31 @@
const { Message, Interaction } = require("discord.js"); const { Message, CommandInteraction } = require("discord.js");
CommandInteraction.prototype.translate = function (key, args) {
const language = this.client.translations.get(this.guild ? this.guild.data.language : "ru-RU");
if (!language) throw "Message: Invalid language set in data.";
return language(key, args);
};
CommandInteraction.prototype.replyT = function (key, args, options = {}) {
let string = this.translate(key, args, this.guild ? this.guild.data.language : "ru-RU");
if (options.prefixEmoji) string = `${this.client.customEmojis[options.prefixEmoji]} | ${string}`;
if (options.edit) return this.editReply({ content: string, ephemeral: options.ephemeral || false });
else return this.reply({ content: string, ephemeral: options.ephemeral || false });
};
CommandInteraction.prototype.error = function (key, args, options = {}) {
options.prefixEmoji = "error";
return this.replyT(key, args, options);
};
CommandInteraction.prototype.success = function (key, args, options = {}) {
options.prefixEmoji = "success";
return this.replyT(key, args, options);
};
Message.prototype.translate = function (key, args) { Message.prototype.translate = function (key, args) {
const language = this.client.translations.get(this.guild ? this.guild.data.language : "ru-RU"); const language = this.client.translations.get(this.guild ? this.guild.data.language : "ru-RU");
@ -26,30 +53,3 @@ Message.prototype.success = function (key, args, options = {}) {
return this.replyT(key, args, options); return this.replyT(key, args, options);
}; };
Interaction.prototype.translate = function (key, args) {
const language = this.client.translations.get(this.guild ? this.guild.data.language : "ru-RU");
if (!language) throw "Message: Invalid language set in data.";
return language(key, args);
};
Interaction.prototype.replyT = function (key, args, options = {}) {
let string = this.translate(key, args, this.guild ? this.guild.data.language : "ru-RU");
if (options.prefixEmoji) string = `${this.client.customEmojis[options.prefixEmoji]} | ${string}`;
if (options.edit) return this.editReply({ content: string, ephemeral: options.ephemeral || false });
else return this.reply({ content: string, ephemeral: options.ephemeral || false });
};
Interaction.prototype.error = function (key, args, options = {}) {
options.prefixEmoji = "error";
return this.replyT(key, args, options);
};
Interaction.prototype.success = function (key, args, options = {}) {
options.prefixEmoji = "success";
return this.replyT(key, args, options);
};

View file

@ -1,4 +1,4 @@
const { Permissions } = require("discord.js"), const { PermissionsBitField } = require("discord.js"),
langs = require("../languages/language-meta.json").map((l) => l.moment).filter((l) => l !== "en"); langs = require("../languages/language-meta.json").map((l) => l.moment).filter((l) => l !== "en");
langs.forEach((lang) => { langs.forEach((lang) => {
require(`moment/locale/${lang}.js`); require(`moment/locale/${lang}.js`);
@ -7,8 +7,8 @@ langs.forEach((lang) => {
module.exports = { module.exports = {
async createInvite(client, guildId) { async createInvite(client, guildId) {
const guild = client.guilds.cache.get(guildId); const guild = client.guilds.cache.get(guildId);
const member = guild.me; const member = guild.members.me;
const channel = guild.channels.cache.find((ch) => ch.permissionsFor(member.id).has(Permissions.FLAGS.CREATE_INSTANT_INVITE) && ch.type === "GUILD_TEXT" || ch.type === "GUILD_VOICE"); const channel = guild.channels.cache.find((ch) => ch.permissionsFor(member.id).has(PermissionsBitField.Flags.CreateInstantInvite) && ch.type === "GUILD_TEXT" || ch.type === "GUILD_VOICE");
if (channel) { if (channel) {
const invite = await channel.createInvite(); const invite = await channel.createInvite();

View file

@ -1,6 +1,6 @@
// Thanks to simply-djs for this =) // Thanks to simply-djs for this =)
const { MessageEmbed, MessageButton, MessageActionRow } = require("discord.js"); const { EmbedBuilder, ButtonBuilder, ActionRowBuilder, ButtonStyle } = require("discord.js");
/** /**
* @param {require("discord.js").Message} message * @param {require("discord.js").Message} message
@ -66,7 +66,7 @@ async function tictactoe(interaction, options = {}) {
const foot = options.embedFoot ? { text: options.embedFoot } : { text: "Удачи =)" }; const foot = options.embedFoot ? { text: options.embedFoot } : { text: "Удачи =)" };
const acceptEmbed = new MessageEmbed() const acceptEmbed = new EmbedBuilder()
.setTitle(interaction.translate("economy/tictactoe:REQUEST_WAIT", { .setTitle(interaction.translate("economy/tictactoe:REQUEST_WAIT", {
user: opponent.tag user: opponent.tag
})) }))
@ -78,17 +78,17 @@ async function tictactoe(interaction, options = {}) {
.setFooter(foot) .setFooter(foot)
.setTimestamp(); .setTimestamp();
const accept = new MessageButton() const accept = new ButtonBuilder()
.setLabel(interaction.translate("economy/tictactoe:ACCEPT")) .setLabel(interaction.translate("economy/tictactoe:ACCEPT"))
.setStyle("SUCCESS") .setStyle("SUCCESS")
.setCustomId("acceptttt"); .setCustomId("acceptttt");
const decline = new MessageButton() const decline = new ButtonBuilder()
.setLabel(interaction.translate("economy/tictactoe:DECLINE")) .setLabel(interaction.translate("economy/tictactoe:DECLINE"))
.setStyle("DANGER") .setStyle("DANGER")
.setCustomId("declinettt"); .setCustomId("declinettt");
const accep = new MessageActionRow().addComponents([ const accep = new ActionRowBuilder().addComponents([
accept, accept,
decline decline
]); ]);
@ -145,54 +145,54 @@ async function tictactoe(interaction, options = {}) {
const Args = { const Args = {
user: 0, user: 0,
a1: { a1: {
style: "SECONDARY", style: ButtonStyle.Secondary,
emoji: dashmoji, emoji: dashmoji,
disabled: false disabled: false
}, },
a2: { a2: {
style: "SECONDARY", style: ButtonStyle.Secondary,
emoji: dashmoji, emoji: dashmoji,
disabled: false disabled: false
}, },
a3: { a3: {
style: "SECONDARY", style: ButtonStyle.Secondary,
emoji: dashmoji, emoji: dashmoji,
disabled: false disabled: false
}, },
b1: { b1: {
style: "SECONDARY", style: ButtonStyle.Secondary,
emoji: dashmoji, emoji: dashmoji,
disabled: false disabled: false
}, },
b2: { b2: {
style: "SECONDARY", style: ButtonStyle.Secondary,
emoji: dashmoji, emoji: dashmoji,
disabled: false disabled: false
}, },
b3: { b3: {
style: "SECONDARY", style: ButtonStyle.Secondary,
emoji: dashmoji, emoji: dashmoji,
disabled: false disabled: false
}, },
c1: { c1: {
style: "SECONDARY", style: ButtonStyle.Secondary,
emoji: dashmoji, emoji: dashmoji,
disabled: false disabled: false
}, },
c2: { c2: {
style: "SECONDARY", style: ButtonStyle.Secondary,
emoji: dashmoji, emoji: dashmoji,
disabled: false disabled: false
}, },
c3: { c3: {
style: "SECONDARY", style: ButtonStyle.Secondary,
emoji: dashmoji, emoji: dashmoji,
disabled: false disabled: false
} }
}; };
const { MessageActionRow, MessageButton } = require("discord.js"); const { ActionRowBuilder, ButtonBuilder } = require("discord.js");
const epm = new MessageEmbed() const epm = new EmbedBuilder()
.setTitle(interaction.translate("economy/tictactoe:DESCRIPTION")) .setTitle(interaction.translate("economy/tictactoe:DESCRIPTION"))
.setColor(options.embedColor || "#075FFF") .setColor(options.embedColor || "#075FFF")
.setFooter(foot) .setFooter(foot)
@ -233,54 +233,54 @@ async function tictactoe(interaction, options = {}) {
"<:X_:863314044781723668>": false "<:X_:863314044781723668>": false
}; };
const a1 = new MessageButton() const a1 = new ButtonBuilder()
.setStyle(Args.a1.style) .setStyle(Args.a1.style)
.setEmoji(Args.a1.emoji) .setEmoji(Args.a1.emoji)
.setCustomId("a1") .setCustomId("a1")
.setDisabled(Args.a1.disabled); .setDisabled(Args.a1.disabled);
const a2 = new MessageButton() const a2 = new ButtonBuilder()
.setStyle(Args.a2.style) .setStyle(Args.a2.style)
.setEmoji(Args.a2.emoji) .setEmoji(Args.a2.emoji)
.setCustomId("a2") .setCustomId("a2")
.setDisabled(Args.a2.disabled); .setDisabled(Args.a2.disabled);
const a3 = new MessageButton() const a3 = new ButtonBuilder()
.setStyle(Args.a3.style) .setStyle(Args.a3.style)
.setEmoji(Args.a3.emoji) .setEmoji(Args.a3.emoji)
.setCustomId("a3") .setCustomId("a3")
.setDisabled(Args.a3.disabled); .setDisabled(Args.a3.disabled);
const b1 = new MessageButton() const b1 = new ButtonBuilder()
.setStyle(Args.b1.style) .setStyle(Args.b1.style)
.setEmoji(Args.b1.emoji) .setEmoji(Args.b1.emoji)
.setCustomId("b1") .setCustomId("b1")
.setDisabled(Args.b1.disabled); .setDisabled(Args.b1.disabled);
const b2 = new MessageButton() const b2 = new ButtonBuilder()
.setStyle(Args.b2.style) .setStyle(Args.b2.style)
.setEmoji(Args.b2.emoji) .setEmoji(Args.b2.emoji)
.setCustomId("b2") .setCustomId("b2")
.setDisabled(Args.b2.disabled); .setDisabled(Args.b2.disabled);
const b3 = new MessageButton() const b3 = new ButtonBuilder()
.setStyle(Args.b3.style) .setStyle(Args.b3.style)
.setEmoji(Args.b3.emoji) .setEmoji(Args.b3.emoji)
.setCustomId("b3") .setCustomId("b3")
.setDisabled(Args.b3.disabled); .setDisabled(Args.b3.disabled);
const c1 = new MessageButton() const c1 = new ButtonBuilder()
.setStyle(Args.c1.style) .setStyle(Args.c1.style)
.setEmoji(Args.c1.emoji) .setEmoji(Args.c1.emoji)
.setCustomId("c1") .setCustomId("c1")
.setDisabled(Args.c1.disabled); .setDisabled(Args.c1.disabled);
const c2 = new MessageButton() const c2 = new ButtonBuilder()
.setStyle(Args.c2.style) .setStyle(Args.c2.style)
.setEmoji(Args.c2.emoji) .setEmoji(Args.c2.emoji)
.setCustomId("c2") .setCustomId("c2")
.setDisabled(Args.c2.disabled); .setDisabled(Args.c2.disabled);
const c3 = new MessageButton() const c3 = new ButtonBuilder()
.setStyle(Args.c3.style) .setStyle(Args.c3.style)
.setEmoji(Args.c3.emoji) .setEmoji(Args.c3.emoji)
.setCustomId("c3") .setCustomId("c3")
.setDisabled(Args.c3.disabled); .setDisabled(Args.c3.disabled);
const a = new MessageActionRow().addComponents([a1, a2, a3]); const a = new ActionRowBuilder().addComponents([a1, a2, a3]);
const b = new MessageActionRow().addComponents([b1, b2, b3]); const b = new ActionRowBuilder().addComponents([b1, b2, b3]);
const c = new MessageActionRow().addComponents([c1, c2, c3]); const c = new ActionRowBuilder().addComponents([c1, c2, c3]);
const buttons = [a, b, c]; const buttons = [a, b, c];
if ( if (
@ -688,14 +688,14 @@ async function tictactoe(interaction, options = {}) {
if (Args.user == 0) { if (Args.user == 0) {
Args.user = 1; Args.user = 1;
Args[b.customId] = { Args[b.customId] = {
style: "SUCCESS", style: ButtonStyle.Success,
emoji: o_emoji, emoji: o_emoji,
disabled: true disabled: true
}; };
} else { } else {
Args.user = 0; Args.user = 0;
Args[b.customId] = { Args[b.customId] = {
style: "DANGER", style: ButtonStyle.Danger,
emoji: x_emoji, emoji: x_emoji,
disabled: true disabled: true
}; };
@ -838,7 +838,7 @@ async function tictactoe(interaction, options = {}) {
collector.on("end", (collected, reason) => { collector.on("end", (collected, reason) => {
if (reason == "time") { if (reason == "time") {
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setTitle(interaction.translate("economy/tictactoe:NO_ANSWER_TITLE")) .setTitle(interaction.translate("economy/tictactoe:NO_ANSWER_TITLE"))
.setAuthor({ .setAuthor({
name: (interaction.user ? interaction.user : interaction.author).tag, name: (interaction.user ? interaction.user : interaction.author).tag,
@ -857,7 +857,7 @@ async function tictactoe(interaction, options = {}) {
}); });
} }
if (reason == "decline") { if (reason == "decline") {
const embed = new MessageEmbed() const embed = new EmbedBuilder()
.setTitle(interaction.translate("economy/tictactoe:CANCELED")) .setTitle(interaction.translate("economy/tictactoe:CANCELED"))
.setAuthor({ .setAuthor({
name: (interaction.user ? interaction.user : interaction.author).tag, name: (interaction.user ? interaction.user : interaction.author).tag,

View file

@ -1,10 +1,10 @@
require("./helpers/extenders"); require("./helpers/extenders");
const { Intents } = require("discord.js"), const { GatewayIntentBits } = require("discord.js"),
JaBa = require("./base/JaBa"); JaBa = require("./base/JaBa");
const client = new JaBa({ const client = new JaBa({
intents: Object.keys(Intents.FLAGS), intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildBans, GatewayIntentBits.GuildEmojisAndStickers, GatewayIntentBits.GuildIntegrations, GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildPresences, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.MessageContent ],
allowedMentions: { parse: ["everyone", "roles", "users"] } allowedMentions: { parse: ["everyone", "roles", "users"] }
}); });
@ -17,7 +17,7 @@ const client = new JaBa({
})(); })();
client.on("disconnect", () => client.logger.log("Bot is disconnecting...", "warn")) client.on("disconnect", () => client.logger.log("Bot is disconnecting...", "warn"))
.on("reconnecting", () => client.logger.log("Bot reconnecting...", "log")) .on("reconnecting", () => client.logger.log("Bot reconnecting...", "warn"))
.on("error", (e) => client.logger.log(e, "error")) .on("error", (e) => client.logger.log(e, "error"))
.on("warn", (info) => client.logger.log(info, "warn")); .on("warn", (info) => client.logger.log(info, "warn"));
process.on("unhandledRejection", (err) => console.error(err)); process.on("unhandledRejection", (err) => console.error(err));

View file

@ -1,20 +0,0 @@
{
"DESCRIPTION": "Управление резервными копиями сервера!",
"USAGE": "backup [create/load/info/remove]",
"EXAMPLES": "backup create\nbackup load 123456789098765432\nbackup info 123456789098765432",
"MISSING_STATUS": "Выберите действие: `create`, `load`, `info` или `remove`!",
"MISSING_BACKUP_ID": "Укажите ID резервной копии!",
"NO_BACKUP_FOUND": "Резервных копий с ID `{{backupID}}` не найдено",
"SUCCESS_PUBLIC": "Резервная копия успешно создана! ID резервной копии был отправлен вам в ЛС!",
"SUCCESS_PRIVATE": "Вот ID вашей резервной копии: **`{{backupID}}`**, используйте его для восстановления на другом сервере!",
"CONFIRMATION": ":warning: | **Загрузка резервной копии заменит настройки текущего сервера.**\n\n:arrow_right_hook: *Отправьте `да` для подтверждения!*",
"REMOVE_CONFIRMATION": ":warning: | **Вы уверены что хотите удалить резервную копию? Это действие необратимо**\n\n:arrow_right_hook: *Отправьте `да` для подтверждения!*",
"SUCCESS_REMOVED": "Резервная копия успешно удалена!",
"START_LOADING": "Загрузка резервной копии начата, подождите!",
"LOAD_SUCCESS": "Резервная копия загружена!",
"TITLE_INFO": "Информация о резервной копии",
"TITLE_ID": "ID",
"TITLE_SERVER_ID": "ID сервера",
"TITLE_SIZE": "Размер",
"TITLE_CREATED_AT": "Создана"
}

View file

@ -58,6 +58,8 @@
"MODLOGS": "Логи модерации", "MODLOGS": "Логи модерации",
"NO_CHANNEL": "Канал не выбран", "NO_CHANNEL": "Канал не выбран",
"REPORTS": "Жалобы", "REPORTS": "Жалобы",
"BIRTHDAYS": "Поздравления с днём рождения", "UNKNOWN": "Неизвестно",
"DISCONNECT": "Отключить" "NOTHING_SELECTED": "Ничего не выбрано",
"AVAILABLE_CATEGORIES": "Доступные категории:",
"BIRTHDAYS": "Поздравления с днём рождения"
} }

View file

@ -1,8 +1,8 @@
{ {
"DESCRIPTION": "Я говорю правду!", "DESCRIPTION": "Я говорю правду",
"USAGE": "8ball [вопрос?]", "QUESTION": "Вопрос",
"EXAMPLES": "8ball JaBa крутой?", "EXAMPLES": "8ball JaBa крутой?",
"ERR_QUESTION": "Введите вопрос!", "ERR_QUESTION": "Вопрос должен оканчиваться на `?`.",
"RESPONSE_1": "Бесспорно", "RESPONSE_1": "Бесспорно",
"RESPONSE_2": "Предрешено", "RESPONSE_2": "Предрешено",
"RESPONSE_3": "Никаких сомнений", "RESPONSE_3": "Никаких сомнений",

View file

@ -1,7 +0,0 @@
{
"DESCRIPTION": "Подкинуть монетку!",
"USAGE": "flip",
"EXAMPLES": "flip",
"HEADS": ":coin: | Орёл!",
"TAILS": ":coin: | Решка!"
}

View file

@ -1,6 +1,6 @@
{ {
"DESCRIPTION": "Создать LMGTFY (давай я загуглю это для тебя) ссылку", "DESCRIPTION": "Создать LMGTFY (давай я загуглю это для тебя) ссылку",
"USAGE": "lmg [запрос]", "USAGE": "lmgtfy [запрос]",
"EXAMPLES": "lmg Как создать Discord бота?", "EXAMPLES": "lmgtfy Как создать Discord бота?",
"MISSING": "Укажите запрос!" "MISSING": "Укажите запрос!"
} }

View file

@ -2,6 +2,5 @@
"DESCRIPTION": "Калькулятор любви", "DESCRIPTION": "Калькулятор любви",
"USAGE": "lovecalc [@пользователь1] (@пользователь2)", "USAGE": "lovecalc [@пользователь1] (@пользователь2)",
"EXAMPLES": "lovecalc @Jonny_Bro#4226\nlovecalc @Jonny_Bro#4226 @JaBa#9042", "EXAMPLES": "lovecalc @Jonny_Bro#4226\nlovecalc @Jonny_Bro#4226 @JaBa#9042",
"MISSING": "Вы должны упомянуть одного или двух пользователей!", "CONTENT": "**{{firstMember}}** любит **{{secondMember}}** на **{{percent}}%**!"
"CONTENT": "Я думаю, что **{{firstUsername}}** на **{{percent}}%** любит **{{secondUsername}}**!"
} }

View file

@ -1,5 +1,5 @@
{ {
"DESCRIPTION": "Получить мем с выбранного или случайного сабреддита", "DESCRIPTION": "Получить мем с выбранного сабреддита",
"USAGE": "memes (тег)", "USAGE": "memes (тег)",
"EXAMPLES": "memes\nmemes me_irl", "EXAMPLES": "memes\nmemes me_irl",
"SEARCHING": "Ищу мем по тегу `{{tag}}`...", "SEARCHING": "Ищу мем по тегу `{{tag}}`...",

View file

@ -1,10 +0,0 @@
{
"DESCRIPTION": "Получить ссылку на приглашение JaBa!",
"USAGE": "invite (copy)",
"EXAMPLES": "invite\ninvite copy",
"LINKS": "Ссылки JaBa",
"CLICK": "[**Тык**]({{link}})",
"TIP": "Отправьте `invite copy`, чтобы получить ссылку для копирования!",
"ADD": "Пригласить JaBa",
"SUPPORT": "Поддержать разработчика"
}

View file

@ -1,13 +0,0 @@
{
"DESCRIPTION": "Показать кол-во пользователей которых пользователь пригласил на сервер!",
"USAGE": "invites (@пользователь)",
"EXAMPLES": "invites\ninvites @Jonny_Bro#4226",
"NOBODY_AUTHOR": "Вы никого не пригласили на сервер!",
"NOBODY_MEMBER": "{{member}} никого не приглашал(а) на сервер!",
"CODE": "**{{code}}** ({{uses}} использований) | {{channel}}",
"TITLE": "Информация о {{member}} на сервере {{guild}}",
"FIELD_INVITED": "👥 Приглашённых участников",
"FIELD_CODES": "🔑 Коды",
"FIELD_MEMBERS": "{{total}} участников",
"TRACKER": "Отслеживание приглашений"
}

View file

@ -1,9 +0,0 @@
{
"DESCRIPTION": "Перевести текст!",
"USAGE": "translate [язык] [текст]",
"EXAMPLES": "translate english Как дела?",
"LIST_SENT": "Список языков отправлен вам в ЛС!",
"MISSING_LANGUAGE": "Укажите язык! Чтобы получить список языков, введите `translate langs-list`!",
"INVALID_LANGUAGE": "Язык `{{search}}` не найден! Чтобы получить список языков, введите `translate langs-list`!",
"MISSING_CONTENT": "Введите текст!"
}

View file

@ -1,6 +1,5 @@
{ {
"ERR_OCCURRED": "Что-то пошло не так... Попробуйте позже!", "ERR_OCCURRED": "Что-то пошло не так... Попробуйте позже!",
"PLEASE_WAIT": "Подождите...",
"COMMAND_DISABLED": "Эта команда на данный момент отключена!", "COMMAND_DISABLED": "Эта команда на данный момент отключена!",
"CLICK_HERE": "Нажмите сюда, чтобы начать {{activity}} в {{channel}}", "CLICK_HERE": "Нажмите сюда, чтобы начать {{activity}} в {{channel}}",
"TIMES_UP": "Время вышло! Используйте команду снова!", "TIMES_UP": "Время вышло! Используйте команду снова!",
@ -26,51 +25,6 @@
"COOLDOWNED": "Подождите **{{seconds}}**, чтобы снова использовать эту команду!", "COOLDOWNED": "Подождите **{{seconds}}**, чтобы снова использовать эту команду!",
"CANNOT_DM": "Я не могу отправить вам личное сообщение... Проверьте свои настройки конфиденциальности!", "CANNOT_DM": "Я не могу отправить вам личное сообщение... Проверьте свои настройки конфиденциальности!",
"PERMISSIONS": {
"CREATE_INSTANT_INVITE": "Создание приглашения",
"KICK_MEMBERS": "Выгонять участников",
"BAN_MEMBERS": "Банить участников",
"ADMINISTRATOR": "Администратор",
"MANAGE_CHANNELS": "Управлять каналами",
"MANAGE_GUILD": "Управлять сервером",
"ADD_REACTIONS": "Добавлять реакции",
"VIEW_AUDIT_LOG": "Просматривать журнал аудита",
"PRIORITY_SPEAKER": "Приоритетный режим",
"STREAM": "Видео",
"VIEW_CHANNEL": "Просматривать каналы",
"SEND_MESSAGES": "Отправлять сообщения",
"SEND_TTS_MESSAGES": "Отправка сообщений text-to-speech",
"MANAGE_MESSAGES": "Управлять сообщениями",
"EMBED_LINKS": "Встраивать ссылки",
"ATTACH_FILES": "Прикреплять файлы",
"READ_MESSAGE_HISTORY": "Читать историю сообщений",
"MENTION_EVERYONE": "Упоминание *@*everyone, *@*here и всех ролей",
"USE_EXTERNAL_EMOJIS": "Использовать внешние эмодзи",
"VIEW_GUILD_INSIGHTS": "Просматривать статистику сервера",
"CONNECT": "Подключаться",
"SPEAK": "Говорить",
"MUTE_MEMBERS": "Отключать участникам микрофон",
"DEAFEN_MEMBERS": "Отключать участникам звук",
"MOVE_MEMBERS": "Перемещать участников",
"USE_VAD": "Использовать режим активации по голосу",
"CHANGE_NICKNAME": "Изменить никнейм",
"MANAGE_NICKNAMES": "Управлять никнеймами",
"MANAGE_ROLES": "Управлять ролями",
"MANAGE_WEBHOOKS": "Управлять вебхуками (webhooks)",
"MANAGE_EMOJIS_AND_STICKERS": "Управлять эмодзи и стикерами",
"USE_APPLICATION_COMMANDS": "Использовать команды приложения",
"MANAGE_EVENTS": "Управление событиями",
"MANAGE_THREADS": "Управление ветками",
"USE_PUBLIC_THREADS": "Использовать публичные ветки",
"CREATE_PUBLIC_THREADS": "Создать публичные ветки",
"USE_PRIVATE_THREADS": "Использование приватных веток",
"CREATE_PRIVATE_THREADS": "Создание приватных веток",
"USE_EXTERNAL_STICKERS": "Использовать внешние стикеры",
"SEND_MESSAGES_IN_THREADS": "Отправлять сообщения в ветках",
"START_EMBEDDED_ACTIVITIES": "Начать активность",
"MODERATE_MEMBERS": "Отправить участников подумать о своём поведении"
},
"NOUNS": { "NOUNS": {
"CREDIT": { "CREDIT": {
"1": "кредит", "1": "кредит",

View file

@ -1,13 +0,0 @@
{
"DESCRIPTION": "Забанить пользователя на сервере!",
"USAGE": "ban [@пользователь] (причина)",
"EXAMPLES": "ban @Jonny_Bro#4226 Спам",
"MISSING_MEMBER": "Вы должны упомянуть пользователя!",
"YOURSELF": "Вы не можете забанить себя!",
"SUPERIOR": "Вы не можете сделать это, т.к. пользователь стоит выше вас по роли!",
"ALREADY_BANNED": "**{{username}}** уже в бане!",
"MISSING_PERM": "Произошла ошибка... Проверьте, есть ли у вас право банить пользователей и попробуйте снова!",
"BANNED_DM": "Привет {{username}},\nвы были забанены на сервере **{{server}}** пользователем **{{moderator}}** по причине **{{reason}}**!",
"BANNED": "**{{username}}** был забанен на сервере **{{server}}** пользователем **{{moderator}}** по причине **{{reason}}**!",
"CASE": "Бан | Номер #{{count}}"
}

View file

@ -1,11 +0,0 @@
{
"DESCRIPTION": "Кикнуть пользователя!",
"USAGE": "kick [@пользователь] (причина)",
"EXAMPLES": "kick @Jonny_Bro#4226 Спам",
"MISSING_MEMBER": "Вы должны упомянуть пользователя!",
"YOURSELF": "Вы не можете кикнуть себя!",
"MISSING_PERM": "Произошла ошибка... Проверьте, есть ли у вас право кикать пользователей и попробуйте снова!",
"KICKED_DM": "Привет {{username}},\nвы были кикнуты с сервера **{{server}}** пользователем **{{moderator}}** по причине **{{reason}}**!",
"KICKED": "**{{username}}** был кикнут с сервера **{{server}}** пользователем **{{moderator}}** по причине **{{reason}}**!",
"CASE": "Кик | Номер #{{count}}"
}

View file

@ -1,10 +0,0 @@
{
"DESCRIPTION": "Запретить пользователю писать сообщения и заходить в голосовые каналы!",
"USAGE": "mute [@пользователь] [время] (причина)",
"EXAMPLES": "mute @Jonny_Bro#4226 24h Спам",
"MISSING_MEMBER": "Вы должны упомянуть пользователя!",
"YOURSELF": "Вы не можете замутить себя!",
"MUTED_DM": "Привет {{username}},\nвы были замучены на сервере **{{server}}** пользователем **{{moderator}}** на **{{time}}** по причине **{{reason}}**!",
"MUTED": "**{{username}}** замучен на **{{time}}** по причине **{{reason}}**!",
"CASE": "Мут | Номер #{{count}}"
}

View file

@ -1,9 +0,0 @@
{
"DESCRIPTION": "Размутить пользователя!",
"USAGE": "unmute [@пользователь]",
"EXAMPLES": "unmute @Jonny_Bro#4226",
"MISSING_MEMBER": "Вы должны упомянуть пользователя!",
"NOT_MUTED": "**{{username}}** не замучен на данном сервере!",
"SUCCESS": "**{{username}}** был размучен на данном сервере!",
"SUCCESS_CASE": "{{user}} (`{{usertag}}`) размучен! (Номер #{{count}})"
}

View file

@ -2,7 +2,5 @@
"DESCRIPTION": "Найти NSFW изображение по тэгу", "DESCRIPTION": "Найти NSFW изображение по тэгу",
"USAGE": "nsfw", "USAGE": "nsfw",
"EXAMPLES": "nsfw", "EXAMPLES": "nsfw",
"AVAILABLE_CATEGORIES": "Доступные категории:",
"NOTHING_SELECTED": "Ничего не выбрано",
"TAG": "Тэг" "TAG": "Тэг"
} }

View file

@ -1,5 +1,5 @@
{ {
"DESCRIPTION": "Выполнить код", "DESCRIPTION": "Выполнить код",
"USAGE": "[код]", "CODE": "Выполняемый код",
"EXAMPLES": "eval interaction.channel.send({ content: \"Hello World!\" })" "EXAMPLES": "eval interaction.channel.send({ content: \"Hello World!\" })"
} }

View file

@ -1,6 +1,6 @@
{ {
"DESCRIPTION": "Перезагрузить команду!", "DESCRIPTION": "Перезагрузить команду!",
"USAGE": "reload", "COMMAND": "Команда",
"EXAMPLES": "reload help", "EXAMPLES": "reload help",
"NOT_FOUND": "Команды `{{search}}` не существует!", "NOT_FOUND": "Команды `{{search}}` не существует!",
"SUCCESS": "Команда `{{command}}` успешно перезагружена!" "SUCCESS": "Команда `{{command}}` успешно перезагружена!"

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