Рефакторинг

This commit is contained in:
JonnyBro 2021-12-11 01:11:50 +05:00
parent aefb17ebcb
commit beb4a7e6af
73 changed files with 499 additions and 1199 deletions

View file

@ -80,7 +80,7 @@ class Backup extends Command {
// Displays the server from which this backup comes // Displays the server from which this backup comes
.addField(message.translate("administration/backup:TITLE_SERVER_ID"), backupInfos.data.guildID, true) .addField(message.translate("administration/backup:TITLE_SERVER_ID"), backupInfos.data.guildID, true)
// Display the size (in mb) of the backup // Display the size (in mb) of the backup
.addField(message.translate("administration/backup:TITLE_SIZE"), backupInfos.size+" mb", true) .addField(message.translate("administration/backup:TITLE_SIZE"), `${backupInfos.size}mb`, true)
// Display when the backup was created // Display when the backup was created
.addField(message.translate("administration/backup:TITLE_CREATED_AT"), message.printDate(new Date(backupInfos.data.createdTimestamp)), true) .addField(message.translate("administration/backup:TITLE_CREATED_AT"), message.printDate(new Date(backupInfos.data.createdTimestamp)), true)
.setColor(data.config.embed.color) .setColor(data.config.embed.color)

View file

@ -19,7 +19,7 @@ class Setlang extends Command {
async run (message, args, data) { async run (message, args, data) {
const language = this.client.languages.find((l) => l.name === args[0] || l.aliases.includes(args[0])); const language = this.client.languages.find((l) => l.name === args[0] || l.aliases.includes(args[0]));
if (!args[0] || !language) return message.error("administration/setlang:MISSING_LANG", { list: this.client.languages.map((l) => "`"+l.name+"`").join(", ") }); if (!args[0] || !language) return message.error("administration/setlang:MISSING_LANG", { list: this.client.languages.map((l) => `\`${l.name}\``).join(", ") });
data.guild.language = language.name; data.guild.language = language.name;
await data.guild.save(); await data.guild.save();

View file

@ -34,7 +34,7 @@ class Birthdate extends Command {
const d = new Date(tyear, tmonth, tday); const d = new Date(tyear, tmonth, tday);
if (!(tday == d.getDate() && tmonth == d.getMonth() && tyear == d.getFullYear())) return message.error("economy/birthdate:INVALID_DATE_FORMAT"); if (!(tday == d.getDate() && tmonth == d.getMonth() && tyear == d.getFullYear())) return message.error("economy/birthdate:INVALID_DATE_FORMAT");
if (d.getTime() > Date.now()) return message.error("economy/birthdate:DATE_TOO_HIGH"); if (d.getTime() > Date.now()) return message.error("economy/birthdate:DATE_TOO_HIGH");
if (d.getTime() < (Date.now()-2.523e+12))return message.error("economy/birthdate:DATE_TOO_LOW"); if (d.getTime() < (Date.now() - 2.523e+12))return message.error("economy/birthdate:DATE_TOO_LOW");
data.userData.birthdate = d; data.userData.birthdate = d;
data.userData.save(); data.userData.save();

View file

@ -28,14 +28,14 @@ class Leaderboard extends Command {
membersLeaderboard = members.map((m) => { membersLeaderboard = members.map((m) => {
return { return {
id: m.id, id: m.id,
value: m.money+m.bankSold value: m.money + m.bankSold
}; };
}).sort((a,b) => b.value - a.value); }).sort((a,b) => b.value - a.value);
const table = new AsciiTable("LEADERBOARD"); const table = new AsciiTable("LEADERBOARD");
table.setHeading("#", message.translate("common:USER"), message.translate("common:CREDITS")); table.setHeading("#", message.translate("common:USER"), message.translate("common:CREDITS"));
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
const newTable = await fetchUsers(membersLeaderboard, table, this.client); const newTable = await fetchUsers(membersLeaderboard, table, this.client);
message.channel.send("```\n"+newTable.toString()+"```"); message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``);
} else if (type === "level") { } else if (type === "level") {
const members = await this.client.membersData.find({ guildID: message.guild.id }).lean(), const members = await this.client.membersData.find({ guildID: message.guild.id }).lean(),
membersLeaderboard = members.map((m) => { membersLeaderboard = members.map((m) => {
@ -48,7 +48,7 @@ class Leaderboard extends Command {
table.setHeading("#", message.translate("common:USER"), message.translate("common:LEVEL")); table.setHeading("#", message.translate("common:USER"), message.translate("common:LEVEL"));
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
const newTable = await fetchUsers(membersLeaderboard, table, this.client); const newTable = await fetchUsers(membersLeaderboard, table, this.client);
message.channel.send("```\n"+newTable.toString()+"```"); message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``);
} else if (type === "rep") { } else if (type === "rep") {
const users = await this.client.usersData.find().lean(), const users = await this.client.usersData.find().lean(),
usersLeaderboard = users.map((u) => { usersLeaderboard = users.map((u) => {
@ -61,7 +61,7 @@ class Leaderboard extends Command {
table.setHeading("#", message.translate("common:USER"), message.translate("common:POINTS")); table.setHeading("#", message.translate("common:USER"), message.translate("common:POINTS"));
if (usersLeaderboard.length > 20) usersLeaderboard.length = 20; if (usersLeaderboard.length > 20) usersLeaderboard.length = 20;
const newTable = await fetchUsers(usersLeaderboard, table, this.client); const newTable = await fetchUsers(usersLeaderboard, table, this.client);
message.channel.send("```\n"+newTable.toString()+"```"); message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``);
}; };
if (isOnlyOnMobile) message.sendT("economy/leaderboard:MOBILE"); if (isOnlyOnMobile) message.sendT("economy/leaderboard:MOBILE");

View file

@ -77,7 +77,7 @@ class FindWords extends Command {
message.success("fun/findwords:WORD_FOUND", { winner: `<@${reason}>` }); message.success("fun/findwords:WORD_FOUND", { winner: `<@${reason}>` });
winners.push(reason); winners.push(reason);
} }
if (i < nbGames-1) { if (i < nbGames - 1) {
i++; i++;
generateGame.call(this, words[i]); generateGame.call(this, words[i]);
} else { } else {

View file

@ -44,7 +44,7 @@ class Number extends Command {
const parsedNumber = parseInt(msg.content, 10); const parsedNumber = parseInt(msg.content, 10);
if (parsedNumber === number) { if (parsedNumber === number) {
const time = this.client.functions.convertTime(message.guild, Date.now()-gameCreatedAt); const time = this.client.functions.convertTime(message.guild, Date.now() - gameCreatedAt);
message.sendT("fun/number:GAME_STATS", { winner: msg.author.toString(), number, time, participantCount: participants.length, participants: participants.map(p => `<@${p}>`).join("\n") }); message.sendT("fun/number:GAME_STATS", { winner: msg.author.toString(), number, time, participantCount: participants.length, participants: participants.map(p => `<@${p}>`).join("\n") });
message.sendT("fun/number:WON", { winner: msg.author.toString() }); message.sendT("fun/number:WON", { winner: msg.author.toString() });
const userdata = await this.client.findOrCreateMember({ id: msg.author.id, guildID: message.guild.id }); const userdata = await this.client.findOrCreateMember({ id: msg.author.id, guildID: message.guild.id });

View file

@ -6,7 +6,7 @@ class Invite extends Command {
super(client, { super(client, {
name: "invite", name: "invite",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: false,
guildOnly: false, guildOnly: false,
aliases: [ "i", "add", "vote" ], aliases: [ "i", "add", "vote" ],
memberPermissions: [], memberPermissions: [],

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Setafk extends Command { class Setafk extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "setafk", name: "setafk",
@ -17,22 +16,15 @@ class Setafk extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const reason = args.join(" "); const reason = args.join(" ");
if(!reason){ if (!reason) return message.error("general/setafk:MISSING_REASON");
return message.error("general/setafk:MISSING_REASON");
}
// Send success message // Send success message
message.success("general/setafk:SUCCESS", { message.success("general/setafk:SUCCESS", { reason });
reason
});
data.userData.afk = reason; data.userData.afk = reason;
data.userData.save(); data.userData.save();
} }
};
}
module.exports = Setafk; module.exports = Setafk;

View file

@ -3,7 +3,6 @@ const Command = require("../../base/Command.js"),
fetch = require("node-fetch"); fetch = require("node-fetch");
class ShortURL extends Command { class ShortURL extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "shorturl", name: "shorturl",
@ -21,25 +20,19 @@ class ShortURL extends Command {
async run (message, args, data) { async run (message, args, data) {
const url = args[0]; const url = args[0];
if(!url){ if (!url) return message.error("general/shorturl:MISSING_URL");
return message.error("general/shorturl:MISSING_URL");
}
const res = await fetch(`https://is.gd/create.php?format=simple&url=${encodeURI(url)}`); const res = await fetch(`https://is.gd/create.php?format=simple&url=${encodeURI(url)}`);
const body = await res.text(); const body = await res.text();
if(body === "Error: Please enter a valid URL to shorten"){ if (body === "Error: Please enter a valid URL to shorten") return message.error("general/shorturl:MISSING_URL");
return message.error("general/shorturl:MISSING_URL");
}
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer) .setFooter(data.config.embed.footer)
.setDescription(body); .setDescription(body);
message.channel.send(embed); message.channel.send(embed);
} }
};
}
module.exports = ShortURL; module.exports = ShortURL;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Someone extends Command { class Someone extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "someone", name: "someone",
@ -19,7 +18,6 @@ class Someone extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const member = message.guild.members.cache.random(1)[0]; const member = message.guild.members.cache.random(1)[0];
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
@ -29,9 +27,7 @@ class Someone extends Command {
.setThumbnail(member.user.displayAvatarURL({ size: 512, dynamic: true, format: 'png' })) .setThumbnail(member.user.displayAvatarURL({ size: 512, dynamic: true, format: 'png' }))
.setColor(data.config.embed.color); .setColor(data.config.embed.color);
message.channel.send(embed); message.channel.send(embed);
} }
};
}
module.exports = Someone; module.exports = Someone;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Staff extends Command { class Staff extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "staff", name: "staff",
@ -23,16 +22,13 @@ class Staff extends Command {
const administrators = message.guild.members.cache.filter((m) => m.hasPermission("ADMINISTRATOR") && !m.user.bot); const administrators = message.guild.members.cache.filter((m) => m.hasPermission("ADMINISTRATOR") && !m.user.bot);
const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.hasPermission("MANAGE_MESSAGES") && !m.user.bot); const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.hasPermission("MANAGE_MESSAGES") && !m.user.bot);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/staff:TITLE", { .setAuthor(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) => `${this.client.customEmojis.status[a.presence.status]} | ${a.user.tag}`).join("\n") :message.translate("general/staff:NO_ADMINS"))) .addField(message.translate("general/staff:ADMINS"), (administrators.size > 0 ? administrators.map((a) => `${this.client.customEmojis.status[a.presence.status]} | ${a.user.tag}`).join("\n") :message.translate("general/staff:NO_ADMINS")))
.addField(message.translate("general/staff:MODS"), (moderators.size > 0 ? moderators.map((m) => `${this.client.customEmojis.status[m.presence.status]} | ${m.user.tag}`).join("\n") : message.translate("general/staff:NO_MODS"))) .addField(message.translate("general/staff:MODS"), (moderators.size > 0 ? moderators.map((m) => `${this.client.customEmojis.status[m.presence.status]} | ${m.user.tag}`).join("\n") : message.translate("general/staff:NO_MODS")))
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
message.channel.send(embed); message.channel.send(embed);
} }
};
}
module.exports = Staff; module.exports = Staff;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Stats extends Command { class Stats extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "stats", name: "stats",
@ -19,43 +18,27 @@ class Stats extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const statsEmbed = new Discord.MessageEmbed() const statsEmbed = new Discord.MessageEmbed()
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer) .setFooter(data.config.embed.footer)
.setAuthor(message.translate("common:STATS")) .setAuthor(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", { .addField(this.client.customEmojis.stats+" "+message.translate("general/stats:COUNTS_TITLE"), message.translate("general/stats:COUNTS_CONTENT", { servers: this.client.guilds.cache.size, users: this.client.users.cache.size }), true)
servers: this.client.guilds.cache.size,
users: this.client.users.cache.size
}), true)
.addField(this.client.customEmojis.version+" "+message.translate("general/stats:VERSIONS_TITLE"), `\`Discord.js : v${Discord.version}\`\n\`Nodejs : v${process.versions.node}\``, true) .addField(this.client.customEmojis.version+" "+message.translate("general/stats:VERSIONS_TITLE"), `\`Discord.js : v${Discord.version}\`\n\`Nodejs : v${process.versions.node}\``, 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.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", { .addField(this.client.customEmojis.status.online+" "+message.translate("general/stats:ONLINE_TITLE"), message.translate("general/stats:ONLINE_CONTENT", { time: message.convertTime(Date.now()+this.client.uptime, "from", true) }))
time: message.convertTime(Date.now()+this.client.uptime, "from", true) .addField(this.client.customEmojis.voice+" "+message.translate("general/stats:MUSIC_TITLE"), message.translate("general/stats:MUSIC_CONTENT", { count: this.client.voice.connections.size }))
}))
.addField(this.client.customEmojis.voice+" "+message.translate("general/stats:MUSIC_TITLE"), message.translate("general/stats:MUSIC_CONTENT", {
count: this.client.voice.connections.size
}))
.addField(message.translate("general/stats:CREDITS_TITLE"), message.translate("general/stats:CREDITS_CONTENT", { .addField(message.translate("general/stats:CREDITS_TITLE"), message.translate("general/stats:CREDITS_CONTENT", {
donators: [ ":(" ].join("\n"), donators: [ ":(" ].join("\n"),
translators: [ "`Jonny_Bro#4226` (:flag_ru:)", "`[ДАННЫЕ УДАЛЕНЫ]#2789` (:flag_ua:)" ].join("\n") translators: [ "`Jonny_Bro#4226` (:flag_ru:)", "`[ДАННЫЕ УДАЛЕНЫ]#2789` (:flag_ua:)" ].join("\n")
})); }));
statsEmbed.addField(this.client.customEmojis.link+" "+message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", { statsEmbed.addField(this.client.customEmojis.link+" "+message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", {
donateLink: "", dashboardLink: "https://jaba.pp.ua",
dashboardLink: "", donateLink: "https://qiwi.com/n/JONNYBRO"
inviteLink: await this.client.generateInvite({ }));
permissions: ["ADMINISTRATOR"]
}),
githubLink: "https://github.com/Androz2091",
supportLink: ""
})
);
message.channel.send(statsEmbed); message.channel.send(statsEmbed);
} }
};
}
module.exports = Stats; module.exports = Stats;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Suggest extends Command { class Suggest extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "suggest", name: "suggest",
@ -19,21 +18,14 @@ class Suggest extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const suggChannel = message.guild.channels.cache.get(data.guild.plugins.suggestions); const suggChannel = message.guild.channels.cache.get(data.guild.plugins.suggestions);
if(!suggChannel){ if (!suggChannel) return message.error("general/suggest:MISSING_CHANNEL");
return message.error("general/suggest:MISSING_CHANNEL");
}
const sugg = args.join(" "); const sugg = args.join(" ");
if(!sugg){ if (!sugg) return message.error("general/suggest:MISSING_CONTENT");
return message.error("general/suggest:MISSING_CONTENT");
}
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/suggest:TITLE", { .setAuthor(message.translate("general/suggest:TITLE", { user: message.author.username }), message.author.displayAvatarURL({ size: 512, dynamic: true, format: 'png' }))
user: message.author.username
}), message.author.displayAvatarURL({ size: 512, dynamic: true, format: 'png' }))
.addField(message.translate("common:AUTHOR"), `\`${message.author.username}#${message.author.discriminator}\``, true) .addField(message.translate("common:AUTHOR"), `\`${message.author.username}#${message.author.discriminator}\``, true)
.addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true) .addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true)
.addField(message.translate("common:CONTENT"), "**"+sugg+"**") .addField(message.translate("common:CONTENT"), "**"+sugg+"**")
@ -48,11 +40,8 @@ class Suggest extends Command {
await m.react(error); await m.react(error);
}); });
message.success("general/suggest:SUCCESS", { message.success("general/suggest:SUCCESS", { channel: suggChannel.toString() });
channel: suggChannel.toString()
});
} }
};
}
module.exports = Suggest; module.exports = Suggest;

View file

@ -5,7 +5,6 @@ const Command = require("../../base/Command.js"),
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"]; 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 { class Translate extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "translate", name: "translate",
@ -22,47 +21,28 @@ class Translate extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
if (args[0] === "langs-list") {
if(args[0] === "langs-list"){ const langsList = "```css\n"+(langs.map((l, i) => `#${i+1} - ${l}`).join("\n"))+"```";
const langsList = "```Css\n"+(langs.map((l, i) => `#${i+1} - ${l}`).join("\n"))+"```";
message.author.send(langsList).then(() => { message.author.send(langsList).then(() => {
message.success("general/translate:LIST_SENT"); message.success("general/translate:LIST_SENT");
}).catch(() => { }).catch(() => {
message.error("misc:CANNOT_DM"); message.error("misc:CANNOT_DM");
}); });
return; return;
} };
const pWait = await message.sendT("misc:PLEASE_WAIT", null, { const pWait = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
if(!args[0]){ if (!args[0]) return pWait.error("general/translate:MISSING_LANGUAGE", { prefix: data.guild.prefix }, { edit: true });
return pWait.error("general/translate:MISSING_LANGUAGE", {
prefix: data.guild.prefix
}, {
edit: true
});
}
if(!args[1]){
return pWait.error("general/translate:MISSING_CONTENT", null, { if (!args[1]) return pWait.error("general/translate:MISSING_CONTENT", null, { edit: true });
edit: true
});
}
// Gets different args // Gets different args
const language = args[0].toLowerCase(); const language = args[0].toLowerCase();
const toTranslate = args.slice(1).join(" "); const toTranslate = args.slice(1).join(" ");
if(!langs.includes(language)){ if (!langs.includes(language)) return pWait.error("general/translate:INVALID_LANGUAGE", { prefix: data.guild.prefix, search: language}, { edit: true });
return pWait.error("general/translate:INVALID_LANGUAGE", {
prefix: data.guild.prefix,
search: language
}, {
edit: true
});
}
const translated = await translate(toTranslate, { to: language }); const translated = await translate(toTranslate, { to: language });
@ -74,9 +54,7 @@ class Translate extends Command {
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
return pWait.edit("", { embed: resEmbed }); return pWait.edit("", { embed: resEmbed });
} }
};
}
module.exports = Translate; module.exports = Translate;

View file

@ -3,7 +3,6 @@ const Command = require("../../base/Command.js"),
fetch = require("node-fetch"); fetch = require("node-fetch");
class Userinfo extends Command { class Userinfo extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "userinfo", name: "userinfo",
@ -20,34 +19,26 @@ class Userinfo extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
let displayPresence = true; let displayPresence = true;
const isID = !isNaN(args[0]); const isID = !isNaN(args[0]);
var user; var user;
if(!args[0]){ if (!args[0]) user = message.author;
user = message.author; if (message.mentions.users.first()) user = message.mentions.users.first();
}
if(message.mentions.users.first()){ if (isID && !user) {
user = message.mentions.users.first();
}
if(isID && !user){
user = this.client.users.cache.get(args[0]); user = this.client.users.cache.get(args[0]);
if(!user){ if (!user) {
user = await this.client.users.fetch(args[0], true).catch(() => {}); user = await this.client.users.fetch(args[0], true).catch(() => {});
displayPresence = false; displayPresence = false;
} };
} };
if(!user){ if (!user) return message.error("general/userinfo:INVALID_USER");
return message.error("general/userinfo:INVALID_USER");
}
let member = null; let member = null;
if(message.guild){ if (message.guild) member = await message.guild.members.fetch(user).catch(() => {});
member = await message.guild.members.fetch(user).catch(() => {});
}
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(user.tag, user.displayAvatarURL({ size: 512, dynamic: true, format: 'png' })) .setAuthor(user.tag, user.displayAvatarURL({ size: 512, dynamic: true, format: 'png' }))
@ -60,29 +51,25 @@ class Userinfo extends Command {
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
if(displayPresence){ if (displayPresence) {
embed.addField(this.client.customEmojis.games+" "+message.translate("common:GAME"), (user.presence.activity ? user.presence.activity.name : message.translate("general/userinfo:NO_GAME")), true) embed.addField(this.client.customEmojis.games+" "+message.translate("common:GAME"), (user.presence.activity ? user.presence.activity.name : message.translate("general/userinfo:NO_GAME")), true)
.addField(this.client.customEmojis.status.online+" "+message.translate("common:STATUS"), message.translate("common:STATUS_"+(user.presence.status.toUpperCase())), true); embed.addField(this.client.customEmojis.status.online+" "+message.translate("common:STATUS"), message.translate("common:STATUS_"+(user.presence.status.toUpperCase())), true);
} };
if(member){ if (member) {
embed.addField(this.client.customEmojis.up+" "+message.translate("common:ROLE"), (member.roles.highest ? member.roles.highest : message.translate("general/userinfo:NO_ROLE")), true) embed.addField(this.client.customEmojis.up+" "+message.translate("common:ROLE"), (member.roles.highest ? member.roles.highest : message.translate("general/userinfo:NO_ROLE")), true)
.addField(this.client.customEmojis.calendar2+" "+message.translate("common:JOIN"), message.printDate(member.joinedAt),true) embed.addField(this.client.customEmojis.calendar2+" "+message.translate("common:JOIN"), message.printDate(member.joinedAt),true)
.addField(this.client.customEmojis.color+" "+message.translate("common:COLOR"), member.displayHexColor, true) embed.addField(this.client.customEmojis.color+" "+message.translate("common:COLOR"), member.displayHexColor, true)
.addField(this.client.customEmojis.pencil+" "+message.translate("common:NICKNAME"), (member.nickname ? member.nickname : message.translate("general/userinfo:NO_NICKNAME")), true) embed.addField(this.client.customEmojis.pencil+" "+message.translate("common:NICKNAME"), (member.nickname ? member.nickname : message.translate("general/userinfo:NO_NICKNAME")), true)
.addField(this.client.customEmojis.roles+" "+message.translate("common:ROLES"), ( 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", { 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.size > 10 };
? member.roles.cache.map((r) => r).slice(0, 9).join(", ")+" "+message.translate("general/userinfo:MORE_ROLES", { count: member.roles.cache.size - 10 })
: (member.roles.cache.size < 1) ? message.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", ")
));
}
if(user.bot && this.client.config.apiKeys.dbl && (this.client.config.apiKeys.dbl !== "")){ if (user.bot && this.client.config.apiKeys.dbl && (this.client.config.apiKeys.dbl !== "")) {
const res = await fetch("https://discordbots.org/api/bots/"+user.id, { const res = await fetch("https://discordbots.org/api/bots/"+user.id, {
headers: { "Authorization": this.client.config.apiKeys.dbl } headers: { "Authorization": this.client.config.apiKeys.dbl }
}); });
const data = await res.json(); const data = await res.json();
if(!data.error){ if (!data.error) {
embed.addField(this.client.customEmojis.desc+" "+message.translate("common:DESCRIPTION"), data.shortdesc, true) embed.addField(this.client.customEmojis.desc+" "+message.translate("common:DESCRIPTION"), data.shortdesc, true)
.addField(this.client.customEmojis.stats+" "+message.translate("common:STATS"), message.translate("general/userinfo:BOT_STATS", { .addField(this.client.customEmojis.stats+" "+message.translate("common:STATS"), message.translate("general/userinfo:BOT_STATS", {
votes: data.monthlyPoints || 0, votes: data.monthlyPoints || 0,
@ -90,15 +77,12 @@ class Userinfo extends Command {
shards: (data.shards || [0]).length, shards: (data.shards || [0]).length,
lib: data.lib || "unknown" lib: data.lib || "unknown"
}), true) }), true)
.addField(this.client.customEmojis.link+" "+message.translate("common:LINKS"), .addField(this.client.customEmojis.link+" "+message.translate("common:LINKS"), `${data.support ? `[${message.translate("common:SUPPORT")}](${data.support}) | ` : ""}${data.invite ? `[${message.translate("common:INVITE")}](${data.invite}) | ` : ""}${data.github ? `[GitHub](${data.github}) | ` : ""}${data.website ? `[${message.translate("common:WEBSITE")}](${data.website})` : ""}`, true);
`${data.support ? `[${message.translate("common:SUPPORT")}](${data.support}) | ` : ""}${data.invite ? `[${message.translate("common:INVITE")}](${data.invite}) | ` : ""}${data.github ? `[GitHub](${data.github}) | ` : ""}${data.website ? `[${message.translate("common:WEBSITE")}](${data.website})` : ""}` };
, true); };
}
}
message.channel.send(embed); message.channel.send(embed);
} }
};
}
module.exports = Userinfo; module.exports = Userinfo;

View file

@ -18,18 +18,13 @@ class Approved extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("approved", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("approved", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "approved.png"); const attachment = new Discord.MessageAttachment(buffer, "approved.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Approved; module.exports = Approved;

View file

@ -18,16 +18,13 @@ class Avatar extends Command {
} }
async run (message, args) { async run (message, args) {
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({ size: 512, dynamic: true, format: 'png' }); const avatarURL = user.displayAvatarURL({ size: 512, dynamic: true, format: 'png' });
if(message.content.includes("-v")) message.channel.send("<"+avatarURL+">"); if (message.content.includes("-v")) message.channel.send("<"+avatarURL+">");
const attachment = new Discord.MessageAttachment(avatarURL, `avatar.${avatarURL.split(".").pop().split("?")[0]}`); const attachment = new Discord.MessageAttachment(avatarURL, `avatar.${avatarURL.split(".").pop().split("?")[0]}`);
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Avatar; module.exports = Avatar;

View file

@ -18,21 +18,16 @@ class BatSlap extends Command {
} }
async run (message, args) { async run (message, args) {
const users = [ const users = [
await this.client.resolveUser(args[0]) || message.author, await this.client.resolveUser(args[0]) || message.author,
await this.client.resolveUser(args[1]) || message.author await this.client.resolveUser(args[1]) || message.author
]; ];
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("batslap", { avatar: users[0].displayAvatarURL({ format: "png", size: 512 }), url: users[1].displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("batslap", { avatar: users[0].displayAvatarURL({ format: "png", size: 512 }), url: users[1].displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "batslap.png"); const attachment = new Discord.MessageAttachment(buffer, "batslap.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = BatSlap; module.exports = BatSlap;

View file

@ -18,18 +18,13 @@ class Beautiful extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("beautiful", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("beautiful", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "beautiful.png"); const attachment = new Discord.MessageAttachment(buffer, "beautiful.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Beautiful; module.exports = Beautiful;

View file

@ -19,15 +19,12 @@ class Bed extends Command {
} }
async run (message, args) { async run (message, args) {
const users = [ const users = [
await this.client.resolveUser(args[0]) || message.author, await this.client.resolveUser(args[0]) || message.author,
await this.client.resolveUser(args[1]) || message.author await this.client.resolveUser(args[1]) || message.author
]; ];
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
try { try {
const buffer = await canvacord.Canvas.bed(users[0].displayAvatarURL({ format: "png" }), users[1].displayAvatarURL({ format: "png" })); const buffer = await canvacord.Canvas.bed(users[0].displayAvatarURL({ format: "png" }), users[1].displayAvatarURL({ format: "png" }));
const attachment = new Discord.MessageAttachment(buffer, "bed.png"); const attachment = new Discord.MessageAttachment(buffer, "bed.png");
@ -35,13 +32,9 @@ class Bed extends Command {
m.delete(); m.delete();
} catch(e){ } catch(e){
console.log(e); console.log(e);
m.error("misc:ERROR_OCCURRED", null, { m.error("misc:ERROR_OCCURRED", null, { edit: true });
edit: true };
});
} }
};
}
}
module.exports = Bed; module.exports = Bed;

View file

@ -18,18 +18,13 @@ class Brazzers extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("brazzers", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("brazzers", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "brazzers.png"); const attachment = new Discord.MessageAttachment(buffer, "brazzers.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Brazzers; module.exports = Brazzers;

View file

@ -18,18 +18,13 @@ class Burn extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("burn", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("burn", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "burn.png"); const attachment = new Discord.MessageAttachment(buffer, "burn.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Burn; module.exports = Burn;

View file

@ -19,11 +19,8 @@ class Captcha extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
try { try {
const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=captcha&username=${user.username}&url=${user.displayAvatarURL({ format: "png", size: 512 })}`)); const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=captcha&username=${user.username}&url=${user.displayAvatarURL({ format: "png", size: 512 })}`));
const json = await res.json(); const json = await res.json();
@ -35,10 +32,8 @@ class Captcha extends Command {
m.error("misc:ERR_OCCURRED", null, { m.error("misc:ERR_OCCURRED", null, {
edit: true edit: true
}); });
};
} }
};
}
}
module.exports = Captcha; module.exports = Captcha;

View file

@ -18,18 +18,13 @@ class Challenger extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("challenger", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("challenger", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "challenger.png"); const attachment = new Discord.MessageAttachment(buffer, "challenger.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Challenger; module.exports = Challenger;

View file

@ -19,16 +19,11 @@ class Clyde extends Command {
} }
async run (message, args) { async run (message, args) {
const text = args.join(" "); const text = args.join(" ");
if(!text){ if (!text) return message.error("images/clyde:MISSING_TEXT");
return message.error("images/clyde:MISSING_TEXT");
}
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
try { try {
const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=clyde&text=${text}`)); const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=clyde&text=${text}`));
const json = await res.json(); const json = await res.json();
@ -37,13 +32,9 @@ class Clyde extends Command {
m.delete(); m.delete();
} catch(e){ } catch(e){
console.log(e); console.log(e);
m.error("misc:ERROR_OCCURRED", null, { m.error("misc:ERROR_OCCURRED", null, { edit: true });
edit: true };
});
} }
};
}
}
module.exports = Clyde; module.exports = Clyde;

View file

@ -18,18 +18,13 @@ class Dictator extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("dictator", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("dictator", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "dictator.png"); const attachment = new Discord.MessageAttachment(buffer, "dictator.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Dictator; module.exports = Dictator;

View file

@ -19,11 +19,8 @@ class Facepalm extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author, const user = await this.client.resolveUser(args[0]) || message.author,
m = await message.sendT("misc:PLEASE_WAIT", null, { m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const canvas = Canvas.createCanvas(632, 357), const canvas = Canvas.createCanvas(632, 357),
ctx = canvas.getContext("2d"); ctx = canvas.getContext("2d");
@ -44,9 +41,7 @@ class Facepalm extends Command {
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Facepalm; module.exports = Facepalm;

View file

@ -18,18 +18,13 @@ class Fire extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("fire", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("fire", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "fire.png"); const attachment = new Discord.MessageAttachment(buffer, "fire.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Fire; module.exports = Fire;

View file

@ -18,18 +18,13 @@ class Jail extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("jail", { url: user.displayAvatarURL({ format: "png", size: 1024 }) }); const buffer = await this.client.AmeAPI.generate("jail", { url: user.displayAvatarURL({ format: "png", size: 1024 }) });
const attachment = new Discord.MessageAttachment(buffer, "jail.png"); const attachment = new Discord.MessageAttachment(buffer, "jail.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Jail; module.exports = Jail;

View file

@ -19,15 +19,12 @@ class Love extends Command {
} }
async run (message, args) { async run (message, args) {
const users = [ const users = [
await this.client.resolveUser(args[0]) || message.author, await this.client.resolveUser(args[0]) || message.author,
await this.client.resolveUser(args[1]) || message.author await this.client.resolveUser(args[1]) || message.author
]; ];
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
try { try {
const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=ship&user1=${users[0].displayAvatarURL({ format: "png", size: 512 })}&user2=${users[1].displayAvatarURL({ format: "png", size: 512 })}`)); const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=ship&user1=${users[0].displayAvatarURL({ format: "png", size: 512 })}&user2=${users[1].displayAvatarURL({ format: "png", size: 512 })}`));
const json = await res.json(); const json = await res.json();
@ -36,13 +33,9 @@ class Love extends Command {
m.delete(); m.delete();
} catch(e){ } catch(e){
console.log(e); console.log(e);
m.error("misc:ERROR_OCCURRED", null, { m.error("misc:ERROR_OCCURRED", null, { edit: true });
edit: true };
});
} }
};
}
}
module.exports = Love; module.exports = Love;

View file

@ -18,18 +18,13 @@ class Mission extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("images/mission:PLEASE_WAIT", null, { const m = await message.sendT("images/mission:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("missionpassed", { url: user.displayAvatarURL({ format: "png", size: 2048 }) }); const buffer = await this.client.AmeAPI.generate("missionpassed", { url: user.displayAvatarURL({ format: "png", size: 2048 }) });
const attachment = new Discord.MessageAttachment(buffer, "mission.png"); const attachment = new Discord.MessageAttachment(buffer, "mission.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Mission; module.exports = Mission;

View file

@ -19,19 +19,16 @@ class Phcomment extends Command {
} }
async run (message, args) { async run (message, args) {
let user = await this.client.resolveUser(args[0]); let user = await this.client.resolveUser(args[0]);
let text = args.join(" "); let text = args.join(" ");
if(user){ if (user) {
text = args.slice(1).join(" "); text = args.slice(1).join(" ");
} else { } else {
user = message.author; user = message.author;
} };
if(!text){ if (!text) return message.error("images/phcomment:MISSING_TEXT");
return message.error("images/phcomment:MISSING_TEXT");
}
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading" prefixEmoji: "loading"
@ -47,13 +44,9 @@ class Phcomment extends Command {
m.delete(); m.delete();
} catch(e){ } catch(e){
console.log(e); console.log(e);
m.error("misc:ERROR_OCCURRED", null, { m.error("misc:ERROR_OCCURRED", null, { edit: true });
edit: true };
});
} }
};
}
}
module.exports = Phcomment; module.exports = Phcomment;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Qrcode extends Command { class Qrcode extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "qrcode", name: "qrcode",
@ -19,24 +18,17 @@ class Qrcode extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const text = args.join(" "); const text = args.join(" ");
if(!text){ if (!text) return message.error("images/qrcode:MISSING_TEXT");
return message.error("images/qrcode:MISSING_TEXT");
}
const pleaseWait = await message.sendT("misc:PLEASE_WAIT", null, { const pleaseWait = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setImage(`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${text.replace(new RegExp(" ", "g"), "%20")}`) .setImage(`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${text.replace(new RegExp(" ", "g"), "%20")}`)
.setColor(data.config.embed.color); .setColor(data.config.embed.color);
pleaseWait.edit(message.translate("images/qrcode:SUCCESS"), { embed }); pleaseWait.edit(message.translate("images/qrcode:SUCCESS"), { embed });
} }
};
}
module.exports = Qrcode; module.exports = Qrcode;

View file

@ -18,18 +18,13 @@ class Rip extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("rip", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("rip", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "rip.png"); const attachment = new Discord.MessageAttachment(buffer, "rip.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Rip; module.exports = Rip;

View file

@ -18,18 +18,13 @@ class Scary extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("scary", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("scary", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "scary.png"); const attachment = new Discord.MessageAttachment(buffer, "scary.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Scary; module.exports = Scary;

View file

@ -18,18 +18,13 @@ class Tobecontinued extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("tobecontinued", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("tobecontinued", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "tobecontinued.png"); const attachment = new Discord.MessageAttachment(buffer, "tobecontinued.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Tobecontinued; module.exports = Tobecontinued;

View file

@ -19,18 +19,13 @@ class Trash extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await canvacord.Canvas.trash(user.displayAvatarURL({ format: "png", size: 512 })); const buffer = await canvacord.Canvas.trash(user.displayAvatarURL({ format: "png", size: 512 }));
const attachment = new Discord.MessageAttachment(buffer, "trash.png"); const attachment = new Discord.MessageAttachment(buffer, "trash.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Trash; module.exports = Trash;

View file

@ -18,18 +18,13 @@ class Triggered extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("triggered", { url: user.displayAvatarURL({ format: "png", size: 512 }), sepia: "true", invert: "true" }); const buffer = await this.client.AmeAPI.generate("triggered", { url: user.displayAvatarURL({ format: "png", size: 512 }), sepia: "true", invert: "true" });
const attachment = new Discord.MessageAttachment(buffer, "triggered.gif"); const attachment = new Discord.MessageAttachment(buffer, "triggered.gif");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Triggered; module.exports = Triggered;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Tweet extends Command { class Tweet extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "tweet", name: "tweet",
@ -19,21 +18,14 @@ class Tweet extends Command {
} }
async run (message, args) { async run (message, args) {
const user = message.mentions.users.first() || message.author; const user = message.mentions.users.first() || message.author;
const text = args.slice(1).join(" "); const text = args.slice(1).join(" ");
if(!user){ if (!user) return message.error("images/tweet:MISSING_USERNAME");
return message.error("images/tweet:MISSING_USERNAME");
}
if(!text){ if (!text) return message.error("images/tweet:MISSING_TEXT");
return message.error("images/tweet:MISSING_TEXT");
}
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
await message.guild.members.fetch(); await message.guild.members.fetch();
const randomMembers = message.guild.members.cache.random(3); const randomMembers = message.guild.members.cache.random(3);
@ -48,9 +40,7 @@ class Tweet extends Command {
const attachment = new Discord.MessageAttachment(buffer, "twitter.png"); const attachment = new Discord.MessageAttachment(buffer, "twitter.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Tweet; module.exports = Tweet;

View file

@ -18,18 +18,13 @@ class Wanted extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("wanted", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("wanted", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "wanted.png"); const attachment = new Discord.MessageAttachment(buffer, "wanted.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Wanted; module.exports = Wanted;

View file

@ -18,18 +18,13 @@ class Wasted extends Command {
} }
async run (message, args) { async run (message, args) {
const user = await this.client.resolveUser(args[0]) || message.author; const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("wasted", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); const buffer = await this.client.AmeAPI.generate("wasted", { url: user.displayAvatarURL({ format: "png", size: 512 }) });
const attachment = new Discord.MessageAttachment(buffer, "wasted.png"); const attachment = new Discord.MessageAttachment(buffer, "wasted.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = Wasted; module.exports = Wasted;

View file

@ -19,23 +19,18 @@ class YouTubeComment extends Command {
} }
async run (message, args) { async run (message, args) {
let user = await this.client.resolveUser(args[0]); let user = await this.client.resolveUser(args[0]);
let text = args.join(" "); let text = args.join(" ");
if(user){ if (user) {
text = args.slice(1).join(" "); text = args.slice(1).join(" ");
} else { } else {
user = message.author; user = message.author;
} };
if(!text){ if (!text) return message.error("images/phcomment:MISSING_TEXT"); // same text as phcomment
return message.error("images/phcomment:MISSING_TEXT"); // same text as phcomment
}
const m = await message.sendT("misc:PLEASE_WAIT", null, { const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
prefixEmoji: "loading"
});
const image = await canvacord.Canvas.youtube({ const image = await canvacord.Canvas.youtube({
username: user.username, username: user.username,
avatar: user.displayAvatarURL({ format: "png" }), avatar: user.displayAvatarURL({ format: "png" }),
@ -44,9 +39,7 @@ class YouTubeComment extends Command {
const attachment = new Discord.MessageAttachment(image, "ytb-comment.png"); const attachment = new Discord.MessageAttachment(image, "ytb-comment.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
};
}
module.exports = YouTubeComment; module.exports = YouTubeComment;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Announcement extends Command { class Announcement extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "announcement", name: "announcement",
@ -19,64 +18,54 @@ class Announcement extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const text = args.join(" "); const text = args.join(" ");
if(!text){ if (!text) return message.error("moderation/announcement:MISSING_TEXT");
return message.error("moderation/announcement:MISSING_TEXT"); if (text.length > 1030) return message.error("moderation/announcement:TOO_LONG");
}
if(text.length > 1030){
return message.error("moderation/announcement:TOO_LONG");
}
message.delete().catch(() => {}); message.delete().catch(() => {});
let mention = ""; let mention = "";
const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); const msg = await message.sendT("moderation/announcement:MENTION_PROMPT");
const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 240000 }); const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 240000 });
collector.on("collect", async (tmsg) => { collector.on("collect", async (tmsg) => {
if (tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) {
if(tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()){
tmsg.delete(); tmsg.delete();
msg.delete(); msg.delete();
collector.stop(true); collector.stop(true);
} };
if(tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()){ if (tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
tmsg.delete(); tmsg.delete();
msg.delete(); msg.delete();
const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT"); const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT");
const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 60000 }); const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 60000 });
c.on("collect", (m) => { c.on("collect", (m) => {
if(m.content.toLowerCase() === "here"){ if (m.content.toLowerCase() === "here") {
mention = "@here"; mention = "@here";
tmsg1.delete(); tmsg1.delete();
m.delete(); m.delete();
collector.stop(true); collector.stop(true);
c.stop(true); c.stop(true);
} else if(m.content.toLowerCase() === "every"){ } else if (m.content.toLowerCase() === "every") {
mention = "@everyone"; mention = "@everyone";
tmsg1.delete(); tmsg1.delete();
m.delete(); m.delete();
collector.stop(true); collector.stop(true);
c.stop(true); c.stop(true);
} };
}); });
c.on("end", (collected, reason) => { c.on("end", (collected, reason) => {
if(reason === "time"){ if (reason === "time") {
return message.error("misc:TIMES_UP"); return message.error("misc:TIMES_UP");
} };
}); });
} };
}); });
collector.on("end", (collected, reason) => { collector.on("end", (collected, reason) => {
if (reason === "time") {
if(reason === "time"){
return message.error("misc:TIMES_UP"); return message.error("misc:TIMES_UP");
} };
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/announcement:TITLE")) .setAuthor(message.translate("moderation/announcement:TITLE"))
@ -87,9 +76,7 @@ class Announcement extends Command {
message.channel.send(mention, embed); message.channel.send(mention, embed);
}); });
} }
};
}
module.exports = Announcement; module.exports = Announcement;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Ban extends Command { class Ban extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "ban", name: "ban",
@ -19,43 +18,28 @@ class Ban extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const user = await this.client.resolveUser(args[0]); const user = await this.client.resolveUser(args[0]);
if(!user){ if (!user) return message.error("moderation/ban:MISSING_MEMBER");
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; 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){ if (user.id === message.author.id) return message.error("moderation/ban:YOURSELF");
return message.error("moderation/ban:YOURSELF");
}
// If the user is already banned // If the user is already banned
const banned = await message.guild.fetchBans(); const banned = await message.guild.fetchBans();
if(banned.some((m) => m.user.id === user.id)){ if (banned.some((m) => m.user.id === user.id)) return message.error("moderation/ban:ALREADY_BANNED", { username: user.tag });
return message.error("moderation/ban:ALREADY_BANNED", {
username: user.tag
});
}
// Gets the ban reason // Gets the ban reason
let reason = args.slice(1).join(" "); let reason = args.slice(1).join(" ");
if(!reason){ if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED");
reason = message.translate("misc:NO_REASON_PROVIDED");
}
const member = await message.guild.members.fetch(user.id).catch(() => {}); const member = await message.guild.members.fetch(user.id).catch(() => {});
if(member){ if (member) {
const memberPosition = member.roles.highest.position; const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position; const moderationPosition = message.member.roles.highest.position;
if(message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)){ if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition))return message.error("moderation/ban:SUPERIOR");
return message.error("moderation/ban:SUPERIOR"); if (!member.bannable) return message.error("moderation/ban:MISSING_PERM");
} };
if(!member.bannable) {
return message.error("moderation/ban:MISSING_PERM");
}
}
await user.send(message.translate("moderation/ban:BANNED_DM", { await user.send(message.translate("moderation/ban:BANNED_DM", {
username: user.tag, username: user.tag,
@ -66,7 +50,6 @@ class Ban extends Command {
// Ban the user // Ban the user
message.guild.members.ban(user, { reason } ).then(() => { message.guild.members.ban(user, { reason } ).then(() => {
// Send a success message in the current channel // Send a success message in the current channel
message.sendT("moderation/ban:BANNED", { message.sendT("moderation/ban:BANNED", {
username: user.tag, username: user.tag,
@ -84,35 +67,31 @@ class Ban extends Command {
reason reason
}; };
if(memberData){ if (memberData) {
memberData.sanctions.push(caseInfo); memberData.sanctions.push(caseInfo);
memberData.save(); memberData.save();
} };
data.guild.casesCount++; data.guild.casesCount++;
data.guild.save(); data.guild.save();
if(data.guild.plugins.modlogs){ if (data.guild.plugins.modlogs) {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if(!channel) return; if (!channel) return;
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/ban:CASE", { .setAuthor(message.translate("moderation/ban:CASE", { count: data.guild.casesCount }))
count: data.guild.casesCount
}))
.addField(message.translate("common:USER"), `\`${user.tag}\` (${user.toString()})`, true) .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:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true)
.addField(message.translate("common:REASON"), reason, true) .addField(message.translate("common:REASON"), reason, true)
.setColor("#e02316"); .setColor("#e02316");
channel.send(embed); channel.send(embed);
} };
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);
return message.error("moderation/ban:MISSING_PERM"); return message.error("moderation/ban:MISSING_PERM");
}); });
} }
};
}
module.exports = Ban; module.exports = Ban;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Checkinvites extends Command { class Checkinvites extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "checkinvites", name: "checkinvites",
@ -19,25 +18,22 @@ class Checkinvites extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const members = message.guild.members; const members = message.guild.members;
const withInvite = []; const withInvite = [];
members.cache.forEach((m) => { members.cache.forEach((m) => {
const possibleLinks = m.user.presence.activities.map((a) => [ a.state, a.details, a.name ]).flat(); const possibleLinks = m.user.presence.activities.map((a) => [ a.state, a.details, a.name ]).flat();
const inviteLinks = possibleLinks.filter((l) => /(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(l)); const inviteLinks = possibleLinks.filter((l) => /(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(l));
if(inviteLinks.length > 0) { if (inviteLinks.length > 0) {
withInvite.push({ withInvite.push({
id: m.user.id, id: m.user.id,
tag: Discord.Util.escapeMarkdown(m.user.tag), tag: Discord.Util.escapeMarkdown(m.user.tag),
links: "**"+Discord.Util.escapeMarkdown(inviteLinks.join(", "))+"**" links: "**"+Discord.Util.escapeMarkdown(inviteLinks.join(", "))+"**"
}); });
} };
}); });
const text = (withInvite.length > 0 ? const text = (withInvite.length > 0 ? withInvite.map((m) => "`"+m.id+"` ("+m.tag+") : "+m.links).join("\n") : message.translate("moderation/checkinvites:NOBODY"));
withInvite.map((m) => "`"+m.id+"` ("+m.tag+") : "+m.links).join("\n")
: message.translate("moderation/checkinvites:NOBODY"));
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setDescription(text) .setDescription(text)
@ -46,7 +42,6 @@ class Checkinvites extends Command {
message.channel.send(embed); message.channel.send(embed);
} }
};
}
module.exports = Checkinvites; module.exports = Checkinvites;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Clearsanctions extends Command { class Clearsanctions extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "clear-sanctions", name: "clear-sanctions",
@ -18,19 +17,14 @@ class Clearsanctions extends Command {
} }
async run (message, args) { async run (message, args) {
const member = await this.client.resolveMember(args[0], message.guild); const member = await this.client.resolveMember(args[0], message.guild);
if(!member){ if (!member) return message.error("moderation/clear-sanctions:MISSING_MEMBER");
return message.error("moderation/clear-sanctions:MISSING_MEMBER");
}
const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id });
memberData.sanctions = []; memberData.sanctions = [];
memberData.save(); memberData.save();
message.success("moderation/clear-sanctions:SUCCESS", { message.success("moderation/clear-sanctions:SUCCESS", { username: member.user.tag });
username: member.user.tag
});
} }
};
}
module.exports = Clearsanctions; module.exports = Clearsanctions;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Clear extends Command { class Clear extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "clear", name: "clear",
@ -18,8 +17,7 @@ class Clear extends Command {
} }
async run (message, args) { async run (message, args) {
if (args[0] === "all") {
if(args[0] === "all"){
message.sendT("moderation/clear:ALL_CONFIRM"); message.sendT("moderation/clear:ALL_CONFIRM");
await message.channel.awaitMessages((m) => (m.author.id === message.author.id) && (m.content === "confirm"), { await message.channel.awaitMessages((m) => (m.author.id === message.author.id) && (m.content === "confirm"), {
max: 1, max: 1,
@ -33,12 +31,10 @@ class Clear extends Command {
await message.channel.delete(); await message.channel.delete();
newChannel.setPosition(position); newChannel.setPosition(position);
return newChannel.send(message.translate("moderation/clear:CHANNEL_CLEARED")); return newChannel.send(message.translate("moderation/clear:CHANNEL_CLEARED"));
} };
let amount = args[0]; let amount = args[0];
if(!amount || isNaN(amount) || parseInt(amount) < 1){ if (!amount || isNaN(amount) || parseInt(amount) < 1) return message.error("moderation/clear:MISSING_AMOUNT");
return message.error("moderation/clear:MISSING_AMOUNT");
}
await message.delete(); await message.delete();
@ -46,12 +42,9 @@ class Clear extends Command {
let messages = await message.channel.messages.fetch({limit:100}); let messages = await message.channel.messages.fetch({limit:100});
messages = messages.array(); messages = messages.array();
if(user){ if (user) messages = messages.filter((m) => m.author.id === user.id);
messages = messages.filter((m) => m.author.id === user.id); if (messages.length > amount) messages.length = parseInt(amount, 10);
}
if(messages.length > amount){
messages.length = parseInt(amount, 10);
}
messages = messages.filter((m) => !m.pinned); messages = messages.filter((m) => !m.pinned);
amount++; amount++;
@ -59,23 +52,16 @@ class Clear extends Command {
let toDelete = null; let toDelete = null;
if(user){ if (user) {
toDelete = await message.success("moderation/clear:CLEARED_MEMBER", { toDelete = await message.success("moderation/clear:CLEARED_MEMBER", { amount: --amount, username: user.tag });
amount: --amount,
username: user.tag
});
} else { } else {
toDelete = await message.success("moderation/clear:CLEARED", { toDelete = await message.success("moderation/clear:CLEARED", { amount: --amount });
amount: --amount };
});
}
setTimeout(function(){ setTimeout(function(){
toDelete.delete(); toDelete.delete();
}, 2000); }, 2000);
} }
};
}
module.exports = Clear; module.exports = Clear;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
ms = require("ms"); ms = require("ms");
class Giveaway extends Command { class Giveaway extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "giveaway", name: "giveaway",
@ -19,47 +18,24 @@ class Giveaway extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const status = args[0]; const status = args[0];
if(!status){ if (!status)return message.error("moderation/giveaway:MISSING_STATUS");
return message.error("moderation/giveaway:MISSING_STATUS");
}
if(status === "create"){ if (status === "create") {
const currentGiveaways = this.client.giveawaysManager.giveaways.filter((g) => g.guildID === message.guild.id && !g.ended).length; const currentGiveaways = this.client.giveawaysManager.giveaways.filter((g) => g.guildID === message.guild.id && !g.ended).length;
if(currentGiveaways > 3){ if (currentGiveaways > 3) return message.error("moderation/giveaway:MAX_COUNT");
return message.error("moderation/giveaway:MAX_COUNT");
}
const time = args[1]; const time = args[1];
if(!time){ if (!time) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix });
return message.error("moderation/giveaway:INVALID_CREATE", { if (isNaN(ms(time))) return message.error("misc:INVALID_TIME");
prefix: data.guild.prefix if (ms(time) > ms("15d")) return message.error("moderation/giveaway:MAX_DURATION");
});
}
if(isNaN(ms(time))){
return message.error("misc:INVALID_TIME");
}
if(ms(time) > ms("15d")){
return message.error("moderation/giveaway:MAX_DURATION");
}
const winnersCount = args[2]; const winnersCount = args[2];
if(!winnersCount){ if (!winnersCount) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix });
return message.error("moderation/giveaway:INVALID_CREATE", { if (isNaN(winnersCount) || winnersCount > 10 || winnersCount < 1) return message.error("misc:INVALID_NUMBER_RANGE", { min: 1, max: 10 });
prefix: data.guild.prefix
});
}
if(isNaN(winnersCount) || winnersCount > 10 || winnersCount < 1){
return message.error("misc:INVALID_NUMBER_RANGE", {
min: 1,
max: 10
});
}
const prize = args.slice(3).join(" "); const prize = args.slice(3).join(" ");
if(!prize){ if (!prize) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix });
return message.error("moderation/giveaway:INVALID_CREATE", {
prefix: data.guild.prefix
});
}
this.client.giveawaysManager.start(message.channel, { this.client.giveawaysManager.start(message.channel, {
time: ms(time), time: ms(time),
prize: prize, prize: prize,
@ -86,52 +62,39 @@ class Giveaway extends Command {
}); });
} else if(status === "reroll"){ } else if(status === "reroll"){
const messageID = args[1]; const messageID = args[1];
if(!messageID){ if (!messageID)return message.error("moderation/giveaway:MISSING_ID");
return message.error("moderation/giveaway:MISSING_ID");
}
this.client.giveawaysManager.reroll(messageID, { this.client.giveawaysManager.reroll(messageID, {
congrat: message.translate("moderation/giveaway:REROLL_CONGRAT"), congrat: message.translate("moderation/giveaway:REROLL_CONGRAT"),
error: message.translate("moderation/giveaway:REROLL_ERROR") error: message.translate("moderation/giveaway:REROLL_ERROR")
}).then(() => { }).then(() => {
return message.success("moderation/giveaway:GIVEAWAY_REROLLED"); return message.success("moderation/giveaway:GIVEAWAY_REROLLED");
}).catch(() => { }).catch(() => {
return message.error("moderation/giveaway:NOT_FOUND_ENDED", { return message.error("moderation/giveaway:NOT_FOUND_ENDED", { messageID });
messageID
});
}); });
} else if(status === "delete"){ } else if(status === "delete"){
const messageID = args[1]; const messageID = args[1];
if(!messageID){ if(!messageID) return message.error("moderation/giveaway:MISSING_ID");
return message.error("moderation/giveaway:MISSING_ID");
}
this.client.giveawaysManager.delete(messageID).then(() => { this.client.giveawaysManager.delete(messageID).then(() => {
return message.success("moderation/giveaway:GIVEAWAY_DELETED"); return message.success("moderation/giveaway:GIVEAWAY_DELETED");
}).catch(() => { }).catch(() => {
return message.error("moderation/giveaway:NOT_FOUND", { return message.error("moderation/giveaway:NOT_FOUND", { messageID });
messageID
});
}); });
} else if(status === "end"){ } else if(status === "end"){
const messageID = args[1]; const messageID = args[1];
if(!messageID){ if (!messageID) return message.error("moderation/giveaway:MISSING_ID");
return message.error("moderation/giveaway:MISSING_ID");
}
try { try {
this.client.giveawaysManager.edit(messageID, { this.client.giveawaysManager.edit(messageID, { setEndTimestamp: Date.now() });
setEndTimestamp: Date.now()
});
return message.success("moderation/giveaway:GIVEAWAY_ENDED"); return message.success("moderation/giveaway:GIVEAWAY_ENDED");
} catch(e){ } catch(e){
return message.error("moderation/giveaway:NOT_FOUND", { return message.error("moderation/giveaway:NOT_FOUND", { messageID });
messageID };
});
}
} else { } else {
return message.error("moderation/giveaway:MISSING_STATUS"); return message.error("moderation/giveaway:MISSING_STATUS");
} }
} }
};
}
module.exports = Giveaway; module.exports = Giveaway;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Kick extends Command { class Kick extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "kick", name: "kick",
@ -19,33 +18,21 @@ class Kick extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const member = await this.client.resolveMember(args[0], message.guild); const member = await this.client.resolveMember(args[0], message.guild);
if(!member){ if (!member) return message.error("moderation/kick:MISSING_MEMBER");
return message.error("moderation/kick:MISSING_MEMBER");
}
if(member.id === message.author.id){ if (member.id === message.author.id) return message.error("moderation/ban:YOURSELF");
return message.error("moderation/ban:YOURSELF");
}
const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id });
// Gets the kcik reason // Gets the kcik reason
let reason = args.slice(1).join(" "); let reason = args.slice(1).join(" ");
if(!reason){ if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED");
reason = message.translate("misc:NO_REASON_PROVIDED");
}
const memberPosition = member.roles.highest.position; const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position; const moderationPosition = message.member.roles.highest.position;
if(message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)){ if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
return message.error("moderation/ban:SUPERIOR"); if (!member.kickable) return message.error("moderation/kick:MISSING_PERM");
}
if(!member.kickable) {
return message.error("moderation/kick:MISSING_PERM");
}
await member.send(message.translate("moderation/kick:KICKED_DM", { await member.send(message.translate("moderation/kick:KICKED_DM", {
username: member.user.tag, username: member.user.tag,
@ -56,7 +43,6 @@ class Kick extends Command {
// Kick the user // Kick the user
member.kick(reason).then(() => { member.kick(reason).then(() => {
// Send a success message in the current channel // Send a success message in the current channel
message.sendT("moderation/kick:KICKED", { message.sendT("moderation/kick:KICKED", {
username: member.user.tag, username: member.user.tag,
@ -80,26 +66,22 @@ class Kick extends Command {
memberData.sanctions.push(caseInfo); memberData.sanctions.push(caseInfo);
memberData.save(); memberData.save();
if(data.guild.plugins.modlogs){ if (data.guild.plugins.modlogs) {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if(!channel) return; if (!channel) return;
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/kick:CASE", { .setAuthor(message.translate("moderation/kick:CASE", { count: data.guild.casesCount}))
count: data.guild.casesCount
}))
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) .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:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true)
.addField(message.translate("common:REASON"), reason, true) .addField(message.translate("common:REASON"), reason, true)
.setColor("#e88709"); .setColor("#e88709");
channel.send(embed); channel.send(embed);
} };
}).catch(() => { }).catch(() => {
return message.error("moderation/kick:MISSING_PERM"); return message.error("moderation/kick:MISSING_PERM");
}); });
} }
};
}
module.exports = Kick; module.exports = Kick;

View file

@ -3,7 +3,6 @@ const Command = require("../../base/Command.js"),
ms = require("ms"); ms = require("ms");
class Mute extends Command { class Mute extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "mute", name: "mute",
@ -20,33 +19,20 @@ class Mute extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const member = await this.client.resolveMember(args[0], message.guild); const member = await this.client.resolveMember(args[0], message.guild);
if(!member){ if (!member) return message.error("moderation/mute:MISSING_MEMBER");
return message.error("moderation/mute:MISSING_MEMBER"); if (member.id === message.author.id) return message.error("moderation/ban:YOURSELF");
}
if(member.id === message.author.id){
return message.error("moderation/ban:YOURSELF");
}
const memberPosition = member.roles.highest.position; const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position; const moderationPosition = message.member.roles.highest.position;
if(message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)){ if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
return message.error("moderation/ban:SUPERIOR");
}
const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id });
const time = args[1]; const time = args[1];
if(!time || isNaN(ms(time))){ if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME");
return message.error("misc:INVALID_TIME");
}
let reason = args.slice(2).join(" "); let reason = args.slice(2).join(" ");
if(!reason){ if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED");
reason = message.translate("misc:NO_REASON_PROVIDED");
}
message.guild.channels.cache.forEach((channel) => { message.guild.channels.cache.forEach((channel) => {
channel.updateOverwrite(member.id, { channel.updateOverwrite(member.id, {
@ -97,13 +83,11 @@ class Mute extends Command {
this.client.databaseCache.mutedUsers.set(`${member.id}${message.guild.id}`, memberData); this.client.databaseCache.mutedUsers.set(`${member.id}${message.guild.id}`, memberData);
if(data.guild.plugins.modlogs){ if (data.guild.plugins.modlogs) {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if(!channel) return; if (!channel) return;
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/mute:CASE", { .setAuthor(message.translate("moderation/mute:CASE", { count: data.guild.casesCount }))
count: data.guild.casesCount
}))
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) .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:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true)
.addField(message.translate("common:REASON"), reason, true) .addField(message.translate("common:REASON"), reason, true)
@ -112,9 +96,7 @@ class Mute extends Command {
.setColor("#f44271"); .setColor("#f44271");
channel.send(embed); channel.send(embed);
} }
} }
};
}
module.exports = Mute; module.exports = Mute;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Poll extends Command { class Poll extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "poll", name: "poll",
@ -19,61 +18,53 @@ class Poll extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const question = args.join(" "); const question = args.join(" ");
if(!question){ if (!question) return message.error("moderation/poll:MISSING_QUESTION");
return message.error("moderation/poll:MISSING_QUESTION");
}
message.delete().catch(() => {}); message.delete().catch(() => {});
let mention = ""; let mention = "";
const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); const msg = await message.sendT("moderation/announcement:MENTION_PROMPT");
const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 240000 }); const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 240000 });
collector.on("collect", async (tmsg) => { collector.on("collect", async (tmsg) => {
if (tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) {
if(tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()){
tmsg.delete(); tmsg.delete();
msg.delete(); msg.delete();
collector.stop(true); collector.stop(true);
} };
if(tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()){ if (tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
tmsg.delete(); tmsg.delete();
msg.delete(); msg.delete();
const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT"); const tmsg1 = await message.sendT("moderation/announcement:MENTION_TYPE_PROMPT");
const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 60000 }); const c = new Discord.MessageCollector(message.channel, (m) => m.author.id === message.author.id, { time: 60000 });
c.on("collect", (m) => { c.on("collect", (m) => {
if(m.content.toLowerCase() === "here"){ if (m.content.toLowerCase() === "here") {
mention = "@here"; mention = "@here";
tmsg1.delete(); tmsg1.delete();
m.delete(); m.delete();
collector.stop(true); collector.stop(true);
c.stop(true); c.stop(true);
} else if(m.content.toLowerCase() === "every"){ } else if (m.content.toLowerCase() === "every") {
mention = "@everyone"; mention = "@everyone";
tmsg1.delete(); tmsg1.delete();
m.delete(); m.delete();
collector.stop(true); collector.stop(true);
c.stop(true); c.stop(true);
} };
}); });
c.on("end", (collected, reason) => { c.on("end", (collected, reason) => {
if(reason === "time"){ if (reason === "time") {
return message.error("misc:TIMES_UP"); return message.error("misc:TIMES_UP");
} };
}); });
} };
}); });
collector.on("end", (collected, reason) => { collector.on("end", (collected, reason) => {
if (reason === "time") {
if(reason === "time"){
return message.error("misc:TIMES_UP"); return message.error("misc:TIMES_UP");
} };
const success = this.client.customEmojis.success.split(":")[1]; const success = this.client.customEmojis.success.split(":")[1];
const error = this.client.customEmojis.error.split(":")[1]; const error = this.client.customEmojis.error.split(":")[1];
@ -86,19 +77,14 @@ class Poll extends Command {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("moderation/poll:TITLE")) .setAuthor(message.translate("moderation/poll:TITLE"))
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.addField(question, message.translate("moderation/poll:REACT", { .addField(question, message.translate("moderation/poll:REACT", { success: emojis[0].toString(), error: emojis[1].toString() }));
success: emojis[0].toString(),
error: emojis[1].toString()
}));
message.channel.send(mention, embed).then(async (m) => { message.channel.send(mention, embed).then(async (m) => {
await m.react(emojis[0]); await m.react(emojis[0]);
await m.react(emojis[1]); await m.react(emojis[1]);
}); });
}); });
} }
};
}
module.exports = Poll; module.exports = Poll;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Sanctions extends Command { class Sanctions extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "sanctions", name: "sanctions",
@ -19,11 +18,9 @@ class Sanctions extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const user = await this.client.resolveUser(args[0]); const user = await this.client.resolveUser(args[0]);
if(!user){ if (!user) return message.error("moderation/sanctions:MISSING_MEMBER");
return message.error("moderation/sanctions:MISSING_MEMBER");
}
const memberData = await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id }); const memberData = await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id });
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
@ -31,20 +28,16 @@ class Sanctions extends Command {
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
if(memberData.sanctions.length < 1){ if (memberData.sanctions.length < 1) {
embed.setDescription(message.translate("moderation/sanctions:NO_SANCTION", { embed.setDescription(message.translate("moderation/sanctions:NO_SANCTION", { username: user.tag }));
username: user.tag
}));
return message.channel.send(embed); return message.channel.send(embed);
} 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.addField(s.type+" | #"+s.case, `${message.translate("common:MODERATOR")}: <@${s.moderator}>\n${message.translate("common:REASON")}: ${s.reason}`, true);
}); });
} };
message.channel.send(embed); message.channel.send(embed);
} }
};
}
module.exports = Sanctions; module.exports = Sanctions;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Setwarns extends Command { class Setwarns extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "setwarns", name: "setwarns",
@ -18,64 +17,40 @@ class Setwarns extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const sanction = args[0]; const sanction = args[0];
if(!sanction || (sanction !== "kick" && sanction !== "ban")){ if (!sanction || (sanction !== "kick" && sanction !== "ban")) return message.error("moderation/setwarns:MISSING_TYPE");
return message.error("moderation/setwarns:MISSING_TYPE");
}
const number = args[1]; const number = args[1];
if(number === "reset"){ if (number === "reset") {
if(sanction === "kick"){ if (sanction === "kick") {
data.guild.plugins.warnsSanctions.kick = false; data.guild.plugins.warnsSanctions.kick = false;
data.guild.markModified("plugins.warnsSanctions"); data.guild.markModified("plugins.warnsSanctions");
data.guild.save(); data.guild.save();
return message.success("moderation/setwarns:SUCCESS_KICK_RESET", { return message.success("moderation/setwarns:SUCCESS_KICK_RESET", { prefix: data.guild.prefix, count: number });
prefix: data.guild.prefix, } else if(sanction === "ban") {
count: number
});
}
if(sanction === "ban"){
data.guild.plugins.warnsSanctions.ban = false; data.guild.plugins.warnsSanctions.ban = false;
data.guild.markModified("plugins.warnsSanctions"); data.guild.markModified("plugins.warnsSanctions");
data.guild.save(); data.guild.save();
return message.success("moderation/setwarns:SUCCESS_BAN_RESET", { return message.success("moderation/setwarns:SUCCESS_BAN_RESET", { prefix: data.guild.prefix, count: number });
prefix: data.guild.prefix, };
count: number };
});
}
}
if(!number || isNaN(number)){ if (!number || isNaN(number)) return message.error("misc:INVALID_NUMBER");
return message.error("misc:INVALID_NUMBER"); if (number < 1 || number > 10) return message.error("misc:INVALID_NUMBER_RANGE", 1, 10);
}
if(number < 1 || number > 10){
return message.error("misc:INVALID_NUMBER_RANGE", 1, 10);
}
if(sanction === "kick"){ if (sanction === "kick") {
data.guild.plugins.warnsSanctions.kick = number; data.guild.plugins.warnsSanctions.kick = number;
data.guild.markModified("plugins.warnsSanctions"); data.guild.markModified("plugins.warnsSanctions");
data.guild.save(); data.guild.save();
return message.success("moderation/setwarns:SUCCESS_KICK", { return message.success("moderation/setwarns:SUCCESS_KICK", { prefix: data.guild.prefix, count: number });
prefix: data.guild.prefix, } else if (sanction === "ban") {
count: number
});
}
if(sanction === "ban"){
data.guild.plugins.warnsSanctions.ban = number; data.guild.plugins.warnsSanctions.ban = number;
data.guild.markModified("plugins.warnsSanctions"); data.guild.markModified("plugins.warnsSanctions");
data.guild.save(); data.guild.save();
return message.success("moderation/setwarns:SUCCESS_BAN", { return message.success("moderation/setwarns:SUCCESS_BAN", { prefix: data.guild.prefix, count: number });
prefix: data.guild.prefix, };
count: number
});
} }
};
}
}
module.exports = Setwarns; module.exports = Setwarns;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Unban extends Command { class Unban extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "unban", name: "unban",
@ -18,17 +17,14 @@ class Unban extends Command {
} }
async run (message, args) { async run (message, args) {
let user = null; let user = null;
if(!args[0]){ if (!args[0]) return message.error("moderation/unban:MISSING_ID");
return message.error("moderation/unban:MISSING_ID");
}
// Check if the arg is an ID or a username // Check if the arg is an ID or a username
const isId = !isNaN(args[0]); const isId = !isNaN(args[0]);
if(isId){ if (isId) {
// Try to find a user with that ID // Try to find a user with that ID
await this.client.users.fetch(args[0]).then((u) => { await this.client.users.fetch(args[0]).then((u) => {
// if a user was found // if a user was found
@ -36,39 +32,26 @@ class Unban extends Command {
}).catch(() => {}); }).catch(() => {});
} else if(!isId) { } else if(!isId) {
const arr = args[0].split("#"); const arr = args[0].split("#");
if(arr.length < 2){ if (arr.length < 2) {
return message.error("misc:NO_USER_FOUND_ID", { return message.error("misc:NO_USER_FOUND_ID", {
id: args[0] id: args[0]
}); });
} };
user = this.client.users.filter((u) => u.username === arr[0]).find((u) => u.discriminator === arr[1]); user = this.client.users.filter((u) => u.username === arr[0]).find((u) => u.discriminator === arr[1]);
} };
if(!user){ if (!user) return message.error("misc:NO_USER_FOUND_ID", { id: args[0] });
return message.error("misc:NO_USER_FOUND_ID", {
id: args[0]
});
}
// check if the user is banned // check if the user is banned
const banned = await message.guild.fetchBans(); const banned = await message.guild.fetchBans();
if(!banned.some((e) => e.user.id === user.id)){ if (!banned.some((e) => e.user.id === user.id)) return message.success("moderation/unban:NOT_BANNED", { username: user.tag });
return message.success("moderation/unban:NOT_BANNED", {
username: user.tag
});
}
// Unban user // Unban user
message.guild.members.unban(user).catch(() => {}); message.guild.members.unban(user).catch(() => {});
// Send a success message in the current channel // Send a success message in the current channel
message.success("moderation/unban:UNBANNED", { message.success("moderation/unban:UNBANNED", { username: user.tag, server: message.guild.name });
username: user.tag,
server: message.guild.name
});
} }
};
}
module.exports = Unban; module.exports = Unban;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Unmute extends Command { class Unmute extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "unmute", name: "unmute",
@ -18,36 +17,24 @@ class Unmute extends Command {
} }
async run (message, args) { async run (message, args) {
const member = await this.client.resolveMember(args[0], message.guild); const member = await this.client.resolveMember(args[0], message.guild);
if(!member){ if (!member) return message.success("moderation/unmute:MISSING_MEMBER");
return message.success("moderation/unmute:MISSING_MEMBER");
}
const memberPosition = member.roles.highest.position; const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position; const moderationPosition = message.member.roles.highest.position;
if(message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)){ if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
return message.error("moderation/ban:SUPERIOR");
}
const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id });
if(memberData.mute.muted){ if (memberData.mute.muted) {
memberData.mute.endDate = Date.now(); memberData.mute.endDate = Date.now();
memberData.markModified("mute"); memberData.markModified("mute");
memberData.save(); memberData.save();
message.success("moderation/unmute:SUCCESS", { message.success("moderation/unmute:SUCCESS", { username: member.user.tag });
username: member.user.tag
});
} else { } else {
message.error("moderation/unmute:NOT_MUTED", { message.error("moderation/unmute:NOT_MUTED", { username: member.user.tag });
username: member.user.tag };
});
} }
};
}
}
module.exports = Unmute; module.exports = Unmute;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Warn extends Command { class Warn extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "warn", name: "warn",
@ -19,30 +18,20 @@ class Warn extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const member = await this.client.resolveMember(args[0], message.guild); const member = await this.client.resolveMember(args[0], message.guild);
if(!member){ if (!member) return message.error("moderation/warn:MISSING_MEMBER");
return message.error("moderation/warn:MISSING_MEMBER"); if (member.user.bot) return message.error("misc:BOT_USER");
}
if(member.user.bot){
return message.error("misc:BOT_USER");
}
const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id });
if(member.id === message.author.id){ if (member.id === message.author.id) return message.error("moderation/ban:YOURSELF");
return message.error("moderation/ban:YOURSELF");
}
const memberPosition = member.roles.highest.position; const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position; const moderationPosition = message.member.roles.highest.position;
if(message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)){ if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
return message.error("moderation/ban:SUPERIOR");
}
const reason = args.slice(1).join(" "); const reason = args.slice(1).join(" ");
if(!reason){ if (!reason) return message.error("moderation/warn:MISSING_REASON");
return message.error("moderation/warn:MISSING_REASON");
}
// Gets current member sanctions // Gets current member sanctions
const sanctions = memberData.sanctions.filter((s) => s.type === "warn").length; const sanctions = memberData.sanctions.filter((s) => s.type === "warn").length;
@ -66,74 +55,43 @@ class Warn extends Command {
.addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()}`) .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()}`)
.addField(message.translate("common:REASON"), reason, true); .addField(message.translate("common:REASON"), reason, true);
if(banCount){ if (banCount) {
if(sanctions >= banCount){ if (sanctions >= banCount) {
member.send(message.translate("moderation/ban:BANNED_DM", { member.send(message.translate("moderation/ban:BANNED_DM", { username: member.user, moderator: message.author.tag, server: message.guild.name, reason }));
username: member.user,
moderator: message.author.tag,
server: message.guild.name,
reason
}));
caseInfo.type = "ban"; caseInfo.type = "ban";
embed.setAuthor(message.translate("moderation/ban:CASE", { embed.setAuthor(message.translate("moderation/ban:CASE", { count: data.guild.casesCount }))
count: data.guild.casesCount
}))
.setColor("#e02316"); .setColor("#e02316");
message.guild.members.ban(member).catch(() => {}); message.guild.members.ban(member).catch(() => {});
message.success("moderation/setwarns:AUTO_BAN", { message.success("moderation/setwarns:AUTO_BAN", { username: member.user.tag, count: banCount });
username: member.user.tag, };
count: banCount };
});
}
}
if(kickCount){ if (kickCount) {
if(sanctions >= kickCount){ if (sanctions >= kickCount) {
member.send(message.translate("moderation/kick:KICKED_DM", { member.send(message.translate("moderation/kick:KICKED_DM", { username: member.user, moderator: message.author.tag, server: message.guild.name, reason }));
username: member.user,
moderator: message.author.tag,
server: message.guild.name,
reason
}));
caseInfo.type = "kick"; caseInfo.type = "kick";
embed.setAuthor(message.translate("moderation/kick:CASE", { embed.setAuthor(message.translate("moderation/kick:CASE", { count: data.guild.casesCount }))
count: data.guild.casesCount
}))
.setColor("#e88709"); .setColor("#e88709");
member.kick().catch(() => {}); member.kick().catch(() => {});
message.success("moderation/setwarns:AUTO_KICK", { message.success("moderation/setwarns:AUTO_KICK", { username: member.user.tag, count: kickCount });
username: member.user.tag, };
count: kickCount };
});
}
}
member.send(message.translate("moderation/warn:WARNED_DM", { member.send(message.translate("moderation/warn:WARNED_DM", { username: member.user.tag, server: message.guild.name, moderator: message.author.tag, reason }));
username: member.user.tag,
server: message.guild.name,
moderator: message.author.tag,
reason
}));
caseInfo.type = "warn"; caseInfo.type = "warn";
embed.setAuthor(message.translate("moderation/warn:CASE", { embed.setAuthor(message.translate("moderation/warn:CASE", { caseNumber: data.guild.casesCount }))
caseNumber: data.guild.casesCount
}))
.setColor("#8c14e2"); .setColor("#8c14e2");
message.success("moderation/warn:WARNED", { message.success("moderation/warn:WARNED", { username: member.user.tag, reason });
username: member.user.tag,
reason
});
memberData.sanctions.push(caseInfo); memberData.sanctions.push(caseInfo);
memberData.save(); memberData.save();
if(data.guild.plugins.modlogs){ if (data.guild.plugins.modlogs) {
const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs);
if(!channel) return; if(!channel) return;
channel.send(embed); channel.send(embed);
};
} }
} };
}
module.exports = Warn; module.exports = Warn;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class AutoPlay extends Command { class AutoPlay extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "autoplay", name: "autoplay",
@ -18,26 +17,18 @@ class AutoPlay extends Command {
} }
async run (message) { async run (message) {
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){
return message.error("music/play:NO_VOICE_CHANNEL");
}
if(!queue){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
return message.error("music:play:NOT_PLAYING"); if (!queue) return message.error("music:play:NOT_PLAYING");
}
// Gets the current song // Gets the current song
await this.client.player.setAutoPlay(message, !queue.autoPlay); await this.client.player.setAutoPlay(message, !queue.autoPlay);
// Send the embed in the current channel // Send the embed in the current channel
message.sendT(`music/autoplay:SUCCESS_${queue.autoPlay ? "ENABLED" : "DISABLED"}`); message.sendT(`music/autoplay:SUCCESS_${queue.autoPlay ? "ENABLED" : "DISABLED"}`);
} }
};
}
module.exports = AutoPlay; module.exports = AutoPlay;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Back extends Command { class Back extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "back", name: "back",
@ -19,21 +18,13 @@ class Back extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){
return message.error("music/play:NO_VOICE_CHANNEL");
}
if(!queue){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
return message.error("music/play:NOT_PLAYING"); if (!queue) return message.error("music/play:NOT_PLAYING");
} if (!queue.previousTracks[0]) return message.error("music/back:NO_PREV_SONG");
if(!queue.previousTracks[0]){
return message.error("music/back:NO_PREV_SONG");
}
const members = voice.members.filter((m) => !m.user.bot); const members = voice.members.filter((m) => !m.user.bot);
@ -45,25 +36,18 @@ class Back extends Command {
const m = await message.channel.send(embed); const m = await message.channel.send(embed);
if(members.size > 1){ if (members.size > 1) {
m.react("👍"); m.react("👍");
const mustVote = Math.floor(members.size/2+1); const mustVote = Math.floor(members.size/2+1);
embed.setDescription(message.translate("music/back:VOTE_CONTENT", { embed.setDescription(message.translate("music/back:VOTE_CONTENT", { songName: queue.tracks[0].name, voteCount: 0, requiredCount: mustVote }));
songName: queue.tracks[0].name,
voteCount: 0,
requiredCount: mustVote
}));
m.edit(embed); m.edit(embed);
const filter = (reaction, user) => { const filter = (reaction, user) => {
const member = message.guild.members.cache.get(user.id); const member = message.guild.members.cache.get(user.id);
const voiceChannel = member.voice.channel; const voiceChannel = member.voice.channel;
if(voiceChannel){ if (voiceChannel) return voiceChannel.id === voice.id;
return voiceChannel.id === voice.id;
}
}; };
const collector = await m.createReactionCollector(filter, { const collector = await m.createReactionCollector(filter, {
@ -71,36 +55,28 @@ class Back extends Command {
}); });
collector.on("collect", (reaction) => { collector.on("collect", (reaction) => {
const haveVoted = reaction.count-1; const haveVoted = reaction.count - 1;
if(haveVoted >= mustVote){ if (haveVoted >= mustVote) {
this.client.player.back(message); this.client.player.back(message);
embed.setDescription(message.translate("music/back:SUCCESS")); embed.setDescription(message.translate("music/back:SUCCESS"));
m.edit(embed); m.edit(embed);
collector.stop(true); collector.stop(true);
} else { } else {
embed.setDescription(message.translate("music/back:VOTE_CONTENT", { embed.setDescription(message.translate("music/back:VOTE_CONTENT", { songName: queue.tracks[0].title, voteCount: haveVoted, requiredCount: mustVote }));
songName: queue.tracks[0].title,
voteCount: haveVoted,
requiredCount: mustVote
}));
m.edit(embed); m.edit(embed);
} }
}); });
collector.on("end", (collected, isDone) => { collector.on("end", (collected, isDone) => {
if(!isDone){ if (!isDone) return message.error("misc:TIMES_UP");
return message.error("misc:TIMES_UP");
}
}); });
} else { } else {
this.client.player.back(message); this.client.player.back(message);
embed.setDescription(message.translate("music/back:SUCCESS")); embed.setDescription(message.translate("music/back:SUCCESS"));
m.edit(embed); m.edit(embed);
};
} }
};
}
}
module.exports = Back; module.exports = Back;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
FiltersList = require("../../assets/json/filters.json"); FiltersList = require("../../assets/json/filters.json");
class Filter extends Command { class Filter extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "filter", name: "filter",
@ -19,40 +18,28 @@ class Filter extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
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 filter = args[0]; const filter = args[0];
if(!filter) return message.error("music/filter:MISSING_FILTER", { if (!filter) return message.error("music/filter:MISSING_FILTER", { prefix: data.guild.prefix });
prefix: data.guild.prefix
});
const filterToUpdate = Object.values(FiltersList).find((f) => f.toLowerCase() === filter.toLowerCase()); const filterToUpdate = Object.values(FiltersList).find((f) => f.toLowerCase() === filter.toLowerCase());
if(!filterToUpdate) return message.error("music/filter:UNKNOWN_FILTER", { if (!filterToUpdate) return message.error("music/filter:UNKNOWN_FILTER", { prefix: data.guild.prefix });
prefix: data.guild.prefix
});
const filterRealName = Object.keys(FiltersList).find((f) => FiltersList[f] === filterToUpdate); const filterRealName = Object.keys(FiltersList).find((f) => FiltersList[f] === filterToUpdate);
const queueFilters = this.client.player.getQueue(message).filters; const queueFilters = this.client.player.getQueue(message).filters;
const filtersUpdated = {}; const filtersUpdated = {};
filtersUpdated[filterRealName] = queueFilters[filterRealName] ? false : true; filtersUpdated[filterRealName] = queueFilters[filterRealName] ? false : true;
this.client.player.setFilters(message, filtersUpdated); this.client.player.setFilters(message, filtersUpdated);
if(filtersUpdated[filterRealName]) message.success("music/filter:ADDING_FILTER"); if (filtersUpdated[filterRealName]) message.success("music/filter:ADDING_FILTER");
else message.success("music/filter:REMOVING_FILTER"); else message.success("music/filter:REMOVING_FILTER");
} }
};
}
module.exports = Filter; module.exports = Filter;

View file

@ -3,7 +3,6 @@ const Command = require("../../base/Command.js"),
FiltersList = require("../../assets/json/filters.json"); FiltersList = require("../../assets/json/filters.json");
class Filters extends Command { class Filters extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "filters", name: "filters",
@ -20,17 +19,11 @@ class Filters extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
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 filtersStatuses = [ [], [] ]; const filtersStatuses = [ [], [] ];
@ -40,16 +33,13 @@ class Filters extends Command {
}); });
const list = new Discord.MessageEmbed() const list = new Discord.MessageEmbed()
.setDescription(message.translate("music/filters:CONTENT", { .setDescription(message.translate("music/filters:CONTENT", { prefix: data.guild.prefix }))
prefix: data.guild.prefix
}))
.addField(message.translate("music/filters:TITLE"), filtersStatuses[0].join("\n"), true) .addField(message.translate("music/filters:TITLE"), filtersStatuses[0].join("\n"), true)
.addField("** **", filtersStatuses[1].join("\n"), true) .addField("** **", filtersStatuses[1].join("\n"), true)
.setColor(data.config.embed.color); .setColor(data.config.embed.color);
message.channel.send(list); message.channel.send(list);
} }
};
}
module.exports = Filters; module.exports = Filters;

View file

@ -3,7 +3,6 @@ const Command = require("../../base/Command.js"),
lyricsParse = require("lyrics-finder"); lyricsParse = require("lyrics-finder");
class Lyrics extends Command { class Lyrics extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "lyrics", name: "lyrics",
@ -20,48 +19,36 @@ class Lyrics extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const [songName, artistName] = args.join(" ").split("|"); const [songName, artistName] = args.join(" ").split("|");
if(!songName){ if (!songName) return message.error("music/lyrics:MISSING_SONG_NAME");
return message.error("music/lyrics:MISSING_SONG_NAME");
}
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("music/lyrics:LYRICS_OF", { .setAuthor(message.translate("music/lyrics:LYRICS_OF", { songName }))
songName
}))
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
try { try {
const songNameFormated = songName const songNameFormated = songName
.toLowerCase() .toLowerCase()
.replace(/\(lyrics|lyric|official music video|audio|official|official video|official video hd|clip officiel|clip|extended|hq\)/g, "") .replace(/\(lyrics|lyric|official music video|audio|official|official video|official video hd|clip officiel|clip|extended|hq\)/g, "")
.split(" ").join("%20"); .split(" ").join("%20");
let lyrics = await lyricsParse(songNameFormated, artistName) || "Not Found!"; let lyrics = await lyricsParse(songNameFormated, artistName) || "Не найдено!";
if(lyrics.length > 2040) { if (lyrics.length > 2040) {
lyrics = lyrics.substr(0, 2000) + message.translate("music/lyrics:AND_MORE") + " ["+message.translate("music/lyrics:CLICK_HERE")+"]"+`https://www.musixmatch.com/search/${songName}`; lyrics = lyrics.substr(0, 2000) + message.translate("music/lyrics:AND_MORE") + " ["+message.translate("music/lyrics:CLICK_HERE")+"]"+`https://www.musixmatch.com/search/${songName}`;
} else if(!lyrics.length) { } else if (!lyrics.length) {
return message.error("music/lyrics:NO_LYRICS_FOUND", { return message.error("music/lyrics:NO_LYRICS_FOUND", { songName });
songName };
});
}
embed.setDescription(lyrics); embed.setDescription(lyrics);
message.channel.send(embed); message.channel.send(embed);
} catch(e){ } catch(e){
console.log(e); console.log(e);
message.error("music/lyrics:NO_LYRICS_FOUND", { message.error("music/lyrics:NO_LYRICS_FOUND", { songName });
songName
});
} }
} }
};
}
module.exports = Lyrics; module.exports = Lyrics;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Np extends Command { class Np extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "np", name: "np",
@ -19,17 +18,12 @@ class Np extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
return message.error("music/play:NO_VOICE_CHANNEL");
}
if(!queue){ if (!queue) return message.error("music/play:NOT_PLAYING");
return message.error("music/play:NOT_PLAYING");
}
// Gets the current song // Gets the current song
const track = await this.client.player.nowPlaying(message); const track = await this.client.player.nowPlaying(message);
@ -41,9 +35,7 @@ class Np extends Command {
.addField(message.translate("music/np:T_TITLE"), track.title, true) .addField(message.translate("music/np:T_TITLE"), track.title, true)
.addField(message.translate("music/np:T_CHANNEL"), track.author, true) .addField(message.translate("music/np:T_CHANNEL"), track.author, true)
.addField(message.translate("music/np:T_DURATION"), message.convertTime(Date.now()+track.durationMS, "to", true), true) .addField(message.translate("music/np:T_DURATION"), message.convertTime(Date.now()+track.durationMS, "to", true), true)
.addField(message.translate("music/np:T_DESCRIPTION"), .addField(message.translate("music/np:T_DESCRIPTION"), track.description ? (track.description.substring(0, 150)+"\n"+(message.translate("common:AND_MORE").toLowerCase())) : message.translate("music/np:NO_DESCRIPTION"), true)
track.description ?
(track.description.substring(0, 150)+"\n"+(message.translate("common:AND_MORE").toLowerCase())) : message.translate("music/np:NO_DESCRIPTION"), true)
.addField("\u200B", this.client.player.createProgressBar(message, { timecodes: true })) .addField("\u200B", this.client.player.createProgressBar(message, { timecodes: true }))
.setTimestamp() .setTimestamp()
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
@ -51,9 +43,7 @@ class Np extends Command {
// Send the embed in the current channel // Send the embed in the current channel
message.channel.send(embed); message.channel.send(embed);
} }
};
}
module.exports = Np; module.exports = Np;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Pause extends Command { class Pause extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "pause", name: "pause",
@ -18,26 +17,18 @@ class Pause extends Command {
} }
async run (message) { async run (message) {
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
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");
}
// Gets the current song // Gets the current song
await this.client.player.pause(message); await this.client.player.pause(message);
// Send the embed in the current channel // Send the embed in the current channel
message.sendT("music/pause:SUCCESS"); message.sendT("music/pause:SUCCESS");
} }
};
}
module.exports = Pause; module.exports = Pause;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Play extends Command { class Play extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "play", name: "play",
@ -18,26 +17,18 @@ class Play extends Command {
} }
async run (message, args) { async run (message, args) {
const name = args.join(" "); const name = args.join(" ");
if(!name){ if (!name) return message.error("music/play:MISSING_SONG_NAME");
return message.error("music/play:MISSING_SONG_NAME");
}
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if(!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
return message.error("music/play:NO_VOICE_CHANNEL");
}
// Check my permissions // Check my permissions
const perms = voice.permissionsFor(this.client.user); const perms = voice.permissionsFor(this.client.user);
if(!perms.has("CONNECT") || !perms.has("SPEAK")){ if (!perms.has("CONNECT") || !perms.has("SPEAK")) return message.error("music/play:VOICE_CHANNEL_CONNECT");
return message.error("music/play:VOICE_CHANNEL_CONNECT");
}
await this.client.player.play(message, args.join(" ")); await this.client.player.play(message, args.join(" "));
} }
};
}
module.exports = Play; module.exports = Play;

View file

@ -3,7 +3,6 @@ const Command = require("../../base/Command.js"),
Pagination = require("discord-paginationembed"); Pagination = require("discord-paginationembed");
class Queue extends Command { class Queue extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "queue", name: "queue",
@ -20,25 +19,20 @@ class Queue extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
return message.error("music/play:NO_VOICE_CHANNEL");
}
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
if(!queue){ if (!queue) return message.error("music/play:NOT_PLAYING");
return message.error("music/play:NOT_PLAYING");
}
if(queue.tracks.length === 1){ if (queue.tracks.length === 1) {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({ dynamic: true })) .setAuthor(message.translate("music/queue:TITLE"), message.guild.iconURL({ dynamic: true }))
.addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.tracks[0].title}](${queue.tracks[0].url})\n*Requested by ${queue.tracks[0].requestedBy}*\n`); .addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.tracks[0].title}](${queue.tracks[0].url})\n*Requested by ${queue.tracks[0].requestedBy}*\n`);
return message.channel.send(embed); return message.channel.send(embed);
} };
let i = 0; let i = 0;
const FieldsEmbed = new Pagination.FieldsEmbed(); const FieldsEmbed = new Pagination.FieldsEmbed();
@ -56,9 +50,7 @@ class Queue extends Command {
.formatField("Queue", (track) => `${++i}. [${track.title}](${track.url})\n*Requested by ${track.requestedBy}*\n`); .formatField("Queue", (track) => `${++i}. [${track.title}](${track.url})\n*Requested by ${track.requestedBy}*\n`);
FieldsEmbed.build(); FieldsEmbed.build();
} }
};
}
module.exports = Queue; module.exports = Queue;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Resume extends Command { class Resume extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "resume", name: "resume",
@ -18,17 +17,11 @@ class Resume extends Command {
} }
async run (message) { async run (message) {
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
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");
}
// Gets the current song // Gets the current song
await this.client.player.resume(message); await this.client.player.resume(message);
@ -36,7 +29,6 @@ class Resume extends Command {
// Send the embed in the current channel // Send the embed in the current channel
message.sendT("music/resume:SUCCESS"); message.sendT("music/resume:SUCCESS");
} }
};
}
module.exports = Resume; module.exports = Resume;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js");
const ms = require("ms"); const ms = require("ms");
class Seek extends Command { class Seek extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "seek", name: "seek",
@ -19,22 +18,15 @@ class Seek extends Command {
} }
async run (message, args) { async run (message, args) {
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
return message.error("music/play:NO_VOICE_CHANNEL");
}
if(!queue){ if (!queue) return message.error("music/play:NOT_PLAYING");
return message.error("music/play:NOT_PLAYING");
}
const time = ms(args[0]); const time = ms(args[0]);
if (isNaN(time)) { if (isNaN(time)) return message.error("music/seek:INVALID_TIME");
return message.error("music/seek:INVALID_TIME");
}
// Change the song position // Change the song position
await this.client.player.setPosition(message, queue.currentStreamTime + time); await this.client.player.setPosition(message, queue.currentStreamTime + time);
@ -42,7 +34,6 @@ class Seek extends Command {
// Send the embed in the current channel // Send the embed in the current channel
message.sendT("music/seek:SUCCESS"); message.sendT("music/seek:SUCCESS");
} }
};
}
module.exports = Seek; module.exports = Seek;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Skip extends Command { class Skip extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "skip", name: "skip",
@ -19,21 +18,12 @@ class Skip extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const queue = this.client.player.getQueue(message); const queue = this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
return message.error("music/play:NO_VOICE_CHANNEL"); if (!queue) return message.error("music/play:NOT_PLAYING");
} if (!queue.tracks[0]) return message.error("music/skip:NO_NEXT_SONG");
if(!queue){
return message.error("music/play:NOT_PLAYING");
}
if(!queue.tracks[0]){
return message.error("music/skip:NO_NEXT_SONG");
}
const members = voice.members.filter((m) => !m.user.bot); const members = voice.members.filter((m) => !m.user.bot);
@ -45,25 +35,18 @@ class Skip extends Command {
const m = await message.channel.send(embed); const m = await message.channel.send(embed);
if(members.size > 1){ if (members.size > 1) {
m.react("👍"); m.react("👍");
const mustVote = Math.floor(members.size/2+1); const mustVote = Math.floor(members.size/2+1);
embed.setDescription(message.translate("music/skip:VOTE_CONTENT", { embed.setDescription(message.translate("music/skip:VOTE_CONTENT", { songName: queue.tracks[0].name, voteCount: 0, requiredCount: mustVote }));
songName: queue.tracks[0].name,
voteCount: 0,
requiredCount: mustVote
}));
m.edit(embed); m.edit(embed);
const filter = (reaction, user) => { const filter = (reaction, user) => {
const member = message.guild.members.cache.get(user.id); const member = message.guild.members.cache.get(user.id);
const voiceChannel = member.voice.channel; const voiceChannel = member.voice.channel;
if(voiceChannel){ if (voiceChannel) return voiceChannel.id === voice.id;
return voiceChannel.id === voice.id;
}
}; };
const collector = await m.createReactionCollector(filter, { const collector = await m.createReactionCollector(filter, {
@ -71,36 +54,28 @@ class Skip extends Command {
}); });
collector.on("collect", (reaction) => { collector.on("collect", (reaction) => {
const haveVoted = reaction.count-1; const haveVoted = reaction.count - 1;
if(haveVoted >= mustVote){ if (haveVoted >= mustVote) {
this.client.player.skip(message); this.client.player.skip(message);
embed.setDescription(message.translate("music/skip:SUCCESS")); embed.setDescription(message.translate("music/skip:SUCCESS"));
m.edit(embed); m.edit(embed);
collector.stop(true); collector.stop(true);
} else { } else {
embed.setDescription(message.translate("music/skip:VOTE_CONTENT", { embed.setDescription(message.translate("music/skip:VOTE_CONTENT", { songName: queue.tracks[0].title, voteCount: haveVoted, requiredCount: mustVote }));
songName: queue.tracks[0].title,
voteCount: haveVoted,
requiredCount: mustVote
}));
m.edit(embed); m.edit(embed);
} };
}); });
collector.on("end", (collected, isDone) => { collector.on("end", (collected, isDone) => {
if(!isDone){ if (!isDone) return message.error("misc:TIMES_UP");
return message.error("misc:TIMES_UP");
}
}); });
} else { } else {
this.client.player.skip(message); this.client.player.skip(message);
embed.setDescription(message.translate("music/skip:SUCCESS")); embed.setDescription(message.translate("music/skip:SUCCESS"));
m.edit(embed); m.edit(embed);
};
} }
};
}
}
module.exports = Skip; module.exports = Skip;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Stop extends Command { class Stop extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "stop", name: "stop",
@ -19,17 +18,11 @@ class Stop extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
const queue = await this.client.player.getQueue(message); const queue = await this.client.player.getQueue(message);
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if(!voice){ if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
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 members = voice.members.filter((m) => !m.user.bot); const members = voice.members.filter((m) => !m.user.bot);
@ -40,24 +33,18 @@ class Stop extends Command {
const m = await message.channel.send(embed); const m = await message.channel.send(embed);
if(members.size > 1){ if (members.size > 1) {
m.react("👍"); m.react("👍");
const mustVote = Math.floor(members.size/2+1); const mustVote = Math.floor(members.size/2+1);
embed.setDescription(message.translate("music/stop:VOTE_CONTENT", { embed.setDescription(message.translate("music/stop:VOTE_CONTENT", { voteCount: 0, requiredCount: mustVote }));
voteCount: 0,
requiredCount: mustVote
}));
m.edit(embed); m.edit(embed);
const filter = (reaction, user) => { const filter = (reaction, user) => {
const member = message.guild.members.cache.get(user.id); const member = message.guild.members.cache.get(user.id);
const voiceChannel = member.voice.channel; const voiceChannel = member.voice.channel;
if(voiceChannel){ if (voiceChannel) return voiceChannel.id === voice.id;
return voiceChannel.id === voice.id;
}
}; };
const collector = await m.createReactionCollector(filter, { const collector = await m.createReactionCollector(filter, {
@ -65,35 +52,28 @@ class Stop extends Command {
}); });
collector.on("collect", (reaction) => { collector.on("collect", (reaction) => {
const haveVoted = reaction.count-1; const haveVoted = reaction.count - 1;
if(haveVoted >= mustVote){ if (haveVoted >= mustVote) {
this.client.player.stop(message); this.client.player.stop(message);
embed.setDescription(message.translate("music/stop:SUCCESS")); embed.setDescription(message.translate("music/stop:SUCCESS"));
m.edit(embed); m.edit(embed);
collector.stop(true); collector.stop(true);
} else { } else {
embed.setDescription(message.translate("music/stop:VOTE_CONTENT", { embed.setDescription(message.translate("music/stop:VOTE_CONTENT", { voteCount: haveVoted, requiredCount: mustVote }));
voteCount: haveVoted,
requiredCount: mustVote
}));
m.edit(embed); m.edit(embed);
} }
}); });
collector.on("end", (collected, isDone) => { collector.on("end", (collected, isDone) => {
if(!isDone){ if (!isDone) return message.error("misc:TIMES_UP");
return message.error("misc:TIMES_UP");
}
}); });
} else { } else {
this.client.player.stop(message); this.client.player.stop(message);
embed.setDescription(message.translate("music/stop:SUCCESS")); embed.setDescription(message.translate("music/stop:SUCCESS"));
m.edit(embed); m.edit(embed);
};
} }
};
}
}
module.exports = Stop; module.exports = Stop;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Eval extends Command { class Eval extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "eval", name: "eval",
@ -19,7 +18,6 @@ class Eval extends Command {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
async run (message, args, data) { async run (message, args, data) {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const usersData = this.client.usersData; const usersData = this.client.usersData;
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
@ -29,27 +27,15 @@ class Eval extends Command {
const result = new Promise((resolve) => resolve(eval(content))); const result = new Promise((resolve) => resolve(eval(content)));
return result.then((output) => { return result.then((output) => {
if(typeof output !== "string"){ if (typeof output !== "string") output = require("util").inspect(output, { depth: 0 });
output = require("util").inspect(output, { depth: 0 }); if (output.includes(this.client.token)) output = output.replace(this.client.token, "T0K3N");
} message.channel.send(output, { code: "js" });
if(output.includes(this.client.token)){
output = output.replace(this.client.token, "T0K3N");
}
message.channel.send(output, {
code: "js"
});
}).catch((err) => { }).catch((err) => {
err = err.toString(); err = err.toString();
if(err.includes(this.client.token)){ if (err.includes(this.client.token)) err = err.replace(this.client.token, "T0K3N");
err = err.replace(this.client.token, "T0K3N"); message.channel.send(err, { code: "js" });
}
message.channel.send(err, {
code: "js"
}); });
});
} }
};
}
module.exports = Eval; module.exports = Eval;

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Reload extends Command { class Reload extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "reload", name: "reload",
@ -20,18 +19,12 @@ class Reload extends Command {
async run (message, args) { async run (message, args) {
const command = args[0]; const command = args[0];
const cmd = this.client.commands.get(command) || this.client.commands.get(this.client.aliases.get(command)); const cmd = this.client.commands.get(command) || this.client.commands.get(this.client.aliases.get(command));
if(!cmd){ if (!cmd) message.error("owner/reload:NOT_FOUND", { search: command });
message.error("owner/reload:NOT_FOUND", {
search: command
});
}
await this.client.unloadCommand(cmd.conf.location, cmd.help.name); await this.client.unloadCommand(cmd.conf.location, cmd.help.name);
await this.client.loadCommand(cmd.conf.location, cmd.help.name); await this.client.loadCommand(cmd.conf.location, cmd.help.name);
message.success("owner/reload:SUCCESS", { message.success("owner/reload:SUCCESS", { command: cmd.help.name });
command: cmd.help.name
});
} }
};
}
module.exports = Reload; module.exports = Reload;

View file

@ -2,7 +2,6 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class ServersList extends Command { class ServersList extends Command {
constructor (client) { constructor (client) {
super(client, { super(client, {
name: "servers-list", name: "servers-list",
@ -19,15 +18,13 @@ class ServersList extends Command {
} }
async run (message, args, data) { async run (message, args, data) {
await message.delete(); await message.delete();
let i0 = 0; let i0 = 0;
let i1 = 10; let i1 = 10;
let page = 1; let page = 1;
let description = let description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` +
`${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n`+
this.client.guilds.cache.sort((a,b) => b.memberCount-a.memberCount).map((r) => r) this.client.guilds.cache.sort((a,b) => b.memberCount-a.memberCount).map((r) => r)
.map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS").toLowerCase()}`) .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS").toLowerCase()}`)
.slice(0, 10) .slice(0, 10)
@ -49,23 +46,17 @@ class ServersList extends Command {
const collector = msg.createReactionCollector((reaction, user) => user.id === message.author.id); const collector = msg.createReactionCollector((reaction, user) => user.id === message.author.id);
collector.on("collect", async(reaction) => { collector.on("collect", async(reaction) => {
if (reaction._emoji.name === "⬅") {
if(reaction._emoji.name === "⬅") {
// Updates variables // Updates variables
i0 = i0-10; i0 = i0 - 10;
i1 = i1-10; i1 = i1 - 10;
page = page-1; page = page - 1;
// if there is no guild to display, delete the message // if there is no guild to display, delete the message
if(i0 < 0){ if (i0 < 0) return msg.delete();
return msg.delete(); if (!i0 || !i1) return msg.delete();
}
if(!i0 || !i1){
return msg.delete();
}
description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n`+ description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` +
this.client.guilds.cache.sort((a,b) => b.memberCount-a.memberCount).map((r) => r) this.client.guilds.cache.sort((a,b) => b.memberCount-a.memberCount).map((r) => r)
.map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS")}`) .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS")}`)
.slice(i0, i1) .slice(i0, i1)
@ -77,25 +68,19 @@ class ServersList extends Command {
// Edit the message // Edit the message
msg.edit(embed); msg.edit(embed);
};
} if (reaction._emoji.name === "➡") {
if(reaction._emoji.name === "➡"){
// Updates variables // Updates variables
i0 = i0+10; i0 = i0 + 10;
i1 = i1+10; i1 = i1 + 10;
page = page+1; page = page + 1;
// if there is no guild to display, delete the message // if there is no guild to display, delete the message
if(i1 > this.client.guilds.cache.size + 10){ if (i1 > this.client.guilds.cache.size + 10) return msg.delete();
return msg.delete(); if (!i0 || !i1) return msg.delete();
}
if(!i0 || !i1){
return msg.delete();
}
description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n`+ description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` +
this.client.guilds.cache.sort((a,b) => b.memberCount-a.memberCount).map((r) => r) this.client.guilds.cache.sort((a,b) => b.memberCount-a.memberCount).map((r) => r)
.map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS").toLowerCase()}`) .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.translate("common:MEMBERS").toLowerCase()}`)
.slice(i0, i1) .slice(i0, i1)
@ -107,19 +92,14 @@ class ServersList extends Command {
// Edit the message // Edit the message
msg.edit(embed); msg.edit(embed);
};
} if (reaction._emoji.name === "❌") return msg.delete();
if(reaction._emoji.name === "❌"){
return msg.delete();
}
// Remove the reaction when the user react to the message // Remove the reaction when the user react to the message
await reaction.users.remove(message.author.id); await reaction.users.remove(message.author.id);
}); });
} }
};
}
module.exports = ServersList; module.exports = ServersList;

View file

@ -8,7 +8,7 @@
"INVALID_TIME": "Укажите действительное время! Доступные единицы: `s`, `m`, `h` or `d`", "INVALID_TIME": "Укажите действительное время! Доступные единицы: `s`, `m`, `h` or `d`",
"INVALID_NUMBER": "Пожалуйста, укажите число!", "INVALID_NUMBER": "Пожалуйста, укажите число!",
"INVALID_NUMBER_RANGE": "Укажите число от **{{min}}** до **{{max}}**!", "INVALID_NUMBER_RANGE": "Укажите число от **{{min}}** до **{{max}}**!",
"STATS_FOOTER": "[Панель управления]({{dashboardLink}}) ● [Поддержать]({{donateLink}}) ● [Приглашение]({{inviteLink}}) ● [Сервер поддержки]({{supportLink}}) ● [Github]({{githubLink}})", "STATS_FOOTER": "[Панель управления]({{dashboardLink}})\n● [Поддержать]({{donateLink}}) (для других способов пишите в ЛС @<{{owner}}>)",
"BOT_USER": "Этот пользователь бот!", "BOT_USER": "Этот пользователь бот!",
"NO_REASON_PROVIDED": "Причина не указана", "NO_REASON_PROVIDED": "Причина не указана",
"NO_USER_FOUND_ID": "Пользователя с ID `{{id}}` не существует!", "NO_USER_FOUND_ID": "Пользователя с ID `{{id}}` не существует!",