This commit is contained in:
JonnyBro 2021-12-26 19:29:37 +05:00
parent 8e1418b58f
commit e942aedad7
159 changed files with 1989 additions and 1077 deletions

View file

@ -47,7 +47,9 @@ class JaBa extends Client {
this.databaseCache.mutedUsers = new Collection(); // members who are currently muted this.databaseCache.mutedUsers = new Collection(); // members who are currently muted
if (this.config.apiKeys.amethyste) this.AmeAPI = new AmeClient(this.config.apiKeys.amethyste); if (this.config.apiKeys.amethyste) this.AmeAPI = new AmeClient(this.config.apiKeys.amethyste);
if (this.config.apiKeys.blagueXYZ) this.joker = new Joker(this.config.apiKeys.blagueXYZ, { defaultLanguage: "en" }); if (this.config.apiKeys.blagueXYZ) this.joker = new Joker(this.config.apiKeys.blagueXYZ, {
defaultLanguage: "en"
});
this.player = new DisTube.default(this, { this.player = new DisTube.default(this, {
searchSongs: 10, searchSongs: 10,
@ -73,11 +75,13 @@ class JaBa extends Client {
}) })
.on("searchDone", () => {}) .on("searchDone", () => {})
.on("searchCancel", message => message.error("misc:TIMES_UP")) .on("searchCancel", message => message.error("misc:TIMES_UP"))
.on("searchInvalidAnswer", message => message.error("misc:INVALID_NUMBER_RANGE", { min: 1, max: tracks.length })) .on("searchInvalidAnswer", message => message.error("misc:INVALID_NUMBER_RANGE", { min: 1, max: 10 }))
.on("searchNoResult", message => message.error("music/play:NO_RESULT")) .on("searchNoResult", message => message.error("music/play:NO_RESULT"))
.on("error", (textChannel, e) => { .on("error", (textChannel, e) => {
console.error(e); console.error(e);
textChannel.send(this.translate("music/play:ERR_OCCURRED", { error: e })); textChannel.send(this.translate("music/play:ERR_OCCURRED", {
error: e
}));
}) })
.on("finish", queue => queue.textChannel.send(this.translate("music/play:QUEUE_ENDED"))) .on("finish", queue => queue.textChannel.send(this.translate("music/play:QUEUE_ENDED")))
.on("disconnect", queue => queue.textChannel.send(this.translate("music/play:STOP_DISCONNECTED"))) .on("disconnect", queue => queue.textChannel.send(this.translate("music/play:STOP_DISCONNECTED")))
@ -163,13 +167,19 @@ class JaBa extends Client {
async findOrCreateUser({ id: userID }, isLean) { async findOrCreateUser({ id: userID }, isLean) {
if (this.databaseCache.users.get(userID)) return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID); if (this.databaseCache.users.get(userID)) return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID);
else { else {
let userData = (isLean ? await this.usersData.findOne({ id: userID }).lean() : await this.usersData.findOne({ id: userID })); let userData = (isLean ? await this.usersData.findOne({
id: userID
}).lean() : await this.usersData.findOne({
id: userID
}));
if (userData) { if (userData) {
if (!isLean) this.databaseCache.users.set(userID, userData); if (!isLean) this.databaseCache.users.set(userID, userData);
return userData; return userData;
} else { } else {
userData = new this.usersData({ id: userID }); userData = new this.usersData({
id: userID
});
await userData.save(); await userData.save();
this.databaseCache.users.set(userID, userData); this.databaseCache.users.set(userID, userData);
@ -182,15 +192,26 @@ class JaBa extends Client {
async findOrCreateMember({ id: memberID, guildID }, isLean) { async findOrCreateMember({ id: memberID, guildID }, isLean) {
if (this.databaseCache.members.get(`${memberID}${guildID}`)) return isLean ? this.databaseCache.members.get(`${memberID}${guildID}`).toJSON() : this.databaseCache.members.get(`${memberID}${guildID}`); if (this.databaseCache.members.get(`${memberID}${guildID}`)) return isLean ? this.databaseCache.members.get(`${memberID}${guildID}`).toJSON() : this.databaseCache.members.get(`${memberID}${guildID}`);
else { else {
let memberData = (isLean ? await this.membersData.findOne({ guildID, id: memberID }).lean() : await this.membersData.findOne({ guildID, id: memberID })); let memberData = (isLean ? await this.membersData.findOne({
guildID,
id: memberID
}).lean() : await this.membersData.findOne({
guildID,
id: memberID
}));
if (memberData) { if (memberData) {
if (!isLean) this.databaseCache.members.set(`${memberID}${guildID}`, memberData); if (!isLean) this.databaseCache.members.set(`${memberID}${guildID}`, memberData);
return memberData; return memberData;
} else { } else {
memberData = new this.membersData({ id: memberID, guildID: guildID }); memberData = new this.membersData({
id: memberID,
guildID: guildID
});
await memberData.save(); await memberData.save();
const guild = await this.findOrCreateGuild({ id: guildID }); const guild = await this.findOrCreateGuild({
id: guildID
});
if (guild) { if (guild) {
guild.members.push(memberData._id); guild.members.push(memberData._id);
await guild.save(); await guild.save();
@ -206,13 +227,19 @@ class JaBa extends Client {
async findOrCreateGuild({ id: guildID }, isLean) { async findOrCreateGuild({ id: guildID }, isLean) {
if (this.databaseCache.guilds.get(guildID)) return isLean ? this.databaseCache.guilds.get(guildID).toJSON() : this.databaseCache.guilds.get(guildID); if (this.databaseCache.guilds.get(guildID)) return isLean ? this.databaseCache.guilds.get(guildID).toJSON() : this.databaseCache.guilds.get(guildID);
else { else {
let guildData = (isLean ? await this.guildsData.findOne({ id: guildID }).populate("members").lean() : await this.guildsData.findOne({ id: guildID }).populate("members")); let guildData = (isLean ? await this.guildsData.findOne({
id: guildID
}).populate("members").lean() : await this.guildsData.findOne({
id: guildID
}).populate("members"));
if (guildData) { if (guildData) {
if (!isLean) this.databaseCache.guilds.set(guildID, guildData); if (!isLean) this.databaseCache.guilds.set(guildID, guildData);
return guildData; return guildData;
} else { } else {
guildData = new this.guildsData({ id: guildID }); guildData = new this.guildsData({
id: guildID
});
await guildData.save(); await guildData.save();
this.databaseCache.guilds.set(guildID, guildData); this.databaseCache.guilds.set(guildID, guildData);

View file

@ -32,7 +32,10 @@ class Addcommand extends Command {
}); });
data.guild.save(); data.guild.save();
message.success("administration/addcommand:SUCCESS", { commandName: name, prefix: data.guild.prefix }); message.success("administration/addcommand:SUCCESS", {
commandName: name,
prefix: data.guild.prefix
});
} }
}; };

View file

@ -26,12 +26,8 @@ class Addemoji extends Command {
message.guild.emojis message.guild.emojis
.create(URL, name) .create(URL, name)
.then(emoji => { .then(emoji => message.success("administration/addemoji:SUCCESS", { emojiName: emoji.name }))
message.success("administration/addemoji:SUCCESS", { emojiName: emoji.name }); .catch(() => message.error("administration/addemoji:ERROR", { emojiName: name }));
})
.catch(() => {
message.error("administration/addemoji:ERROR", { emojiName: name });
});
} }
}; };

View file

@ -21,19 +21,29 @@ class Automod extends Command {
if (!status || (status !== "on" && status !== "off")) return message.error("administration/automod:MISSING_STATUS"); if (!status || (status !== "on" && status !== "off")) return message.error("administration/automod:MISSING_STATUS");
if (status === "on") { if (status === "on") {
data.guild.plugins.automod = { enabled: true, ignored: [] }; data.guild.plugins.automod = {
enabled: true,
ignored: []
};
data.guild.markModified("plugins.automod"); data.guild.markModified("plugins.automod");
data.guild.save(); data.guild.save();
message.success("administration/automod:ENABLED", { prefix: data.guild.prefix }); message.success("administration/automod:ENABLED", {
prefix: data.guild.prefix
});
} else if (status === "off") { } else if (status === "off") {
if (message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first()) { if (message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first()) {
const channel = message.mentions.channels.first(); const channel = message.mentions.channels.first();
data.guild.plugins.automod.ignored.push(channel); data.guild.plugins.automod.ignored.push(channel);
data.guild.markModified("plugins.automod"); data.guild.markModified("plugins.automod");
data.guild.save(); data.guild.save();
message.success("administration/automod:DISABLED_CHANNEL", { channel: channel.toString() }); message.success("administration/automod:DISABLED_CHANNEL", {
channel: channel.toString()
});
} else { } else {
data.guild.plugins.automod = { enabled: false, ignored: [] }; data.guild.plugins.automod = {
enabled: false,
ignored: []
};
data.guild.markModified("plugins.automod"); data.guild.markModified("plugins.automod");
data.guild.save(); data.guild.save();
message.success("administration/automod:DISABLED"); message.success("administration/automod:DISABLED");

View file

@ -39,7 +39,9 @@ class Autorole extends Command {
roleName: role.name roleName: role.name
}); });
} else if (status === "off") { } else if (status === "off") {
if (!data.guild.plugins.autorole.enabled) return message.success("administration/autorole:ALREADY_DISABLED", { prefix: data.guild.prefix }); if (!data.guild.plugins.autorole.enabled) return message.success("administration/autorole:ALREADY_DISABLED", {
prefix: data.guild.prefix
});
data.guild.plugins.autorole = { data.guild.plugins.autorole = {
enabled: false, enabled: false,
@ -48,7 +50,9 @@ class Autorole extends Command {
data.guild.markModified("plugins.autorole"); data.guild.markModified("plugins.autorole");
await data.guild.save(); await data.guild.save();
message.success("administration/autorole:SUCCESS_DISABLED", { prefix: data.guild.prefix }); message.success("administration/autorole:SUCCESS_DISABLED", {
prefix: data.guild.prefix
});
}; };
} }
}; };

View file

@ -24,11 +24,15 @@ class Backup extends Command {
if (!status) return message.error("administration/backup:MISSING_STATUS"); if (!status) return message.error("administration/backup:MISSING_STATUS");
if (status === "create") { if (status === "create") {
const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
backup.create(message.guild).then((backup) => { backup.create(message.guild).then((backup) => {
m.delete(); m.delete();
message.success("administration/backup:SUCCESS_PUBLIC"); message.success("administration/backup:SUCCESS_PUBLIC");
message.author.send(message.translate("administration/backup:SUCCESS_PRIVATE", { backupID: backup.id })).catch(() => { message.author.send(message.translate("administration/backup:SUCCESS_PRIVATE", {
backupID: backup.id
})).catch(() => {
backup.remove(backup.id); backup.remove(backup.id);
message.error("misc:CANNOT_DM"); message.error("misc:CANNOT_DM");
}); });
@ -88,7 +92,9 @@ class Backup extends Command {
message.channel.send(embed); message.channel.send(embed);
}).catch(() => { }).catch(() => {
// if the backup wasn't found // if the backup wasn't found
return message.error("administration/backup:NO_BACKUP_FOUND", { backupID }); return message.error("administration/backup:NO_BACKUP_FOUND", {
backupID
});
}); });
} else { } else {
return message.error("administration/backup:MISSING_STATUS"); return message.error("administration/backup:MISSING_STATUS");

View file

@ -32,13 +32,21 @@ class Configuration extends Command {
embed.addField(message.translate("administration/configuration:IGNORED_CHANNELS_TITLE"), guildData.ignoredChannels.length > 0 ? guildData.ignoredChannels.map((ch) => `<#${ch}>`).join(", ") : message.translate("administration/configuration:NO_IGNORED_CHANNELS")); embed.addField(message.translate("administration/configuration:IGNORED_CHANNELS_TITLE"), guildData.ignoredChannels.length > 0 ? guildData.ignoredChannels.map((ch) => `<#${ch}>`).join(", ") : message.translate("administration/configuration:NO_IGNORED_CHANNELS"));
// Autorole plugin // Autorole plugin
embed.addField(message.translate("administration/configuration:AUTOROLE_TITLE"), guildData.plugins.autorole.enabled ? message.translate("administration/configuration:AUTOROLE_CONTENT", { roleName: `<@&${guildData.plugins.autorole.role}>` }) : message.translate("administration/configuration:AUTOROLE_DISABLED")); embed.addField(message.translate("administration/configuration:AUTOROLE_TITLE"), guildData.plugins.autorole.enabled ? message.translate("administration/configuration:AUTOROLE_CONTENT", {
roleName: `<@&${guildData.plugins.autorole.role}>`
}) : message.translate("administration/configuration:AUTOROLE_DISABLED"));
// Welcome plugin // Welcome plugin
embed.addField(message.translate("administration/configuration:WELCOME_TITLE"), guildData.plugins.welcome.enabled ? message.translate("administration/configuration:WELCOME_CONTENT", { channel: `<#${guildData.plugins.welcome.channel}>`, withImage: guildData.plugins.welcome.withImage ? message.translate("common:YES") : message.translate("common:NO") }) : message.translate("administration/configuration:WELCOME_DISABLED")); embed.addField(message.translate("administration/configuration:WELCOME_TITLE"), guildData.plugins.welcome.enabled ? message.translate("administration/configuration:WELCOME_CONTENT", {
channel: `<#${guildData.plugins.welcome.channel}>`,
withImage: guildData.plugins.welcome.withImage ? message.translate("common:YES") : message.translate("common:NO")
}) : message.translate("administration/configuration:WELCOME_DISABLED"));
// Goodbye plugin // Goodbye plugin
embed.addField(message.translate("administration/configuration:GOODBYE_TITLE"), guildData.plugins.goodbye.enabled ? message.translate("administration/configuration:GOODBYE_CONTENT", { channel: `<#${guildData.plugins.goodbye.channel}>`, withImage: guildData.plugins.goodbye.withImage ? message.translate("common:YES") : message.translate("common:NO") }) : message.translate("administration/configuration:GOODBYE_DISABLED")); embed.addField(message.translate("administration/configuration:GOODBYE_TITLE"), guildData.plugins.goodbye.enabled ? message.translate("administration/configuration:GOODBYE_CONTENT", {
channel: `<#${guildData.plugins.goodbye.channel}>`,
withImage: guildData.plugins.goodbye.withImage ? message.translate("common:YES") : message.translate("common:NO")
}) : message.translate("administration/configuration:GOODBYE_DISABLED"));
// Special channels // Special channels
embed.addField(message.translate("administration/configuration:SPECIAL_CHANNELS"), embed.addField(message.translate("administration/configuration:SPECIAL_CHANNELS"),
@ -57,10 +65,16 @@ class Configuration extends Command {
); );
// Auto sanctions // Auto sanctions
embed.addField(message.translate("administration/configuration:AUTO_SANCTIONS"), (guildData.plugins.warnsSanctions.kick ? message.translate("administration/configuration:KICK_CONTENT", { count: guildData.plugins.warnsSanctions.kick }) : message.translate("administration/configuration:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? message.translate("administration/configuration:BAN_CONTENT", { count: guildData.plugins.warnsSanctions.ban }) : message.translate("administration/configuration:BAN_NOT_DEFINED"))); embed.addField(message.translate("administration/configuration:AUTO_SANCTIONS"), (guildData.plugins.warnsSanctions.kick ? message.translate("administration/configuration:KICK_CONTENT", {
count: guildData.plugins.warnsSanctions.kick
}) : message.translate("administration/configuration:KICK_NOT_DEFINED")) + "\n" + (guildData.plugins.warnsSanctions.ban ? message.translate("administration/configuration:BAN_CONTENT", {
count: guildData.plugins.warnsSanctions.ban
}) : message.translate("administration/configuration:BAN_NOT_DEFINED")));
// Automod plugin // Automod plugin
embed.addField(message.translate("administration/configuration:AUTOMOD_TITLE"), guildData.plugins.automod.enabled ? message.translate("administration/configuration:AUTOMOD_CONTENT", { channels: guildData.plugins.automod.ignored.map((ch) => `<#${ch}>`) }) : message.translate("administration/configuration:AUTOMOD_DISABLED")); embed.addField(message.translate("administration/configuration:AUTOMOD_TITLE"), guildData.plugins.automod.enabled ? message.translate("administration/configuration:AUTOMOD_CONTENT", {
channels: guildData.plugins.automod.ignored.map((ch) => `<#${ch}>`)
}) : message.translate("administration/configuration:AUTOMOD_DISABLED"));
// Auto-delete mod commands // Auto-delete mod commands
embed.addField(message.translate("administration/configuration:AUTODELETEMOD"), guildData.autoDeleteModCommands ? message.translate("administration/configuration:AUTODELETEMOD_ENABLED") : message.translate("administration/configuration:AUTODELETEMOD_DISABLED")); embed.addField(message.translate("administration/configuration:AUTODELETEMOD"), guildData.autoDeleteModCommands ? message.translate("administration/configuration:AUTODELETEMOD_ENABLED") : message.translate("administration/configuration:AUTODELETEMOD_DISABLED"));

View file

@ -19,13 +19,14 @@ class Delcommand extends Command {
async run(message, args, data) { async run(message, args, data) {
const name = args[0]; const name = args[0];
if (!name) return message.error("administration/delcommand:MISSING_NAME"); if (!name) return message.error("administration/delcommand:MISSING_NAME");
if (!data.guild.customCommands.find((c) => c.name === name)) return message.error("administration/delcommand:UNKNOWN_COMMAND", { commandName: name }); if (!data.guild.customCommands.find((c) => c.name === name)) return message.error("administration/delcommand:UNKNOWN_COMMAND", { commandName: name });
data.guild.customCommands = data.guild.customCommands.filter((c) => c.name !== name); data.guild.customCommands = data.guild.customCommands.filter((c) => c.name !== name);
data.guild.save(); data.guild.save();
message.success("administration/delcommand:SUCCESS", { commandName: name }); message.success("administration/delcommand:SUCCESS", {
commandName: name
});
} }
}; };

View file

@ -34,7 +34,9 @@ class Goodbye extends Command {
}; };
data.guild.markModified("plugins.goodbye"); data.guild.markModified("plugins.goodbye");
data.guild.save(); data.guild.save();
return message.error("administration/goodbye:DISABLED", { prefix: data.guild.prefix }); return message.error("administration/goodbye:DISABLED", {
prefix: data.guild.prefix
});
} else { } else {
const goodbye = { const goodbye = {
enabled: true, enabled: true,
@ -43,7 +45,10 @@ class Goodbye extends Command {
withImage: null, withImage: null,
}; };
message.sendT("administration/goodbye:FORM_1", { author: message.author.toString() }); message.sendT("administration/goodbye:FORM_1", {
author: message.author.toString()
});
const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, { const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, {
time: 120000 // 2 minutes time: 120000 // 2 minutes
}); });
@ -61,7 +66,10 @@ class Goodbye extends Command {
data.guild.plugins.goodbye = goodbye; data.guild.plugins.goodbye = goodbye;
data.guild.markModified("plugins.goodbye"); data.guild.markModified("plugins.goodbye");
await data.guild.save(); await data.guild.save();
message.sendT("administration/goodbye:FORM_SUCCESS", { prefix: data.guild.prefix, channel: `<#${goodbye.channel}>` }); message.sendT("administration/goodbye:FORM_SUCCESS", {
prefix: data.guild.prefix,
channel: `<#${goodbye.channel}>`
});
return collector.stop(); return collector.stop();
}; };

View file

@ -25,11 +25,15 @@ class Ignore extends Command {
if (ignored) { if (ignored) {
data.guild.ignoredChannels = data.guild.ignoredChannels.filter((ch) => ch !== channel.id); data.guild.ignoredChannels = data.guild.ignoredChannels.filter((ch) => ch !== channel.id);
data.guild.save(); data.guild.save();
return message.success("administration/ignore:ALLOWED", { channel: channel.toString() }); return message.success("administration/ignore:ALLOWED", {
channel: channel.toString()
});
} else if (!ignored) { } else if (!ignored) {
data.guild.ignoredChannels.push(channel.id); data.guild.ignoredChannels.push(channel.id);
data.guild.save(); data.guild.save();
return message.success("administration/ignore:IGNORED", { channel: channel.toString() }); return message.success("administration/ignore:IGNORED", {
channel: channel.toString()
});
}; };
} }
}; };

View file

@ -28,7 +28,10 @@ class Set extends Command {
if (!number || isNaN(number) || parseInt(number, 10) <= 0) return message.error("administration/set:INVALID_AMOUNT"); if (!number || isNaN(number) || parseInt(number, 10) <= 0) return message.error("administration/set:INVALID_AMOUNT");
const amount = Math.ceil(parseInt(number, 10)); const amount = Math.ceil(parseInt(number, 10));
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 (status === "level") { if (status === "level") {
memberData.level = parseInt(amount, 10); memberData.level = parseInt(amount, 10);
@ -44,7 +47,10 @@ class Set extends Command {
memberData.save(); memberData.save();
} }
message.success("administration/set:SUCCESS_" + status.toUpperCase() , { username: member.user.tag, amount }); message.success("administration/set:SUCCESS_" + status.toUpperCase(), {
username: member.user.tag,
amount
});
} }
}; };

View file

@ -33,7 +33,9 @@ class Setfortniteshop extends Command {
data.guild.markModified("plugins.fortniteshop"); data.guild.markModified("plugins.fortniteshop");
data.guild.save(); data.guild.save();
message.success("administration/setfortniteshop:ENABLED", { channel: channel.toString() }); message.success("administration/setfortniteshop:ENABLED", {
channel: channel.toString()
});
const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment; const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment;
const shop = new Canvas.FortniteShop(); const shop = new Canvas.FortniteShop();
@ -51,7 +53,13 @@ class Setfortniteshop extends Command {
const attachment = new Discord.MessageAttachment(image, "shop.png"); const attachment = new Discord.MessageAttachment(image, "shop.png");
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(this.client.translate("general/fortniteshop:DATE", { date: this.client.printDate(new Date(Date.now()), null, message.guild.data.language) }, message.guild.data.language), this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setAuthor(this.client.translate("general/fortniteshop:DATE", {
date: this.client.printDate(new Date(Date.now()), null, message.guild.data.language)
}, message.guild.data.language), this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.attachFiles(attachment) .attachFiles(attachment)
.setImage("attachment://shop.png") .setImage("attachment://shop.png")
.setColor(this.client.config.embed.color) .setColor(this.client.config.embed.color)

View file

@ -24,7 +24,9 @@ class Setlang extends Command {
data.guild.language = language.name; data.guild.language = language.name;
await data.guild.save(); await data.guild.save();
return message.sendT("administration/setlang:SUCCESS", { lang: language.nativeName }); return message.sendT("administration/setlang:SUCCESS", {
lang: language.nativeName
});
} }
}; };

View file

@ -19,7 +19,11 @@ class Setmodlogs extends Command {
async run(message, args, data) { async run(message, args, data) {
const areModLogsEnabled = Boolean(data.guild.plugins.modlogs); const areModLogsEnabled = Boolean(data.guild.plugins.modlogs);
const sentChannel = await Resolvers.resolveChannel({ message, search: args.join(" "), channelType: "text" }); const sentChannel = await Resolvers.resolveChannel({
message,
search: args.join(" "),
channelType: "text"
});
if (!sentChannel && areModLogsEnabled) { if (!sentChannel && areModLogsEnabled) {
data.guild.plugins.modlogs = null; data.guild.plugins.modlogs = null;
@ -31,7 +35,9 @@ class Setmodlogs extends Command {
data.guild.plugins.modlogs = channel.id; data.guild.plugins.modlogs = channel.id;
data.guild.markModified("plugins.modlogs"); data.guild.markModified("plugins.modlogs");
await data.guild.save(); await data.guild.save();
return message.success("administration/setmodlogs:SUCCESS_ENABLED", { channel: channel.toString() }); return message.success("administration/setmodlogs:SUCCESS_ENABLED", {
channel: channel.toString()
});
}; };
} }
}; };

View file

@ -24,8 +24,9 @@ class Setprefix extends Command {
data.guild.prefix = prefix; data.guild.prefix = prefix;
data.guild.save(); data.guild.save();
// Sucess return message.success("administration/setprefix:SUCCESS", {
return message.success("administration/setprefix:SUCCESS", { prefix }); prefix
});
} }
}; };

View file

@ -19,7 +19,11 @@ class Setreports extends Command {
async run(message, args, data) { async run(message, args, data) {
const areReportsEnabled = Boolean(data.guild.plugins.reports); const areReportsEnabled = Boolean(data.guild.plugins.reports);
const sentChannel = await Resolvers.resolveChannel({ message, search: args.join(" "), channelType: "text" }); const sentChannel = await Resolvers.resolveChannel({
message,
search: args.join(" "),
channelType: "text"
});
if (!sentChannel && areReportsEnabled) { if (!sentChannel && areReportsEnabled) {
data.guild.plugins.reports = null; data.guild.plugins.reports = null;
@ -31,7 +35,9 @@ class Setreports extends Command {
data.guild.plugins.reports = channel.id; data.guild.plugins.reports = channel.id;
data.guild.markModified("plugins.reports"); data.guild.markModified("plugins.reports");
await data.guild.save(); await data.guild.save();
return message.success("administration/setreports:SUCCESS_ENABLED", { channel: channel.toString() }); return message.success("administration/setreports:SUCCESS_ENABLED", {
channel: channel.toString()
});
}; };
} }
}; };

View file

@ -19,7 +19,11 @@ class Setsuggests extends Command {
async run(message, args, data) { async run(message, args, data) {
const areSuggestsEnabled = Boolean(data.guild.plugins.suggestions); const areSuggestsEnabled = Boolean(data.guild.plugins.suggestions);
const sentChannel = await Resolvers.resolveChannel({ message, search: args.join(" "), channelType: "text" }); const sentChannel = await Resolvers.resolveChannel({
message,
search: args.join(" "),
channelType: "text"
});
if (!sentChannel && areSuggestsEnabled) { if (!sentChannel && areSuggestsEnabled) {
data.guild.plugins.suggestions = null; data.guild.plugins.suggestions = null;
@ -31,7 +35,9 @@ class Setsuggests extends Command {
data.guild.plugins.suggestions = channel.id; data.guild.plugins.suggestions = channel.id;
data.guild.markModified("plugins.suggestions"); data.guild.markModified("plugins.suggestions");
await data.guild.save(); await data.guild.save();
return message.success("administration/setsuggests:SUCCESS_ENABLED", { channel: channel.toString() }); return message.success("administration/setsuggests:SUCCESS_ENABLED", {
channel: channel.toString()
});
}; };
} }
}; };

View file

@ -28,7 +28,10 @@ class Slowmode extends Command {
data.guild.slowmode.channels = data.guild.slowmode.channels.filter((ch) => ch.id !== channel.id); data.guild.slowmode.channels = data.guild.slowmode.channels.filter((ch) => ch.id !== channel.id);
data.guild.markModified("slowmode.channels"); data.guild.markModified("slowmode.channels");
data.guild.save(); data.guild.save();
message.success("administration/slowmode:DISABLED", { prefix: data.guild.prefix, channel: `#${channel.name}` }); message.success("administration/slowmode:DISABLED", {
prefix: data.guild.prefix,
channel: `#${channel.name}`
});
} else { } else {
if (isNaN(ms(time))) return message.error("misc:INVALID_TIME"); if (isNaN(ms(time))) return message.error("misc:INVALID_TIME");
if (data.guild.slowmode.channels.find((ch) => ch.id === channel.id)) data.guild.slowmode.channels = data.guild.slowmode.channels.filter((ch) => ch.id !== channel.id); if (data.guild.slowmode.channels.find((ch) => ch.id === channel.id)) data.guild.slowmode.channels = data.guild.slowmode.channels.filter((ch) => ch.id !== channel.id);
@ -39,7 +42,11 @@ class Slowmode extends Command {
}); });
data.guild.markModified("slowmode.channels"); data.guild.markModified("slowmode.channels");
data.guild.save(); data.guild.save();
message.success("administration/slowmode:ENABLED", { prefix: data.guild.prefix, channel: `#${channel.name}`, time: this.client.functions.convertTime(message.guild, ms(time)) }); message.success("administration/slowmode:ENABLED", {
prefix: data.guild.prefix,
channel: `#${channel.name}`,
time: this.client.functions.convertTime(message.guild, ms(time))
});
}; };
} }
}; };

View file

@ -34,7 +34,9 @@ class Welcome extends Command {
}; };
data.guild.markModified("plugins.welcome"); data.guild.markModified("plugins.welcome");
data.guild.save(); data.guild.save();
return message.error("administration/welcome:DISABLED", { prefix: data.guild.prefix }); return message.error("administration/welcome:DISABLED", {
prefix: data.guild.prefix
});
} else { } else {
const welcome = { const welcome = {
enabled: true, enabled: true,
@ -43,7 +45,9 @@ class Welcome extends Command {
withImage: null, withImage: null,
}; };
message.sendT("administration/welcome:FORM_1", { author: message.author.toString() }); message.sendT("administration/welcome:FORM_1", {
author: message.author.toString()
});
const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, { const collector = message.channel.createMessageCollector(m => m.author.id === message.author.id, {
time: 120000 // 2 minutes time: 120000 // 2 minutes
}); });
@ -61,7 +65,10 @@ class Welcome extends Command {
data.guild.plugins.welcome = welcome; data.guild.plugins.welcome = welcome;
data.guild.markModified("plugins.welcome"); data.guild.markModified("plugins.welcome");
await data.guild.save(); await data.guild.save();
message.sendT("administration/welcome:FORM_SUCCESS", { prefix: data.guild.prefix, channel: `<#${welcome.channel}>` }); message.sendT("administration/welcome:FORM_SUCCESS", {
prefix: data.guild.prefix,
channel: `<#${welcome.channel}>`
});
return collector.stop(); return collector.stop();
}; };
@ -76,7 +83,10 @@ class Welcome extends Command {
// If the channel is not filled, it means the user sent it // If the channel is not filled, it means the user sent it
if (!welcome.channel) { if (!welcome.channel) {
const channel = await Resolvers.resolveChannel({ message: msg, channelType: "text" }); const channel = await Resolvers.resolveChannel({
message: msg,
channelType: "text"
});
if (!channel) return message.error("misc:INVALID_CHANNEL"); if (!channel) return message.error("misc:INVALID_CHANNEL");
welcome.channel = channel.id; welcome.channel = channel.id;

View file

@ -28,7 +28,8 @@ class Birthdate extends Command {
const match = date.match(/\d+/g); const match = date.match(/\d+/g);
if (!match) return message.error("economy/birthdate:INVALID_DATE_FORMAT"); if (!match) return message.error("economy/birthdate:INVALID_DATE_FORMAT");
const tday = +match[0], tmonth = +match[1] - 1; const tday = +match[0],
tmonth = +match[1] - 1;
let tyear = +match[2]; let tyear = +match[2];
if (tyear < 100) tyear += tyear < 50 ? 2000 : 1900; if (tyear < 100) tyear += tyear < 50 ? 2000 : 1900;
const d = new Date(tyear, tmonth, tday); const d = new Date(tyear, tmonth, tday);
@ -39,7 +40,9 @@ class Birthdate extends Command {
data.userData.birthdate = d; data.userData.birthdate = d;
data.userData.save(); data.userData.save();
message.success("economy/birthdate:SUCCESS", { date: message.printDate(d)}); message.success("economy/birthdate:SUCCESS", {
date: message.printDate(d)
});
} }
}; };

View file

@ -34,7 +34,9 @@ class Deposit extends Command {
data.memberData.bankSold = data.memberData.bankSold + amount; data.memberData.bankSold = data.memberData.bankSold + amount;
data.memberData.save(); data.memberData.save();
message.success("economy/deposit:SUCCESS", { money: amount }); message.success("economy/deposit:SUCCESS", {
money: amount
});
} }
}; };

View file

@ -17,21 +17,22 @@ class Divorce extends Command {
} }
async run(message, args, data) { async run(message, args, data) {
// Check if the message author is wedded
if (!data.userData.lover) return message.error("economy/divorce:NOT_MARRIED"); if (!data.userData.lover) return message.error("economy/divorce:NOT_MARRIED");
// Updates db
const user = this.client.users.cache.get(data.userData.lover) || await this.client.users.fetch(data.userData.lover); const user = this.client.users.cache.get(data.userData.lover) || await this.client.users.fetch(data.userData.lover);
data.userData.lover = null; data.userData.lover = null;
data.userData.save(); data.userData.save();
const oldLover = await this.client.findOrCreateUser({ id:user.id }); const oldLover = await this.client.findOrCreateUser({
id: user.id
});
oldLover.lover = null; oldLover.lover = null;
oldLover.save(); oldLover.save();
// Send success message message.success("economy/divorce:DIVORCED", {
message.success("economy/divorce:DIVORCED", { username: user.username }); username: user.username
});
} }
}; };

View file

@ -24,7 +24,9 @@ class Leaderboard extends Command {
if (!type || (type !== "credits" && type !== "level" && type !== "rep")) return message.error("economy/leaderboard:MISSING_TYPE"); if (!type || (type !== "credits" && type !== "level" && type !== "rep")) return message.error("economy/leaderboard:MISSING_TYPE");
if (type === "credits") { if (type === "credits") {
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) => {
return { return {
id: m.id, id: m.id,
@ -37,7 +39,9 @@ class Leaderboard extends Command {
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) => {
return { return {
id: m.id, id: m.id,

View file

@ -1,7 +1,6 @@
const Command = require("../../base/Command.js"), const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
// An object to store pending requests
const pendings = {}; const pendings = {};
class Marry extends Command { class Marry extends Command {
@ -22,16 +21,22 @@ class Marry extends Command {
async run(message, args, data) { async run(message, args, data) {
// if the message author is already wedded // if the message author is already wedded
if (data.userData.lover) return message.error("economy/marry:ALREADY_MARRIED", { prefix: data.guild.prefix }); if (data.userData.lover) return message.error("economy/marry:ALREADY_MARRIED", {
prefix: data.guild.prefix
});
// Gets the first mentionned member // Gets the first mentionned member
const member = await this.client.resolveMember(args[0], message.guild); const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("economy/marry:INVALID_MEMBER"); if (!member) return message.error("economy/marry:INVALID_MEMBER");
const userData = await this.client.findOrCreateUser({ id: member.id }); const userData = await this.client.findOrCreateUser({
id: member.id
});
// if the member is already wedded // if the member is already wedded
if (userData.lover) return message.error("economy/marry:ALREADY_MARRIED_USER", { username: member.user.tag }); if (userData.lover) return message.error("economy/marry:ALREADY_MARRIED_USER", {
username: member.user.tag
});
if (member.user.bot) return message.error("economy/marry:BOT_USER"); if (member.user.bot) return message.error("economy/marry:BOT_USER");
@ -42,23 +47,36 @@ class Marry extends Command {
// If the member already sent a request to someone // If the member already sent a request to someone
if (requester === message.author.id) { if (requester === message.author.id) {
const user = this.client.users.cache.get(receiver) || await this.client.users.fetch(receiver); const user = this.client.users.cache.get(receiver) || await this.client.users.fetch(receiver);
return message.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", { username: user.tag }); return message.error("economy/marry:REQUEST_AUTHOR_TO_AMEMBER", {
username: user.tag
});
} else if (receiver === message.author.id) { // If there is a pending request for this member } else if (receiver === message.author.id) { // If there is a pending request for this member
const user = this.client.users.cache.get(requester) || await this.client.users.fetch(requester); const user = this.client.users.cache.get(requester) || await this.client.users.fetch(requester);
return message.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", { username: user.tag }); return message.error("economy/marry:REQUEST_AMEMBER_TO_AUTHOR", {
username: user.tag
});
} else if (requester === member.id) { // If the asked member has sent pending request } else if (requester === member.id) { // If the asked member has sent pending request
const user = this.client.users.cache.get(receiver) || await this.client.users.fetch(receiver); const user = this.client.users.cache.get(receiver) || await this.client.users.fetch(receiver);
return message.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", { firstUsername: member.user.tag, secondUsername: user.tag }); return message.error("economy/marry:REQUEST_AMEMBER_TO_MEMBER", {
firstUsername: member.user.tag,
secondUsername: user.tag
});
} else if (receiver === member.id) { // If there is a pending request for the asked member } else if (receiver === member.id) { // If there is a pending request for the asked member
const user = this.client.users.cache.get(requester) || await this.client.users.fetch(requester); const user = this.client.users.cache.get(requester) || await this.client.users.fetch(requester);
return message.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", { firstUsername: member.user.tag, secondUsername: user.tag }); return message.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", {
firstUsername: member.user.tag,
secondUsername: user.tag
});
}; };
}; };
// Update pending requests // Update pending requests
pendings[message.author.id] = member.id; pendings[message.author.id] = member.id;
message.sendT("economy/marry:REQUEST", { from: message.author.toString(), to: member.user.toString() }); message.sendT("economy/marry:REQUEST", {
from: message.author.toString(),
to: member.user.toString()
});
const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === member.id, { const collector = new Discord.MessageCollector(message.channel, (m) => m.author.id === member.id, {
time: 120000 time: 120000
@ -78,7 +96,9 @@ class Marry extends Command {
// Delete pending request // Delete pending request
delete pendings[message.author.id]; delete pendings[message.author.id];
if (reason === "time") { if (reason === "time") {
return message.error("economy/marry:TIMEOUT", { username: member.user.toString() }); return message.error("economy/marry:TIMEOUT", {
username: member.user.toString()
});
}; };
if (reason) { if (reason) {
data.userData.lover = member.id; data.userData.lover = member.id;
@ -87,12 +107,10 @@ class Marry extends Command {
await userData.save(); await userData.save();
const messageOptions = { const messageOptions = {
content: `${member.toString()} :heart: ${message.author.toString()}`, content: `${member.toString()} :heart: ${message.author.toString()}`,
files: [ files: [{
{
name: "unlocked.png", name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked3.png" attachment: "./assets/img/achievements/achievement_unlocked3.png"
} }]
]
}; };
let sent = false; let sent = false;
if (!userData.achievements.married.achieved) { if (!userData.achievements.married.achieved) {
@ -110,9 +128,15 @@ class Marry extends Command {
data.userData.markModified("achievements.married"); data.userData.markModified("achievements.married");
data.userData.save(); data.userData.save();
}; };
return message.success("economy/marry:SUCCESS", { creator: message.author.toString(), partner: member.user.toString() }); return message.success("economy/marry:SUCCESS", {
creator: message.author.toString(),
partner: member.user.toString()
});
} else { } else {
return message.success("economy/marry:DENIED", { creator: message.author.toString(), partner: member.user.toString() }); return message.success("economy/marry:DENIED", {
creator: message.author.toString(),
partner: member.user.toString()
});
}; };
}); });
} }

View file

@ -30,12 +30,18 @@ class Credits extends Command {
if (user.bot) return message.error("misc:BOT_USER"); if (user.bot) return message.error("misc:BOT_USER");
const memberData = (message.author === user) ? data.memberData : await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id }); const memberData = (message.author === user) ? data.memberData : await this.client.findOrCreateMember({
id: user.id,
guildID: message.guild.id
});
const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(user.id)); const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(user.id));
let globalMoney = 0; let globalMoney = 0;
await asyncForEach(commonsGuilds.array(), async (guild) => { await asyncForEach(commonsGuilds.array(), async (guild) => {
const memberData = await this.client.findOrCreateMember({ id: user.id, guildID: guild.id }); const memberData = await this.client.findOrCreateMember({
id: user.id,
guildID: guild.id
});
globalMoney += memberData.money; globalMoney += memberData.money;
globalMoney += memberData.bankSold; globalMoney += memberData.bankSold;
}); });
@ -43,7 +49,11 @@ class Credits extends Command {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("economy/money:TITLE", { .setAuthor(message.translate("economy/money:TITLE", {
username: member.user.username username: member.user.username
}), member.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) }), member.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.addField(message.translate("economy/profile:CASH"), message.translate("economy/profile:MONEY", { .addField(message.translate("economy/profile:CASH"), message.translate("economy/profile:MONEY", {
money: memberData.money money: memberData.money
}), true) }), true)

View file

@ -19,19 +19,19 @@ class Pay 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) return message.error("economy/pay:INVALID_MEMBER"); if (!member) return message.error("economy/pay:INVALID_MEMBER");
if (member.user.bot) return message.error("economy/pay:BOT_USER"); if (member.user.bot) return message.error("economy/pay:BOT_USER");
if (member.id === message.author.id) return message.error("economy/pay:YOURSELF"); if (member.id === message.author.id) return message.error("economy/pay:YOURSELF");
const sentAmount = args[1]; const sentAmount = args[1];
if (!sentAmount || isNaN(sentAmount) || parseInt(sentAmount, 10) <= 0) return message.error("economy/pay:INVALID_AMOUNT", { username: member.user.tag }); if (!sentAmount || isNaN(sentAmount) || parseInt(sentAmount, 10) <= 0) return message.error("economy/pay:INVALID_AMOUNT", { username: member.user.tag });
const amount = Math.ceil(parseInt(sentAmount, 10)); const amount = Math.ceil(parseInt(sentAmount, 10));
if (amount > data.memberData.money) return message.error("economy/pay:ENOUGH_MONEY", { amount, username: member.user.tag }); if (amount > data.memberData.money) return message.error("economy/pay:ENOUGH_MONEY", { amount, username: member.user.tag });
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
});
data.memberData.money = data.memberData.money - parseInt(amount, 10); data.memberData.money = data.memberData.money - parseInt(amount, 10);
data.memberData.save(); data.memberData.save();
@ -39,8 +39,10 @@ class Pay extends Command {
memberData.money = memberData.money + parseInt(amount, 10); memberData.money = memberData.money + parseInt(amount, 10);
memberData.save(); memberData.save();
// Send a success message message.success("economy/pay:SUCCESS", {
message.success("economy/pay:SUCCESS", { amount, username: member.user.tag }); amount,
username: member.user.tag
});
} }
}; };

View file

@ -29,21 +29,24 @@ class Profile extends Command {
const arg = args[0] || message.author const arg = args[0] || message.author
let member = await client.resolveMember(arg, message.guild); let member = await client.resolveMember(arg, message.guild);
if (!member) member = message.member; if (!member) member = message.member;
// Check if the user is a bot
if (member.user.bot) return message.error("economy/profile:BOT_USER"); if (member.user.bot) return message.error("economy/profile:BOT_USER");
// Gets the data of the user whose profile you want to display const memberData = (member.id === message.author.id ? data.memberData : await client.findOrCreateMember({
const memberData = (member.id === message.author.id ? data.memberData : await client.findOrCreateMember({ id: member.id, guildID: message.guild.id})); id: member.id,
const userData = (member.id === message.author.id ? data.userData : await client.findOrCreateUser({ id: member.id })); guildID: message.guild.id
}));
// Check if the lover is cached const userData = (member.id === message.author.id ? data.userData : await client.findOrCreateUser({
id: member.id
}));
if (userData.lover && !this.client.users.cache.get(userData.lover)) await this.client.users.fetch(userData.lover, true); if (userData.lover && !this.client.users.cache.get(userData.lover)) await this.client.users.fetch(userData.lover, true);
const commonsGuilds = client.guilds.cache.filter((g) => g.members.cache.get(member.id)); const commonsGuilds = client.guilds.cache.filter((g) => g.members.cache.get(member.id));
let globalMoney = 0; let globalMoney = 0;
await asyncForEach(commonsGuilds.array(), async (guild) => { await asyncForEach(commonsGuilds.array(), async (guild) => {
const memberData = await client.findOrCreateMember({ id: member.id, guildID: guild.id }); const memberData = await client.findOrCreateMember({
id: member.id,
guildID: guild.id
});
globalMoney += memberData.money; globalMoney += memberData.money;
globalMoney += memberData.bankSold; globalMoney += memberData.bankSold;
}); });
@ -51,8 +54,15 @@ class Profile extends Command {
const profileEmbed = new Discord.MessageEmbed() const profileEmbed = new Discord.MessageEmbed()
.setAuthor(message.translate("economy/profile:TITLE", { .setAuthor(message.translate("economy/profile:TITLE", {
username: member.user.tag username: member.user.tag
}), member.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) }), member.user.displayAvatarURL({
.attachFiles([{ attachment: await userData.getAchievements(), name: "achievements.png" }]) size: 512,
dynamic: true,
format: "png"
}))
.attachFiles([{
attachment: await userData.getAchievements(),
name: "achievements.png"
}])
.setImage("attachment://achievements.png") .setImage("attachment://achievements.png")
// .setDescription(userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")) // .setDescription(userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO"))
.addField(message.translate("economy/profile:BIO"), userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")) .addField(message.translate("economy/profile:BIO"), userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO"))

View file

@ -18,12 +18,16 @@ class Rep extends Command {
async run(message, args, data) { async run(message, args, data) {
// if the member is already in the cooldown db // if the member is already in the cooldown db
const isInCooldown = (data.userData.cooldowns || { rep: 0 }).rep; const isInCooldown = (data.userData.cooldowns || {
rep: 0
}).rep;
if (isInCooldown) { if (isInCooldown) {
/*if the timestamp recorded in the database indicating /*if the timestamp recorded in the database indicating
when the member will be able to execute the order again when the member will be able to execute the order again
is greater than the current date, display an error message */ is greater than the current date, display an error message */
if (isInCooldown > Date.now()) return message.error("economy/rep:COOLDOWN", { time: message.convertTime(isInCooldown, "to", true) }); if (isInCooldown > Date.now()) return message.error("economy/rep:COOLDOWN", {
time: message.convertTime(isInCooldown, "to", true)
});
}; };
const user = await this.client.resolveUser(args[0]); const user = await this.client.resolveUser(args[0]);
@ -38,19 +42,28 @@ class Rep extends Command {
data.userData.markModified("cooldowns"); data.userData.markModified("cooldowns");
data.userData.save(); data.userData.save();
const userData = await this.client.findOrCreateUser({ id: user.id }); const userData = await this.client.findOrCreateUser({
id: user.id
});
userData.rep++; userData.rep++;
if (!userData.achievements.rep.achieved) { if (!userData.achievements.rep.achieved) {
userData.achievements.rep.progress.now = (userData.rep > userData.achievements.rep.progress.total ? userData.achievements.rep.progress.total : userData.rep); userData.achievements.rep.progress.now = (userData.rep > userData.achievements.rep.progress.total ? userData.achievements.rep.progress.total : userData.rep);
if (userData.achievements.rep.progress.now >= userData.achievements.rep.progress.total) { if (userData.achievements.rep.progress.now >= userData.achievements.rep.progress.total) {
userData.achievements.rep.achieved = true; userData.achievements.rep.achieved = true;
message.channel.send({ files: [ { name: "unlocked.png", attachment: "./assets/img/achievements/achievement_unlocked6.png"}]}); message.channel.send({
files: [{
name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked6.png"
}]
});
}; };
userData.markModified("achievements.rep"); userData.markModified("achievements.rep");
}; };
await userData.save(); await userData.save();
message.success("economy/rep:SUCCESS", { username: user.username }); message.success("economy/rep:SUCCESS", {
username: user.username
});
} }
}; };

View file

@ -22,21 +22,34 @@ class Rob extends Command {
if (member.id === message.author.id) return message.error("economy/rob:YOURSELF"); if (member.id === message.author.id) return message.error("economy/rob: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
});
const isInCooldown = memberData.cooldowns.rob || 0; const isInCooldown = memberData.cooldowns.rob || 0;
if (isInCooldown) { if (isInCooldown) {
if (isInCooldown > Date.now()) return message.error("economy/rob:COOLDOWN", { username: member.user.tag }); if (isInCooldown > Date.now()) return message.error("economy/rob:COOLDOWN", {
username: member.user.tag
});
}; };
let amountToRob = args[1]; let amountToRob = args[1];
if (!amountToRob || isNaN(amountToRob) || parseInt(amountToRob, 10) <= 0) return message.error("economy/rob:MISSING_AMOUNT", { username: member.user.username }); if (!amountToRob || isNaN(amountToRob) || parseInt(amountToRob, 10) <= 0) return message.error("economy/rob:MISSING_AMOUNT", {
username: member.user.username
});
amountToRob = Math.floor(parseInt(amountToRob, 10)); amountToRob = Math.floor(parseInt(amountToRob, 10));
if (amountToRob > memberData.money) return message.error("economy/rob:NOT_ENOUGH_MEMBER", { username: member.user.username, money: amountToRob }); if (amountToRob > memberData.money) return message.error("economy/rob:NOT_ENOUGH_MEMBER", {
username: member.user.username,
money: amountToRob
});
const potentiallyLose = Math.floor(amountToRob * 1.5); const potentiallyLose = Math.floor(amountToRob * 1.5);
if (potentiallyLose > data.memberData.money) return message.error("economy/rob:NOT_ENOUGH_AUTHOR", { moneyMin: potentiallyLose, moneyCurrent: data.memberData.money }); if (potentiallyLose > data.memberData.money) return message.error("economy/rob:NOT_ENOUGH_AUTHOR", {
moneyMin: potentiallyLose,
moneyCurrent: data.memberData.money
});
const itsAWon = Math.floor(this.client.functions.randomNum(0, 100) < 25); const itsAWon = Math.floor(this.client.functions.randomNum(0, 100) < 25);
@ -46,7 +59,10 @@ class Rob extends Command {
memberData.markModified("cooldowns"); memberData.markModified("cooldowns");
await memberData.save(); await memberData.save();
const randomNum = Math.floor(this.client.functions.randomNum(1, 3)); const randomNum = Math.floor(this.client.functions.randomNum(1, 3));
message.sendT("economy/rob:ROB_WON_" + randomNum, { money: amountToRob, username: member.user.username }); message.sendT("economy/rob:ROB_WON_" + randomNum, {
money: amountToRob,
username: member.user.username
});
data.memberData.money += amountToRob; data.memberData.money += amountToRob;
memberData.money -= amountToRob, 10; memberData.money -= amountToRob, 10;
memberData.save(); memberData.save();
@ -54,7 +70,11 @@ class Rob extends Command {
} else { } else {
const won = Math.floor(0.9 * amountToRob); const won = Math.floor(0.9 * amountToRob);
const randomNum = Math.floor(this.client.functions.randomNum(1, 3)); const randomNum = Math.floor(this.client.functions.randomNum(1, 3));
message.sendT("economy/rob:ROB_LOSE_" + randomNum, { fine: potentiallyLose, offset: won, username: member.user.username }); message.sendT("economy/rob:ROB_LOSE_" + randomNum, {
fine: potentiallyLose,
offset: won,
username: member.user.username
});
data.memberData.money -= potentiallyLose; data.memberData.money -= potentiallyLose;
memberData.money += won; memberData.money += won;
memberData.save(); memberData.save();

View file

@ -33,7 +33,6 @@ class Slots extends Command {
// Gets the amount provided // Gets the amount provided
let amount = args[0]; let amount = args[0];
if (!amount || isNaN(amount) || amount < 1) amount = 1; if (!amount || isNaN(amount) || amount < 1) amount = 1;
if (amount > data.memberData.money) return message.error("economy/slots:NOT_ENOUGH", { money: amount }); if (amount > data.memberData.money) return message.error("economy/slots:NOT_ENOUGH", { money: amount });
amount = Math.round(amount); amount = Math.round(amount);
@ -47,7 +46,9 @@ class Slots extends Command {
return Math.round(number); return Math.round(number);
}; };
const tmsg = await message.sendT("misc:loading", null, { prefixEmoji: "loading" }); const tmsg = await message.sendT("misc:loading", null, {
prefixEmoji: "loading"
});
editMsg(); editMsg();
const interval = setInterval(editMsg, 1000); const interval = setInterval(editMsg, 1000);
setTimeout(() => { setTimeout(() => {
@ -76,14 +77,23 @@ class Slots extends Command {
msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |"; msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |";
tmsg.edit(msg); tmsg.edit(msg);
const credits = getCredits(amount, true); const credits = getCredits(amount, true);
message.channel.send("**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", { money: amount, won: credits, username: message.author.username })); message.channel.send("**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", {
money: amount,
won: credits,
username: message.author.username
}));
const toAdd = credits - amount; const toAdd = credits - amount;
data.memberData.money = data.memberData.money + toAdd; data.memberData.money = data.memberData.money + toAdd;
if (!data.userData.achievements.slots.achieved) { if (!data.userData.achievements.slots.achieved) {
data.userData.achievements.slots.progress.now += 1; data.userData.achievements.slots.progress.now += 1;
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) { if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
data.userData.achievements.slots.achieved = true; data.userData.achievements.slots.achieved = true;
message.channel.send({ files: [ { name: "unlocked.png", attachment: "./assets/img/achievements/achievement_unlocked4.png" } ] }); message.channel.send({
files: [{
name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked4.png"
}]
});
}; };
data.userData.markModified("achievements.slots"); data.userData.markModified("achievements.slots");
await data.userData.save(); await data.userData.save();
@ -107,7 +117,12 @@ class Slots extends Command {
data.userData.achievements.slots.progress.now += 1; data.userData.achievements.slots.progress.now += 1;
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) { if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
data.userData.achievements.slots.achieved = true; data.userData.achievements.slots.achieved = true;
message.channel.send({ files: [ { name: "unlocked.png", attachment: "./assets/img/achievements/achievement_unlocked4.png" } ] }); message.channel.send({
files: [{
name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked4.png"
}]
});
}; };
data.userData.markModified("achievements.slots"); data.userData.markModified("achievements.slots");
await data.userData.save(); await data.userData.save();

View file

@ -35,7 +35,9 @@ class Withdraw extends Command {
data.memberData.bankSold = data.memberData.bankSold - amount; data.memberData.bankSold = data.memberData.bankSold - amount;
data.memberData.save(); data.memberData.save();
message.success("economy/withdraw:SUCCESS", { money: amount }); message.success("economy/withdraw:SUCCESS", {
money: amount
});
} }
}; };

View file

@ -24,7 +24,9 @@ class Work extends Command {
/*if the timestamp recorded in the database indicating /*if the timestamp recorded in the database indicating
when the member will be able to execute the order again when the member will be able to execute the order again
is greater than the current date, display an error message */ is greater than the current date, display an error message */
if (isInCooldown > Date.now()) return message.error("economy/work:COOLDOWN", { time: message.convertTime(isInCooldown, "to", true) }); if (isInCooldown > Date.now()) return message.error("economy/work:COOLDOWN", {
time: message.convertTime(isInCooldown, "to", true)
});
}; };
if (Date.now() > data.memberData.cooldowns.work + (24 * 3600000)) data.memberData.workStreak = 0; if (Date.now() > data.memberData.cooldowns.work + (24 * 3600000)) data.memberData.workStreak = 0;
@ -38,7 +40,11 @@ class Work extends Command {
await data.memberData.save(); await data.memberData.save();
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setFooter(message.translate("economy/work:AWARD"), message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setFooter(message.translate("economy/work:AWARD"), message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.setColor(data.config.embed.color); .setColor(data.config.embed.color);
const award = [ const award = [
@ -52,7 +58,9 @@ class Work extends Command {
if (data.memberData.workStreak >= 5) { if (data.memberData.workStreak >= 5) {
won += 200; won += 200;
embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", { won })) embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", {
won
}))
.addField(message.translate("economy/work:STREAK"), message.translate("economy/work:STREAK_CONTENT")); .addField(message.translate("economy/work:STREAK"), message.translate("economy/work:STREAK_CONTENT"));
data.memberData.workStreak = 0; data.memberData.workStreak = 0;
} else { } else {
@ -62,23 +70,25 @@ class Work extends Command {
award[i] = `:regional_indicator_${letter.toLowerCase()}:`; award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
}; };
}; };
embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", { won })) embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", {
won
}))
.addField(message.translate("economy/work:STREAK"), award.join("")); .addField(message.translate("economy/work:STREAK"), award.join(""));
}; };
data.memberData.money = data.memberData.money + won; data.memberData.money = data.memberData.money + won;
data.memberData.save(); data.memberData.save();
const messageOptions = { embed }; const messageOptions = {
embed
};
if (!data.userData.achievements.work.achieved) { if (!data.userData.achievements.work.achieved) {
data.userData.achievements.work.progress.now += 1; data.userData.achievements.work.progress.now += 1;
if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) { if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) {
messageOptions.files = [ messageOptions.files = [{
{
name: "unlocked.png", name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked1.png" attachment: "./assets/img/achievements/achievement_unlocked1.png"
} }];
];
data.userData.achievements.work.achieved = true; data.userData.achievements.work.achieved = true;
}; };
data.userData.markModified("achievements.work"); data.userData.markModified("achievements.work");

View file

@ -24,6 +24,8 @@ class Ascii extends Command {
if (!text || text.length > 20) return message.error("fun/ascii:TEXT_MISSING"); if (!text || text.length > 20) return message.error("fun/ascii:TEXT_MISSING");
const rendered = await figletAsync(text); const rendered = await figletAsync(text);
if (!rendered) rendered = await figletAsync("Nothing");
message.channel.send("```" + rendered + "```"); message.channel.send("```" + rendered + "```");
} }
}; };

View file

@ -25,7 +25,9 @@ class Choice extends Command {
const m = await message.sendT("fun/choice:PROGRESS", null, false, false, "loading"); const m = await message.sendT("fun/choice:PROGRESS", null, false, false, "loading");
setTimeout(() => { setTimeout(() => {
m.success("fun/choice:DONE", null, { edit: true }); m.success("fun/choice:DONE", null, {
edit: true
});
const result = answers[parseInt(Math.floor(Math.random() * answers.length))]; const result = answers[parseInt(Math.floor(Math.random() * answers.length))];
message.channel.send("```" + result + "```"); message.channel.send("```" + result + "```");
}, 1500); }, 1500);

View file

@ -55,7 +55,9 @@ class FindWords extends Command {
setTimeout(() => { setTimeout(() => {
// Send announcment message // Send announcment message
message.sendT("fun/findwords:FIND_WORD", { word }, false, false, "warn"); message.sendT("fun/findwords:FIND_WORD", {
word
}, false, false, "warn");
// init a collector to receive the answers // init a collector to receive the answers
const collector = new Discord.MessageCollector(message.channel, (m) => !m.author.bot, { const collector = new Discord.MessageCollector(message.channel, (m) => !m.author.bot, {
@ -69,7 +71,9 @@ class FindWords extends Command {
if (msg.content.toLowerCase().indexOf(word) >= 0 && wordList.map((word) => word.toLowerCase()).indexOf(msg.content.toLowerCase()) >= 0) { if (msg.content.toLowerCase().indexOf(word) >= 0 && wordList.map((word) => word.toLowerCase()).indexOf(msg.content.toLowerCase()) >= 0) {
collector.stop(msg.author.id); // Stop the collector collector.stop(msg.author.id); // Stop the collector
} else { } else {
msg.error("fun/findwords:INVALID_WORD", { member: msg.author.toString() }); msg.error("fun/findwords:INVALID_WORD", {
member: msg.author.toString()
});
}; };
}); });
@ -77,7 +81,9 @@ class FindWords extends Command {
if (reason === "time") { if (reason === "time") {
message.error("fun/findwords:NO_WINNER"); message.error("fun/findwords:NO_WINNER");
} else { } else {
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) {
@ -97,8 +103,13 @@ class FindWords extends Command {
participantList: participants.map((p) => `<@${p}>`).join("\n") participantList: participants.map((p) => `<@${p}>`).join("\n")
}); });
if (participants.length > 1 && data.guild.disabledCategories && !data.guild.disabledCategories.includes("Economy")) { if (participants.length > 1 && data.guild.disabledCategories && !data.guild.disabledCategories.includes("Economy")) {
message.sendT("fun/findwords:CREDITS", { winner: user.username }); message.sendT("fun/findwords:CREDITS", {
const userdata = await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id }); winner: user.username
});
const userdata = await this.client.findOrCreateMember({
id: user.id,
guildID: message.guild.id
});
userdata.money = userdata.money + 15; userdata.money = userdata.money + 15;
userdata.save(); userdata.save();
}; };

View file

@ -37,8 +37,12 @@ class Lovecalc extends Command {
const percent = parseInt(string.substr(0, 2), 10); const percent = parseInt(string.substr(0, 2), 10);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor("❤️ LoveCalc") .setAuthor(`❤️ ${message.translate("fun/lovecalc:DESCRIPTION")}`)
.setDescription(message.translate("fun/lovecalc:CONTENT", { percent, firstUsername: firstMember.user.username, secondUsername: secondMember.user.username })) .setDescription(message.translate("fun/lovecalc:CONTENT", {
percent,
firstUsername: firstMember.user.username,
secondUsername: secondMember.user.username
}))
.setColor(this.client.config.embed.color) .setColor(this.client.config.embed.color)
.setFooter(this.client.config.embed.footer); .setFooter(this.client.config.embed.footer);

View file

@ -38,28 +38,46 @@ class Number extends Command {
collector.on("collect", async msg => { collector.on("collect", async msg => {
if (!participants.includes(msg.author.id)) participants.push(msg.author.id); if (!participants.includes(msg.author.id)) participants.push(msg.author.id);
// if it's not a number, return
if (isNaN(msg.content)) return; if (isNaN(msg.content)) return;
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", {
message.sendT("fun/number:WON", { winner: msg.author.toString() }); winner: msg.author.toString(),
const userdata = await this.client.findOrCreateMember({ id: msg.author.id, guildID: message.guild.id }); number,
time,
participantCount: participants.length,
participants: participants.map(p => `<@${p}>`).join("\n")
});
message.sendT("fun/number:WON", {
winner: msg.author.toString()
});
const userdata = await this.client.findOrCreateMember({
id: msg.author.id,
guildID: message.guild.id
});
userdata.money = userdata.money + 10; userdata.money = userdata.money + 10;
userdata.save(); userdata.save();
collector.stop(msg.author.username); collector.stop(msg.author.username);
}; };
if (parseInt(msg.content) < number) message.error("fun/number:BIG", { user: msg.author.toString(), number: parsedNumber }); if (parseInt(msg.content) < number) message.error("fun/number:BIG", {
if (parseInt(msg.content) > number) message.error("fun/number:SMALL", { user: msg.author.toString(), number: parsedNumber }); user: msg.author.toString(),
number: parsedNumber
});
if (parseInt(msg.content) > number) message.error("fun/number:SMALL", {
user: msg.author.toString(),
number: parsedNumber
});
}); });
collector.on("end", (_collected, reason) => { collector.on("end", (_collected, reason) => {
delete currentGames[message.guild.id]; delete currentGames[message.guild.id];
if (reason === "time") { if (reason === "time") {
return message.error("fun/number:DEFEAT", { number }); return message.error("fun/number:DEFEAT", {
number
});
}; };
}); });
} }

View file

@ -29,7 +29,9 @@ class Fortnite extends Command {
const user = args.slice(1).join(" "); const user = args.slice(1).join(" ");
if (!user) return message.error("general/fortnite:MISSING_USERNAME"); if (!user) return message.error("general/fortnite:MISSING_USERNAME");
const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const statsImage = await stats const statsImage = await stats
.setToken(data.config.apiKeys.fortniteTRN) .setToken(data.config.apiKeys.fortniteTRN)
@ -51,13 +53,18 @@ class Fortnite extends Command {
if (!statsImage) { if (!statsImage) {
m.delete(); m.delete();
return message.error("general/fortnite:NOT_FOUND", { platform, search: user }); return message.error("general/fortnite:NOT_FOUND", {
platform,
search: user
});
}; };
// Send embed // Send embed
const attachment = new Discord.MessageAttachment(statsImage.toBuffer(), "fortnite-stats-image.png"), const attachment = new Discord.MessageAttachment(statsImage.toBuffer(), "fortnite-stats-image.png"),
embed = new Discord.MessageEmbed() embed = new Discord.MessageEmbed()
.setDescription(message.translate("general/fortnite:TITLE", { username: `[${stats.data.username}](${stats.data.url.replace(new RegExp(" ", "g"), "%20")})` })) .setDescription(message.translate("general/fortnite:TITLE", {
username: `[${stats.data.username}](${stats.data.url.replace(new RegExp(" ", "g"), "%20")})`
}))
.attachFiles(attachment) .attachFiles(attachment)
.setImage("attachment://fortnite-stats-image.png") .setImage("attachment://fortnite-stats-image.png")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)

View file

@ -21,7 +21,9 @@ class Fortniteshop extends Command {
async run(message, args, data) { async run(message, args, data) {
if (!data.config.apiKeys.fortniteFNBR || data.config.apiKeys.fortniteFNBR.length === "") return message.error("misc:COMMAND_DISABLED"); if (!data.config.apiKeys.fortniteFNBR || data.config.apiKeys.fortniteFNBR.length === "") return message.error("misc:COMMAND_DISABLED");
const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment; const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment;
const shop = new Canvas.FortniteShop(); const shop = new Canvas.FortniteShop();
@ -30,14 +32,22 @@ class Fortniteshop extends Command {
.setText("header", message.translate("general/fortniteshop:HEADER")) .setText("header", message.translate("general/fortniteshop:HEADER"))
.setText("daily", message.translate("general/fortniteshop:DAILY")) .setText("daily", message.translate("general/fortniteshop:DAILY"))
.setText("featured", message.translate("general/fortniteshop:FEATURED")) .setText("featured", message.translate("general/fortniteshop:FEATURED"))
.setText("date", message.translate("general/fortniteshop:DATE", { skipInterpolation: true }).replace("{{date}}", "{date}")) .setText("date", message.translate("general/fortniteshop:DATE", {
skipInterpolation: true
}).replace("{{date}}", "{date}"))
.setText("footer", message.translate("general/fortniteshop:FOOTER")) .setText("footer", message.translate("general/fortniteshop:FOOTER"))
.lang(momentName) .lang(momentName)
.toAttachment(); .toAttachment();
const attachment = new Discord.MessageAttachment(image, "shop.png"); const attachment = new Discord.MessageAttachment(image, "shop.png");
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/fortniteshop:HEADER", { date: message.printDate(new Date(Date.now())) }), this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setAuthor(message.translate("general/fortniteshop:HEADER", {
date: message.printDate(new Date(Date.now()))
}), this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.attachFiles(attachment) .attachFiles(attachment)
.setImage("attachment://shop.png") .setImage("attachment://shop.png")
.setColor(this.client.config.embed.color) .setColor(this.client.config.embed.color)

View file

@ -19,11 +19,17 @@ class Github extends Command {
} }
async run(message, args, data) { async run(message, args, data) {
const res = await fetch("https://api.github.com/repos/JonnyBro/JaBa-new"); const res = await fetch("https://api.github.com/repos/JonnyBro/JaBa-new", {
headers: `Authorization: ${this.config.githubToken}`
});
const json = await res.json(); const json = await res.json();
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(this.client.user.tag, this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setAuthor(this.client.user.tag, this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.setDescription(`[${message.translate("general/github:CLICK_HERE")}](https://github.com/JonnyBro/JaBa-new)`) .setDescription(`[${message.translate("general/github:CLICK_HERE")}](https://github.com/JonnyBro/JaBa-new)`)
.addField("Stars", json.stargazers_count, true) .addField("Stars", json.stargazers_count, true)
.addField("Forks", json.forks_count, true) .addField("Forks", json.forks_count, true)

View file

@ -26,7 +26,9 @@ class Hastebin extends Command {
const res = await fetch("https://hastebin.com/documents", { const res = await fetch("https://hastebin.com/documents", {
method: "POST", method: "POST",
body: content, body: content,
headers: { "Content-Type": "text/plain" } headers: {
"Content-Type": "text/plain"
}
}); });
const json = await res.json(); const json = await res.json();

View file

@ -18,25 +18,33 @@ class Help extends Command {
} }
async run(message, args, data) { async run(message, args, data) {
// if a command is provided
if (args[0]) { if (args[0]) {
const isCustom = (message.guild && data.guild.customCommands ? data.guild.customCommands.find((c) => c.name === args[0]) : false); const isCustom = (message.guild && data.guild.customCommands ? data.guild.customCommands.find((c) => c.name === args[0]) : false);
// if the command doesn't exist, error message
const cmd = this.client.commands.get(args[0]) || this.client.commands.get(this.client.aliases.get(args[0])); const cmd = this.client.commands.get(args[0]) || this.client.commands.get(this.client.aliases.get(args[0]));
if (!cmd && isCustom) { if (!cmd && isCustom) {
return message.error("general/help:CUSTOM", { cmd: args[0] }); return message.error("general/help:CUSTOM", {
cmd: args[0]
});
} else if (!cmd) { } else if (!cmd) {
return message.error("general/help:NOT_FOUND", { search: args[0] }); return message.error("general/help:NOT_FOUND", {
search: args[0]
});
}; };
const description = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:DESCRIPTION`); const description = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:DESCRIPTION`);
const usage = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:USAGE`, { prefix: message.guild ? data.guild.prefix : "" }); const usage = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:USAGE`, {
const examples = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:EXAMPLES`, { prefix: message.guild ? data.guild.prefix : "" }); prefix: message.guild ? data.guild.prefix : ""
});
const examples = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:EXAMPLES`, {
prefix: message.guild ? data.guild.prefix : ""
});
// Creates the help embed
const groupEmbed = new Discord.MessageEmbed() const groupEmbed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/help:CMD_TITLE", { prefix: message.guild ? data.guild.prefix : "", cmd: cmd.help.name })) .setAuthor(message.translate("general/help:CMD_TITLE", {
prefix: message.guild ? data.guild.prefix : "",
cmd: cmd.help.name
}))
.addField(message.translate("general/help:FIELD_DESCRIPTION"), description) .addField(message.translate("general/help:FIELD_DESCRIPTION"), description)
.addField(message.translate("general/help:FIELD_USAGE"), usage) .addField(message.translate("general/help:FIELD_USAGE"), usage)
.addField(message.translate("general/help:FIELD_EXAMPLES"), examples) .addField(message.translate("general/help:FIELD_EXAMPLES"), examples)
@ -45,7 +53,6 @@ class Help extends Command {
.setColor(this.client.config.embed.color) .setColor(this.client.config.embed.color)
.setFooter(this.client.config.embed.footer); .setFooter(this.client.config.embed.footer);
// and send the embed in the current channel
return message.channel.send(groupEmbed); return message.channel.send(groupEmbed);
}; };
@ -62,7 +69,9 @@ class Help extends Command {
const emojis = this.client.customEmojis; const emojis = this.client.customEmojis;
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setDescription(message.translate("general/help:INFO", { prefix: message.guild ? data.guild.prefix : "" })) .setDescription(message.translate("general/help:INFO", {
prefix: message.guild ? data.guild.prefix : ""
}))
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
categories.sort().forEach((cat) => { categories.sort().forEach((cat) => {
@ -78,7 +87,13 @@ class Help extends Command {
donateLink: "https://qiwi.com/n/JONNYBRO", donateLink: "https://qiwi.com/n/JONNYBRO",
owner: this.client.config.owner.id owner: this.client.config.owner.id
})); }));
embed.setAuthor(message.translate("general/help:TITLE", { name: this.client.user.username }), this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })); embed.setAuthor(message.translate("general/help:TITLE", {
name: this.client.user.username
}), this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}));
return message.channel.send(embed); return message.channel.send(embed);
} }
}; };

View file

@ -21,7 +21,6 @@ class Invitations extends Command {
let member = await this.client.resolveMember(args[0], message.guild); let member = await this.client.resolveMember(args[0], message.guild);
if (!member) member = message.member; if (!member) member = message.member;
// Gets the invites
const invites = await message.guild.fetchInvites().catch(() => {}); const invites = await message.guild.fetchInvites().catch(() => {});
if (!invites) return message.error("misc:ERR_OCCURRED"); if (!invites) return message.error("misc:ERR_OCCURRED");
@ -31,12 +30,18 @@ class Invitations extends Command {
if (member === message.member) { if (member === message.member) {
return message.error("general/invitations:NOBODY_AUTHOR"); return message.error("general/invitations:NOBODY_AUTHOR");
} else { } else {
return message.error("general/invitations:NOBODY_MEMBER", { member: member.user.tag }); return message.error("general/invitations:NOBODY_MEMBER", {
member: member.user.tag
});
}; };
}; };
const content = memberInvites.map((i) => { const content = memberInvites.map((i) => {
return message.translate("general/invitations:CODE", { uses: i.uses, code: i.code, channel: i.channel.toString() }); return message.translate("general/invitations:CODE", {
uses: i.uses,
code: i.code,
channel: i.channel.toString()
});
}).join("\n"); }).join("\n");
let index = 0; let index = 0;
memberInvites.forEach((invite) => index += invite.uses); memberInvites.forEach((invite) => index += invite.uses);

View file

@ -18,15 +18,17 @@ class Invite extends Command {
} }
async run(message, args, data) { async run(message, args, data) {
const inviteLink = this.client.config.inviteURL || `https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=8`; const inviteLink = `https://discordapp.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=8`;
const voteURL = this.client.config.voteURL || `https://discordbots.org/bot/${this.client.user.id}/vote`; const voteURL = `https://discordbots.org/bot/${this.client.user.id}/vote`;
const supportURL = this.client.config.supportURL || await this.client.functions.supportLink(this.client); const supportURL = await this.client.functions.supportLink(this.client);
if (args[0] && args[0] === "copy") return message.channel.send(inviteLink); if (args[0] && args[0] === "copy") return message.channel.send(inviteLink);
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/invite:LINKS")) .setAuthor(message.translate("general/invite:LINKS"))
.setDescription(message.translate("general/invite:TIP", { prefix: data.guild.prefix || "" })) .setDescription(message.translate("general/invite:TIP", {
prefix: data.guild.prefix || ""
}))
.addField(message.translate("general/invite:ADD"), inviteLink) .addField(message.translate("general/invite:ADD"), inviteLink)
.addField(message.translate("general/invite:VOTE"), voteURL) .addField(message.translate("general/invite:VOTE"), voteURL)
.addField(message.translate("general/invite:SUPPORT"), supportURL) .addField(message.translate("general/invite:SUPPORT"), supportURL)

View file

@ -31,7 +31,7 @@ class Minecraft extends Command {
}; };
if (ip.split(":").length > 1) { if (ip.split(":").length > 1) {
const ip = ip.split(":") const ip = ip.split(":");
options = { options = {
type: "minecraft", type: "minecraft",
host: ip[0], host: ip[0],
@ -39,7 +39,9 @@ class Minecraft extends Command {
}; };
}; };
const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
let json = null; let json = null;
@ -64,10 +66,16 @@ class Minecraft extends Command {
const imgAttachment = new Discord.MessageAttachment(await imgRes.buffer(), "success.png"); const imgAttachment = new Discord.MessageAttachment(await imgRes.buffer(), "success.png");
const mcEmbed = new Discord.MessageEmbed() const mcEmbed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/minecraft:FIELD_NAME", { ip: json.name })) .setAuthor(message.translate("general/minecraft:FIELD_NAME", {
ip: json.name
}))
.addField(message.translate("general/minecraft:FIELD_VERSION"), json.raw.vanilla.raw.version.name) .addField(message.translate("general/minecraft:FIELD_VERSION"), json.raw.vanilla.raw.version.name)
.addField(message.translate("general/minecraft:FIELD_CONNECTED"), message.translate("general/minecraft:PLAYERS", { count: (json.raw.players ? json.raw.players.online : json.players.length) })) .addField(message.translate("general/minecraft:FIELD_CONNECTED"), message.translate("general/minecraft:PLAYERS", {
.addField(message.translate("general/minecraft:FIELD_MAX"), message.translate("general/minecraft:PLAYERS", { count: (json.raw.players ? json.raw.players.max : json.maxplayers) })) count: (json.raw.players ? json.raw.players.online : json.players.length)
}))
.addField(message.translate("general/minecraft:FIELD_MAX"), message.translate("general/minecraft:PLAYERS", {
count: (json.raw.players ? json.raw.players.max : json.maxplayers)
}))
.addField(message.translate("general/minecraft:FIELD_STATUS"), message.translate("general/minecraft:ONLINE")) .addField(message.translate("general/minecraft:FIELD_STATUS"), message.translate("general/minecraft:ONLINE"))
.addField(message.translate("general/minecraft:FIELD_IP"), json.connect) .addField(message.translate("general/minecraft:FIELD_IP"), json.connect)
.setColor(data.config.embed.color) .setColor(data.config.embed.color)

View file

@ -1,5 +1,6 @@
const Command = require("../../base/Command.js"), const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
const permissions = Object.keys(Discord.Permissions.FLAGS); const permissions = Object.keys(Discord.Permissions.FLAGS);
class Permissions extends Command { class Permissions extends Command {

View file

@ -17,8 +17,14 @@ class Ping extends Command {
} }
async run(message) { async run(message) {
message.sendT("general/ping:CONTENT", { ping: "..." }).then((m) => { message.sendT("general/ping:CONTENT", {
m.sendT("general/ping:CONTENT", { ping: m.createdTimestamp - message.createdTimestamp }, { edit: true }); ping: "..."
}).then((m) => {
m.sendT("general/ping:CONTENT", {
ping: m.createdTimestamp - message.createdTimestamp
}, {
edit: true
});
}); });
} }
}; };

View file

@ -20,7 +20,11 @@ class Quote extends Command {
async run(message, args, data) { async run(message, args, data) {
function embed(m) { function embed(m) {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(m.author.tag, m.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setAuthor(m.author.tag, m.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.setDescription(m.content) .setDescription(m.content)
.setColor(m.member ? m.member.roles.highest ? m.member.roles.highest.color : data.config.embed.color : data.config.embed.color) .setColor(m.member ? m.member.roles.highest ? m.member.roles.highest.color : data.config.embed.color : data.config.embed.color)
.setFooter(m.guild.name + " | #" + m.channel.name) .setFooter(m.guild.name + " | #" + m.channel.name)
@ -45,7 +49,9 @@ class Quote extends Command {
if (!channel) { if (!channel) {
message.author.send(message.translate("general/quote:NO_MESSAGE_ID")).then(() => { message.author.send(message.translate("general/quote:NO_MESSAGE_ID")).then(() => {
message.delete(); message.delete();
}).catch(() => { message.error("misc:CANNOT_DM") }); }).catch(() => {
message.error("misc:CANNOT_DM")
});
return; return;
}; };
}; };
@ -54,7 +60,9 @@ class Quote extends Command {
message.channel.messages.fetch(msgID).catch(() => { message.channel.messages.fetch(msgID).catch(() => {
message.author.send((message.translate("general/quote:NO_MESSAGE_ID"))).then(() => { message.author.send((message.translate("general/quote:NO_MESSAGE_ID"))).then(() => {
message.delete(); message.delete();
}).catch(() => { message.error("misc:CANNOT_DM") }); }).catch(() => {
message.error("misc:CANNOT_DM")
});
return; return;
}).then((msg) => { }).then((msg) => {
message.delete(); message.delete();
@ -64,7 +72,9 @@ class Quote extends Command {
channel.messages.fetch(msgID).catch(() => { channel.messages.fetch(msgID).catch(() => {
message.author.send(message.translate("general/quote:NO_MESSAGE_ID")).then(() => { message.author.send(message.translate("general/quote:NO_MESSAGE_ID")).then(() => {
message.delete(); message.delete();
}).catch(() => { message.error("misc:CANNOT_DM") }); }).catch(() => {
message.error("misc:CANNOT_DM")
});
return; return;
}).then((msg) => { }).then((msg) => {
message.delete(); message.delete();

View file

@ -38,7 +38,6 @@ class Remindme extends Command {
data.userData.save(); data.userData.save();
this.client.databaseCache.usersReminds.set(message.author.id, data.userData); this.client.databaseCache.usersReminds.set(message.author.id, data.userData);
// Send success message
message.success("general/remindme:SAVED"); message.success("general/remindme:SAVED");
} }
}; };

View file

@ -29,7 +29,13 @@ class Report extends Command {
if (!rep) return message.error("general/report:MISSING_REASON"); if (!rep) return message.error("general/report:MISSING_REASON");
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/report:TITLE", { user: member.user.tag }), message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setAuthor(message.translate("general/report:TITLE", {
user: member.user.tag
}), message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.addField(message.translate("common:AUTHOR"), message.author.tag, true) .addField(message.translate("common:AUTHOR"), message.author.tag, 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:REASON"), `**${rep}**`, true) .addField(message.translate("common:REASON"), `**${rep}**`, true)
@ -45,7 +51,9 @@ class Report extends Command {
await m.react(error); await m.react(error);
}); });
message.success("general/report:SUCCESS", { channel: repChannel.toString() }); message.success("general/report:SUCCESS", {
channel: repChannel.toString()
});
} }
}; };

View file

@ -31,16 +31,30 @@ class Serverinfo extends Command {
await guild.members.fetch(); await guild.members.fetch();
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(guild.name, guild.iconURL({ dynamic: true })) .setAuthor(guild.name, guild.iconURL({
.setThumbnail(guild.iconURL({ dynamic: true })) dynamic: true
}))
.setThumbnail(guild.iconURL({
dynamic: true
}))
.addField(this.client.customEmojis.title + message.translate("common:NAME"), guild.name, true) .addField(this.client.customEmojis.title + message.translate("common:NAME"), guild.name, true)
.addField(this.client.customEmojis.calendar + message.translate("common:CREATION"), message.printDate(guild.createdAt), true) .addField(this.client.customEmojis.calendar + message.translate("common:CREATION"), message.printDate(guild.createdAt), true)
.addField(this.client.customEmojis.users + message.translate("common:MEMBERS"), message.translate("general/serverinfo:MEMBERS", { count: guild.members.cache.filter(m => !m.user.bot).size }) + " | " + message.translate("general/serverinfo:BOTS", { count: guild.members.cache.filter(m => m.user.bot).size }), true) .addField(this.client.customEmojis.users + message.translate("common:MEMBERS"), message.translate("general/serverinfo:MEMBERS", {
count: guild.members.cache.filter(m => !m.user.bot).size
}) + " | " + message.translate("general/serverinfo:BOTS", {
count: guild.members.cache.filter(m => m.user.bot).size
}), true)
.addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel || message.translate("general/serverinfo:NO_AFK_CHANNEL"), true) .addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel || message.translate("general/serverinfo:NO_AFK_CHANNEL"), true)
.addField(this.client.customEmojis.id + message.translate("common:ID"), guild.id, true) .addField(this.client.customEmojis.id + message.translate("common:ID"), guild.id, true)
.addField(this.client.customEmojis.crown + message.translate("common:OWNER"), guild.owner, true) .addField(this.client.customEmojis.crown + message.translate("common:OWNER"), guild.owner, true)
.addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount || 0, true) .addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount || 0, true)
.addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"), message.translate("general/serverinfo:TEXT_CHANNELS", { count: guild.channels.cache.filter(c => c.type === "text").size }) + " | " + message.translate("general/serverinfo:VOICE_CHANNELS", { count: guild.channels.cache.filter(c => c.type === "voice").size }) + " | " + message.translate("general/serverinfo:CAT_CHANNELS", { count: guild.channels.cache.filter(c => c.type === "category").size }), true) .addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"), message.translate("general/serverinfo:TEXT_CHANNELS", {
count: guild.channels.cache.filter(c => c.type === "text").size
}) + " | " + message.translate("general/serverinfo:VOICE_CHANNELS", {
count: guild.channels.cache.filter(c => c.type === "voice").size
}) + " | " + message.translate("general/serverinfo:CAT_CHANNELS", {
count: guild.channels.cache.filter(c => c.type === "category").size
}), true)
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);

View file

@ -20,8 +20,9 @@ class Setafk extends Command {
const reason = args.join(" "); const reason = args.join(" ");
if (!reason) return message.error("general/setafk:MISSING_REASON"); if (!reason) return message.error("general/setafk:MISSING_REASON");
// 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();

View file

@ -24,7 +24,11 @@ class Someone extends Command {
.addField(message.translate("common:USERNAME"), member.user.username, true) .addField(message.translate("common:USERNAME"), member.user.username, true)
.addField(message.translate("common:DISCRIMINATOR"), member.user.discriminator, true) .addField(message.translate("common:DISCRIMINATOR"), member.user.discriminator, true)
.addField(message.translate("common:ID"), member.user.id, true) .addField(message.translate("common:ID"), member.user.id, true)
.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);
} }

View file

@ -22,7 +22,9 @@ 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", { guild: message.guild.name })) .setAuthor(message.translate("general/staff:TITLE", {
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.id}>`).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.id}>`).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.id}>`).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.id}>`).join("\n") : message.translate("general/staff:NO_MODS")))
.setColor(data.config.embed.color) .setColor(data.config.embed.color)

View file

@ -23,11 +23,18 @@ class Stats extends Command {
.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", { servers: this.client.guilds.cache.size, users: this.client.users.cache.size }), true) .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)
.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", { time: message.convertTime(Date.now()+this.client.uptime, "from", true) })) .addField(this.client.customEmojis.status.online + " " + message.translate("general/stats:ONLINE_TITLE"), message.translate("general/stats:ONLINE_CONTENT", {
.addField(this.client.customEmojis.voice + " " + message.translate("general/stats:MUSIC_TITLE"), message.translate("general/stats:MUSIC_CONTENT", { count: this.client.voice.connections.size })) 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(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:)", "`FaxoNfuckyou#9398` и `Jonny_Bro#4226` (:flag_us:)"].join("\n") translators: ["`Jonny_Bro#4226` (:flag_ru:)", "`[ДАННЫЕ УДАЛЕНЫ]#2789` (:flag_ua:)", "`FaxoNfuckyou#9398` и `Jonny_Bro#4226` (:flag_us:)"].join("\n")

View file

@ -25,7 +25,13 @@ class Suggest extends Command {
if (!sugg) return message.error("general/suggest:MISSING_CONTENT"); if (!sugg) return message.error("general/suggest:MISSING_CONTENT");
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("general/suggest:TITLE", { user: message.author.username }), message.author.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setAuthor(message.translate("general/suggest:TITLE", {
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)
@ -40,7 +46,9 @@ class Suggest extends Command {
await m.react(error); await m.react(error);
}); });
message.success("general/suggest:SUCCESS", { channel: suggChannel.toString() }); message.success("general/suggest:SUCCESS", {
channel: suggChannel.toString()
});
} }
}; };

View file

@ -31,7 +31,9 @@ class Translate extends Command {
return; return;
}; };
const pWait = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); const pWait = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
if (!args[0]) return pWait.error("general/translate:MISSING_LANGUAGE", { prefix: data.guild.prefix }, { edit: true }); if (!args[0]) return pWait.error("general/translate:MISSING_LANGUAGE", { prefix: data.guild.prefix }, { edit: true });
if (!args[1]) return pWait.error("general/translate:MISSING_CONTENT", null, { edit: true }); if (!args[1]) return pWait.error("general/translate:MISSING_CONTENT", null, { edit: true });
@ -42,16 +44,24 @@ class Translate extends Command {
if (!langs.includes(language)) return pWait.error("general/translate:INVALID_LANGUAGE", { prefix: data.guild.prefix, search: language }, { edit: true }); if (!langs.includes(language)) return pWait.error("general/translate:INVALID_LANGUAGE", { prefix: data.guild.prefix, search: language }, { edit: true });
const translated = await translate(toTranslate, { to: language }); const translated = await translate(toTranslate, {
to: language
});
const resEmbed = new Discord.MessageEmbed() const resEmbed = new Discord.MessageEmbed()
.setAuthor("Translator", this.client.user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setAuthor("Translator", this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.addField(translated.from.language.iso, "```" + toTranslate + "```") .addField(translated.from.language.iso, "```" + toTranslate + "```")
.addField(language, "```" + translated.text + "```") .addField(language, "```" + translated.text + "```")
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
return pWait.edit("", { embed: resEmbed }); return pWait.edit("", {
embed: resEmbed
});
} }
}; };

View file

@ -41,13 +41,23 @@ class Userinfo extends Command {
if (message.guild) member = await message.guild.members.fetch(user).catch(() => {}); if (message.guild) member = await message.guild.members.fetch(user).catch(() => {});
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(user.tag, user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setAuthor(user.tag, user.displayAvatarURL({
.setThumbnail(user.displayAvatarURL({ dynamic: true })) size: 512,
dynamic: true,
format: "png"
}))
.setThumbnail(user.displayAvatarURL({
dynamic: true
}))
.addField(":man: " + message.translate("common:USERNAME"), user.username, true) .addField(":man: " + message.translate("common:USERNAME"), user.username, true)
.addField(this.client.customEmojis.discriminator + " " + message.translate("common:DISCRIMINATOR"), user.discriminator, true) .addField(this.client.customEmojis.discriminator + " " + message.translate("common:DISCRIMINATOR"), user.discriminator, true)
.addField(this.client.customEmojis.bot + " " + message.translate("common:ROBOT"), (user.bot ? message.translate("common:YES") : message.translate("common:NO")), true) .addField(this.client.customEmojis.bot + " " + message.translate("common:ROBOT"), (user.bot ? message.translate("common:YES") : message.translate("common:NO")), true)
.addField(this.client.customEmojis.calendar + " " + message.translate("common:CREATION"), message.printDate(user.createdAt), true) .addField(this.client.customEmojis.calendar + " " + message.translate("common:CREATION"), message.printDate(user.createdAt), true)
.addField(this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"), user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .addField(this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"), user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
@ -61,12 +71,16 @@ class Userinfo extends Command {
embed.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)
embed.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)
embed.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)
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(", "))); 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(", ")));
}; };
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) {

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("approved", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -20,10 +20,15 @@ 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({
if (message.content.includes("-v")) message.channel.send(`<${avatarURL}>`); size: 512,
const attachment = new Discord.MessageAttachment(avatarURL, `avatar.${avatarURL.split(".").pop().split("?")[0]}`); dynamic: true,
format: "png"
});
if (message.content.includes("link")) message.channel.send(`<${avatarURL}>`);
const attachment = new Discord.MessageAttachment(avatarURL, `avatar.${avatarURL.split(".").pop().split("?")[0]}`);
message.channel.send(attachment); message.channel.send(attachment);
} }
}; };

View file

@ -22,10 +22,22 @@ class BatSlap extends Command {
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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("batslap", { avatar: users[0].displayAvatarURL({ format: "png", size: 512 }), url: users[1].displayAvatarURL({ format: "png", size: 512 }) }); 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 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);
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("beautiful", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -24,15 +24,23 @@ class Bed extends Command {
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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
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");
message.channel.send(attachment); message.channel.send(attachment);
m.delete(); m.delete();
} catch (e) { } catch (e) {
console.log(e); console.log(e);
m.error("misc:ERROR_OCCURRED", null, { edit: true }); m.error("misc:ERROR_OCCURRED", null, {
edit: true
});
}; };
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("brazzers", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("burn", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -20,7 +20,9 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
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();

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("challenger", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -23,7 +23,9 @@ class Clyde extends Command {
if (!text) return message.error("images/clyde:MISSING_TEXT"); if (!text) return message.error("images/clyde:MISSING_TEXT");
const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
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();
@ -32,7 +34,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, { edit: true }); m.error("misc:ERROR_OCCURRED", null, {
edit: true
});
}; };
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("dictator", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -20,7 +20,9 @@ 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, { prefixEmoji: "loading" }); m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const canvas = Canvas.createCanvas(632, 357), const canvas = Canvas.createCanvas(632, 357),
ctx = canvas.getContext("2d"); ctx = canvas.getContext("2d");
@ -30,7 +32,10 @@ class Facepalm extends Command {
ctx.fillRect(0, 0, 632, 357); ctx.fillRect(0, 0, 632, 357);
// Draw avatar // Draw avatar
const avatar = await Canvas.loadImage(user.displayAvatarURL({ format: "png", size: 512 })); const avatar = await Canvas.loadImage(user.displayAvatarURL({
format: "png",
size: 512
}));
ctx.drawImage(avatar, 199, 112, 235, 235); ctx.drawImage(avatar, 199, 112, 235, 235);
// Draw layer // Draw layer
@ -40,6 +45,7 @@ class Facepalm extends Command {
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "facepalm.png"); const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "facepalm.png");
m.delete(); m.delete();
message.channel.send(attachment); message.channel.send(attachment);
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("fire", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("jail", { url: user.displayAvatarURL({ format: "png", size: 1024 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -24,7 +24,9 @@ class Love extends Command {
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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
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();
@ -33,7 +35,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, { edit: true }); m.error("misc:ERROR_OCCURRED", null, {
edit: true
});
}; };
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("missionpassed", { url: user.displayAvatarURL({ format: "png", size: 2048 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -36,7 +36,9 @@ class Phcomment extends Command {
try { try {
const buffer = await canvacord.Canvas.phub({ const buffer = await canvacord.Canvas.phub({
username: user.username, username: user.username,
image: user.displayAvatarURL({ format: "png" }), image: user.displayAvatarURL({
format: "png"
}),
message: text message: text
}); });
const attachment = new Discord.MessageAttachment(buffer, "phcomment.png"); const attachment = new Discord.MessageAttachment(buffer, "phcomment.png");
@ -44,7 +46,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, { edit: true }); m.error("misc:ERROR_OCCURRED", null, {
edit: true
});
}; };
} }
}; };

View file

@ -21,13 +21,17 @@ class Qrcode extends Command {
const text = args.join(" "); const text = args.join(" ");
if (!text) return message.error("images/qrcode:MISSING_TEXT"); if (!text) return message.error("images/qrcode:MISSING_TEXT");
const pleaseWait = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); const pleaseWait = await message.sendT("misc:PLEASE_WAIT", null, {
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
});
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("rip", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("scary", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("tobecontinued", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -20,10 +20,16 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await canvacord.Canvas.trash(user.displayAvatarURL({ format: "png", size: 512 })); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -19,10 +19,20 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("triggered", { url: user.displayAvatarURL({ format: "png", size: 512 }), sepia: "true", invert: "true" }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -25,7 +25,9 @@ class Tweet extends Command {
if (!text) return message.error("images/tweet:MISSING_TEXT"); if (!text) return message.error("images/tweet:MISSING_TEXT");
const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
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);
@ -39,6 +41,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);
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("wanted", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -19,10 +19,18 @@ 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, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
const buffer = await this.client.AmeAPI.generate("wasted", { url: user.displayAvatarURL({ format: "png", size: 512 }) }); prefixEmoji: "loading"
});
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);
} }
}; };

View file

@ -30,14 +30,19 @@ class YouTubeComment extends Command {
if (!text) return message.error("images/phcomment:MISSING_TEXT"); // same text as phcomment if (!text) return message.error("images/phcomment:MISSING_TEXT"); // same text as phcomment
const m = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" }); const m = await message.sendT("misc:PLEASE_WAIT", null, {
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"
}),
content: text content: text
}); });
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);
} }
}; };

View file

@ -26,7 +26,10 @@ class Announcement extends Command {
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();
@ -38,7 +41,9 @@ class Announcement extends Command {
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";
@ -55,17 +60,13 @@ class Announcement extends Command {
}; };
}); });
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"))

View file

@ -21,13 +21,18 @@ class Ban extends Command {
const user = await this.client.resolveUser(args[0]); const user = await this.client.resolveUser(args[0]);
if (!user) return message.error("moderation/ban:MISSING_MEMBER"); if (!user) return message.error("moderation/ban:MISSING_MEMBER");
const memberData = message.guild.members.cache.get(user.id) ? await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id }) : null; const memberData = message.guild.members.cache.get(user.id) ? await this.client.findOrCreateMember({
id: user.id,
guildID: message.guild.id
}) : null;
if (user.id === message.author.id) return message.error("moderation/ban:YOURSELF"); if (user.id === message.author.id) 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)) return message.error("moderation/ban:ALREADY_BANNED", { username: user.tag }); if (banned.some((m) => m.user.id === user.id)) 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(" ");
@ -49,7 +54,9 @@ class Ban extends Command {
})).catch(() => {}); })).catch(() => {});
// 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,
@ -79,7 +86,9 @@ class Ban extends Command {
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", { count: data.guild.casesCount })) .setAuthor(message.translate("moderation/ban:CASE", {
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)

View file

@ -40,7 +40,11 @@ class Checkinvites extends Command {
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
message.channel.send(embed); const m = await message.channel.send(embed);
setTimeout(function () {
m.delete();
}, 3000);
} }
}; };

View file

@ -40,7 +40,9 @@ class Clear extends Command {
const user = message.mentions.users.first(); const user = message.mentions.users.first();
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) messages = messages.filter((m) => m.author.id === user.id); if (user) 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);
@ -53,9 +55,14 @@ class Clear extends Command {
let toDelete = null; let toDelete = null;
if (user) { if (user) {
toDelete = await message.success("moderation/clear:CLEARED_MEMBER", { amount: --amount, username: user.tag }); toDelete = await message.success("moderation/clear:CLEARED_MEMBER", {
amount: --amount,
username: user.tag
});
} else { } else {
toDelete = await message.success("moderation/clear:CLEARED", { amount: --amount }); toDelete = await message.success("moderation/clear:CLEARED", {
amount: --amount
});
}; };
setTimeout(function () { setTimeout(function () {

View file

@ -20,10 +20,15 @@ class Clearsanctions extends Command {
const member = await this.client.resolveMember(args[0], message.guild); const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("moderation/clear-sanctions:MISSING_MEMBER"); if (!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", { username: member.user.tag }); message.success("moderation/clear-sanctions:SUCCESS", {
username: member.user.tag
});
} }
}; };

View file

@ -36,6 +36,7 @@ class Giveaway extends Command {
const prize = args.slice(3).join(" "); const prize = args.slice(3).join(" ");
if (!prize) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix }); if (!prize) 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,
@ -51,10 +52,18 @@ class Giveaway extends Command {
winners: message.translate("moderation/giveaway:WINNERS"), winners: message.translate("moderation/giveaway:WINNERS"),
endedAt: message.translate("moderation/giveaway:END_AT"), endedAt: message.translate("moderation/giveaway:END_AT"),
units: { units: {
seconds: message.translate("time:SECONDS", { amount: "" }).trim(), seconds: message.translate("time:SECONDS", {
minutes: message.translate("time:MINUTES", { amount: "" }).trim(), amount: ""
hours: message.translate("time:HOURS", { amount: "" }).trim(), }).trim(),
days: message.translate("time:DAYS", { amount: "" }).trim() minutes: message.translate("time:MINUTES", {
amount: ""
}).trim(),
hours: message.translate("time:HOURS", {
amount: ""
}).trim(),
days: message.translate("time:DAYS", {
amount: ""
}).trim()
} }
} }
}).then(() => { }).then(() => {
@ -70,7 +79,9 @@ class Giveaway extends Command {
}).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", { messageID }); return message.error("moderation/giveaway:NOT_FOUND_ENDED", {
messageID
});
}); });
} else if (status === "delete") { } else if (status === "delete") {
const messageID = args[1]; const messageID = args[1];
@ -79,17 +90,23 @@ class Giveaway extends Command {
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", { messageID }); return message.error("moderation/giveaway:NOT_FOUND", {
messageID
});
}); });
} else if (status === "end") { } else if (status === "end") {
const messageID = args[1]; const messageID = args[1];
if (!messageID) return message.error("moderation/giveaway:MISSING_ID"); if (!messageID) return message.error("moderation/giveaway:MISSING_ID");
try { try {
this.client.giveawaysManager.edit(messageID, { setEndTimestamp: Date.now() }); this.client.giveawaysManager.edit(messageID, {
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", { messageID }); return message.error("moderation/giveaway:NOT_FOUND", {
messageID
});
}; };
} else { } else {
return message.error("moderation/giveaway:MISSING_STATUS"); return message.error("moderation/giveaway:MISSING_STATUS");

View file

@ -23,7 +23,10 @@ class Kick extends Command {
if (member.id === message.author.id) return message.error("moderation/kick:YOURSELF"); if (member.id === message.author.id) return message.error("moderation/kick:YOURSELF");
const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); 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(" ");
@ -70,7 +73,9 @@ class Kick extends Command {
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", { count: data.guild.casesCount})) .setAuthor(message.translate("moderation/kick:CASE", {
count: data.guild.casesCount
}))
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) .addField(message.translate("common: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)

View file

@ -27,7 +27,10 @@ class Mute extends Command {
const moderationPosition = message.member.roles.highest.position; const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); const 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))) return message.error("misc:INVALID_TIME"); if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME");
@ -87,7 +90,9 @@ class Mute extends Command {
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", { count: data.guild.casesCount })) .setAuthor(message.translate("moderation/mute:CASE", {
count: data.guild.casesCount
}))
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) .addField(message.translate("common: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)

View file

@ -25,7 +25,10 @@ class Poll extends Command {
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();
@ -37,7 +40,10 @@ class Poll extends Command {
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";
@ -54,17 +60,13 @@ class Poll extends Command {
}; };
}); });
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];
@ -77,7 +79,10 @@ 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", { success: emojis[0].toString(), error: emojis[1].toString() })); .addField(question, message.translate("moderation/poll:REACT", {
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]);

View file

@ -21,15 +21,24 @@ class Sanctions extends Command {
const user = await this.client.resolveUser(args[0]); const user = await this.client.resolveUser(args[0]);
if (!user) return message.error("moderation/sanctions:MISSING_MEMBER"); if (!user) 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()
.setAuthor(user.tag, user.displayAvatarURL({ size: 512, dynamic: true, format: "png" })) .setAuthor(user.tag, user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.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", { username: user.tag })); embed.setDescription(message.translate("moderation/sanctions:NO_SANCTION", {
username: user.tag
}));
return message.channel.send(embed); return message.channel.send(embed);
} else { } else {
memberData.sanctions.forEach((s) => { memberData.sanctions.forEach((s) => {

View file

@ -27,12 +27,18 @@ class Setwarns extends Command {
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", { prefix: data.guild.prefix, count: number }); return message.success("moderation/setwarns:SUCCESS_KICK_RESET", {
prefix: data.guild.prefix,
count: number
});
} else if (sanction === "ban") { } else 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", { prefix: data.guild.prefix, count: number }); return message.success("moderation/setwarns:SUCCESS_BAN_RESET", {
prefix: data.guild.prefix,
count: number
});
}; };
}; };
@ -43,12 +49,18 @@ class Setwarns extends Command {
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", { prefix: data.guild.prefix, count: number }); return message.success("moderation/setwarns:SUCCESS_KICK", {
prefix: data.guild.prefix,
count: number
});
} else if (sanction === "ban") { } else 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", { prefix: data.guild.prefix, count: number }); return message.success("moderation/setwarns:SUCCESS_BAN", {
prefix: data.guild.prefix,
count: number
});
}; };
} }
}; };

View file

@ -50,7 +50,10 @@ class Unban extends Command {
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", { username: user.tag, server: message.guild.name }); message.success("moderation/unban:UNBANNED", {
username: user.tag,
server: message.guild.name
});
} }
}; };

View file

@ -24,15 +24,22 @@ class Unmute extends Command {
const moderationPosition = message.member.roles.highest.position; const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
const memberData = await this.client.findOrCreateMember({ id: member.id, guildID: message.guild.id }); const 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", { username: member.user.tag }); message.success("moderation/unmute:SUCCESS", {
username: member.user.tag
});
} else { } else {
message.error("moderation/unmute:NOT_MUTED", { username: member.user.tag }); message.error("moderation/unmute:NOT_MUTED", {
username: member.user.tag
});
}; };
} }
}; };

View file

@ -22,7 +22,10 @@ class Warn extends Command {
if (!member) return message.error("moderation/warn:MISSING_MEMBER"); if (!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) return message.error("moderation/warn:YOURSELF"); if (member.id === message.author.id) return message.error("moderation/warn:YOURSELF");
@ -57,31 +60,61 @@ class Warn extends Command {
if (banCount) { if (banCount) {
if (sanctions >= banCount) { if (sanctions >= banCount) {
member.send(message.translate("moderation/ban:BANNED_DM", { username: member.user, moderator: message.author.tag, server: message.guild.name, reason })); member.send(message.translate("moderation/ban:BANNED_DM", {
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", { count: data.guild.casesCount })) embed.setAuthor(message.translate("moderation/ban:CASE", {
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", { username: member.user.tag, count: banCount }); message.success("moderation/setwarns:AUTO_BAN", {
username: member.user.tag,
count: banCount
});
}; };
}; };
if (kickCount) { if (kickCount) {
if (sanctions >= kickCount) { if (sanctions >= kickCount) {
member.send(message.translate("moderation/kick:KICKED_DM", { username: member.user, moderator: message.author.tag, server: message.guild.name, reason })); member.send(message.translate("moderation/kick:KICKED_DM", {
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", { count: data.guild.casesCount })) embed.setAuthor(message.translate("moderation/kick:CASE", {
count: data.guild.casesCount
}))
.setColor("#e88709"); .setColor("#e88709");
member.kick().catch(() => {}); member.kick().catch(() => {});
message.success("moderation/setwarns:AUTO_KICK", { username: member.user.tag, count: kickCount }); message.success("moderation/setwarns:AUTO_KICK", {
username: member.user.tag,
count: kickCount
});
}; };
}; };
member.send(message.translate("moderation/warn:WARNED_DM", { username: member.user.tag, server: message.guild.name, moderator: message.author.tag, reason })); member.send(message.translate("moderation/warn:WARNED_DM", {
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", { caseNumber: data.guild.casesCount })) embed.setAuthor(message.translate("moderation/warn:CASE", {
caseNumber: data.guild.casesCount
}))
.setColor("#8c14e2"); .setColor("#8c14e2");
message.success("moderation/warn:WARNED", { username: member.user.tag, reason }); message.success("moderation/warn:WARNED", {
username: member.user.tag,
reason
});
memberData.sanctions.push(caseInfo); memberData.sanctions.push(caseInfo);
memberData.save(); memberData.save();

View file

@ -32,7 +32,9 @@ class Filter extends Command {
} else if (Object.keys(this.client.player.filters).includes(args[0])) { } else if (Object.keys(this.client.player.filters).includes(args[0])) {
queue.setFilter(args[0]); queue.setFilter(args[0]);
message.success("music/filter:ADDING_FILTER"); message.success("music/filter:ADDING_FILTER");
} else if (args[0]) return message.error("music/filter:UNKNOWN_FILTER", { prefix: data.guild.prefix }); } else if (args[0]) return message.error("music/filter:UNKNOWN_FILTER", {
prefix: data.guild.prefix
});
} }
}; };

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