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

@ -19,7 +19,7 @@ moment.relativeTimeThreshold("M", 12);
// Creates JaBa class // Creates JaBa class
class JaBa extends Client { class JaBa extends Client {
constructor (options) { constructor(options) {
super(options); super(options);
this.config = require("../config"); // Load the config file this.config = require("../config"); // Load the config file
this.customEmojis = require("../emojis.json"); // load the bot's emojis this.customEmojis = require("../emojis.json"); // load the bot's emojis
@ -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,
@ -56,7 +58,7 @@ class JaBa extends Client {
emptyCooldown: 0, emptyCooldown: 0,
leaveOnFinish: true, leaveOnFinish: true,
leaveOnStop: true, leaveOnStop: true,
plugins: [ new SoundCloudPlugin(), new SpotifyPlugin() ], plugins: [new SoundCloudPlugin(), new SpotifyPlugin()],
}); });
this.player this.player
@ -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")))
@ -129,7 +133,7 @@ class JaBa extends Client {
// This function is used to load a command and add it to the collection // This function is used to load a command and add it to the collection
loadCommand(commandPath, commandName) { loadCommand(commandPath, commandName) {
try { try {
const props = new (require(`.${commandPath}${path.sep}${commandName}`))(this); const props = new(require(`.${commandPath}${path.sep}${commandName}`))(this);
this.logger.log(`Loading Command: ${props.help.name}. 👌`, "log"); this.logger.log(`Loading Command: ${props.help.name}. 👌`, "log");
props.conf.location = commandPath; props.conf.location = commandPath;
if (props.init) props.init(this); if (props.init) props.init(this);
@ -146,7 +150,7 @@ class JaBa extends Client {
}; };
// This function is used to unload a command (you need to load them again) // This function is used to unload a command (you need to load them again)
async unloadCommand (commandPath, commandName) { async unloadCommand(commandPath, commandName) {
let command; let command;
if (this.commands.has(commandName)) command = this.commands.get(commandName); if (this.commands.has(commandName)) command = this.commands.get(commandName);
else if (this.aliases.has(commandName)) command = this.commands.get(this.aliases.get(commandName)); else if (this.aliases.has(commandName)) command = this.commands.get(this.aliases.get(commandName));
@ -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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Addcommand extends Command { class Addcommand extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "addcommand", name: "addcommand",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "custom-command" ], aliases: ["custom-command"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
if (!args[0]) return message.error("administration/addcommand:MISSING_NAME"); if (!args[0]) return message.error("administration/addcommand:MISSING_NAME");
const name = args[0].split("\n")[0]; const name = args[0].split("\n")[0];
@ -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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Addemoji extends Command { class Addemoji extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "addemoji", name: "addemoji",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args) { async run(message, args) {
const URL = args[0]; const URL = args[0];
if (!URL) return message.error("administration/addemoji:MISSING_URL"); if (!URL) return message.error("administration/addemoji:MISSING_URL");
@ -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

@ -1,39 +1,49 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Automod extends Command { class Automod extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "automod", name: "automod",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args,data) { async run(message, args, data) {
const status = args[0]; const status = args[0];
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

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Resolvers = require("../../helpers/resolvers"); Resolvers = require("../../helpers/resolvers");
class Autorole extends Command { class Autorole extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "autorole", name: "autorole",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "ar" ], aliases: ["ar"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const status = args[0]; const status = args[0];
if (status !== "on" && status !== "off") return message.error("administration/autorole:MISSING_STATUS"); if (status !== "on" && status !== "off") return message.error("administration/autorole:MISSING_STATUS");
@ -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

@ -4,31 +4,35 @@ const Command = require("../../base/Command.js"),
Sentry = require("@sentry/node"); Sentry = require("@sentry/node");
class Backup extends Command { class Backup extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "backup", name: "backup",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ADMINISTRATOR" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ADMINISTRATOR"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 30000 cooldown: 30000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const status = args[0]; const status = args[0];
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

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Configuration extends Command { class Configuration extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "configuration", name: "configuration",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "conf", "config" ], aliases: ["conf", "config"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const guildData = data.guild; const guildData = data.guild;
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
@ -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

@ -1,31 +1,32 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Delcommand extends Command { class Delcommand extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "delcommand", name: "delcommand",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Deletemod extends Command { class Deletemod extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "deletemod", name: "deletemod",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "autodeletemodcommands" ], aliases: ["autodeletemodcommands"],
memberPermissions: [ "MANAGE_MESSAGES" ], memberPermissions: ["MANAGE_MESSAGES"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const status = args[0]; const status = args[0];
if (!status || status !== "on" && status !== "off") return message.error("administration/deletemod:MISSING_STATUS"); if (!status || status !== "on" && status !== "off") return message.error("administration/deletemod:MISSING_STATUS");

View file

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Resolvers = require("../../helpers/resolvers"); Resolvers = require("../../helpers/resolvers");
class Goodbye extends Command { class Goodbye extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "goodbye", name: "goodbye",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "au-revoir" ], aliases: ["au-revoir"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
if (args[0] === "test" && data.guild.plugins.goodbye.enabled) { if (args[0] === "test" && data.guild.plugins.goodbye.enabled) {
this.client.emit("guildMemberRemove", message.member); this.client.emit("guildMemberRemove", message.member);
return message.success("administration/goodbye:TEST_SUCCESS"); return message.success("administration/goodbye:TEST_SUCCESS");
@ -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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Ignore extends Command { class Ignore extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "ignore", name: "ignore",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "disableChannel" ], aliases: ["disableChannel"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 1000 cooldown: 1000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first(); const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first();
if (!channel) return message.error("misc:INVALID_CHANNEL"); if (!channel) return message.error("misc:INVALID_CHANNEL");
@ -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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Set extends Command { class Set extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "set", name: "set",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES" ], botPermissions: ["SEND_MESSAGES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const status = args[0]; const status = args[0];
if (!status || !["level", "xp", "credits", "bank"].includes(status)) return message.error("administration/set:NO_STATUS"); if (!status || !["level", "xp", "credits", "bank"].includes(status)) return message.error("administration/set:NO_STATUS");
@ -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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Setlang extends Command { class Setlang extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "setlang", name: "setlang",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const language = this.client.languages.find((l) => l.name === args[0] || l.aliases.includes(args[0])); const language = this.client.languages.find((l) => l.name === args[0] || l.aliases.includes(args[0]));
if (!args[0] || !language) return message.error("administration/setlang:MISSING_LANG", { list: this.client.languages.map((l) => `\`${l.name}\``).join(", ") }); if (!args[0] || !language) return message.error("administration/setlang:MISSING_LANG", { list: this.client.languages.map((l) => `\`${l.name}\``).join(", ") });
@ -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

@ -2,24 +2,28 @@ const Command = require("../../base/Command.js"),
Resolvers = require("../../helpers/resolvers"); Resolvers = require("../../helpers/resolvers");
class Setmodlogs extends Command { class Setmodlogs extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "setmodlogs", name: "setmodlogs",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "setmodlogs" ], aliases: ["setmodlogs"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Setprefix extends Command { class Setprefix extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "setprefix", name: "setprefix",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const prefix = args[0]; const prefix = args[0];
if (!prefix) return message.error("administration/setprefix:MISSING_PREFIX"); if (!prefix) return message.error("administration/setprefix:MISSING_PREFIX");
if (prefix.length > 5) return message.error("administration/setprefix:TOO_LONG"); if (prefix.length > 5) return message.error("administration/setprefix:TOO_LONG");
@ -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

@ -2,24 +2,28 @@ const Command = require("../../base/Command.js"),
Resolvers = require("../../helpers/resolvers"); Resolvers = require("../../helpers/resolvers");
class Setreports extends Command { class Setreports extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "setreports", name: "setreports",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "setreport"], aliases: ["setreport"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -2,24 +2,28 @@ const Command = require("../../base/Command.js"),
Resolvers = require("../../helpers/resolvers"); Resolvers = require("../../helpers/resolvers");
class Setsuggests extends Command { class Setsuggests extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "setsuggests", name: "setsuggests",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "setsuggest", "setsuggestions", "setsuggestion" ], aliases: ["setsuggest", "setsuggestions", "setsuggestion"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
ms = require("ms"); ms = require("ms");
class Slowmode extends Command { class Slowmode extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "slowmode", name: "slowmode",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "slowmotion" ], aliases: ["slowmotion"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first(); const channel = message.mentions.channels.filter((ch) => ch.type === "text" && ch.guild.id === message.guild.id).first();
if (!channel) return message.error("misc:INVALID_CHANNEL"); if (!channel) return message.error("misc:INVALID_CHANNEL");
@ -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

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Resolvers = require("../../helpers/resolvers"); Resolvers = require("../../helpers/resolvers");
class Welcome extends Command { class Welcome extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "welcome", name: "welcome",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "bienvenue" ], aliases: ["bienvenue"],
memberPermissions: [ "MANAGE_GUILD" ], memberPermissions: ["MANAGE_GUILD"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
if (args[0] === "test" && data.guild.plugins.welcome.enabled) { if (args[0] === "test" && data.guild.plugins.welcome.enabled) {
this.client.emit("guildMemberAdd", message.member); this.client.emit("guildMemberAdd", message.member);
return message.success("administration/welcome:TEST_SUCCESS"); return message.success("administration/welcome:TEST_SUCCESS");
@ -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

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Achievements extends Command { class Achievements extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "achievements", name: "achievements",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "ac" ], aliases: ["ac"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 1000 cooldown: 1000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setAuthor(message.translate("economy/achievements:TITLE")) .setAuthor(message.translate("economy/achievements:TITLE"))
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
@ -26,37 +26,37 @@ class Achievements extends Command {
embed.addField(message.translate("economy/achievements:SEND_CMD"), message.translate("economy/achievements:PROGRESS", { embed.addField(message.translate("economy/achievements:SEND_CMD"), message.translate("economy/achievements:PROGRESS", {
now: data.userData.achievements.firstCommand.progress.now, now: data.userData.achievements.firstCommand.progress.now,
total: data.userData.achievements.firstCommand.progress.total, total: data.userData.achievements.firstCommand.progress.total,
percent: Math.round(100 * (data.userData.achievements.firstCommand.progress.now/data.userData.achievements.firstCommand.progress.total)) percent: Math.round(100 * (data.userData.achievements.firstCommand.progress.now / data.userData.achievements.firstCommand.progress.total))
})); }));
embed.addField(message.translate("economy/achievements:CLAIM_SALARY"), message.translate("economy/achievements:PROGRESS", { embed.addField(message.translate("economy/achievements:CLAIM_SALARY"), message.translate("economy/achievements:PROGRESS", {
now: data.userData.achievements.work.progress.now, now: data.userData.achievements.work.progress.now,
total: data.userData.achievements.work.progress.total, total: data.userData.achievements.work.progress.total,
percent: Math.round(100 * (data.userData.achievements.work.progress.now/data.userData.achievements.work.progress.total)) percent: Math.round(100 * (data.userData.achievements.work.progress.now / data.userData.achievements.work.progress.total))
})); }));
embed.addField(message.translate("economy/achievements:MARRY"), message.translate("economy/achievements:PROGRESS", { embed.addField(message.translate("economy/achievements:MARRY"), message.translate("economy/achievements:PROGRESS", {
now: data.userData.achievements.married.progress.now, now: data.userData.achievements.married.progress.now,
total: data.userData.achievements.married.progress.total, total: data.userData.achievements.married.progress.total,
percent: Math.round(100 * (data.userData.achievements.married.progress.now/data.userData.achievements.married.progress.total)) percent: Math.round(100 * (data.userData.achievements.married.progress.now / data.userData.achievements.married.progress.total))
})); }));
embed.addField(message.translate("economy/achievements:SLOTS"), message.translate("economy/achievements:PROGRESS", { embed.addField(message.translate("economy/achievements:SLOTS"), message.translate("economy/achievements:PROGRESS", {
now: data.userData.achievements.slots.progress.now, now: data.userData.achievements.slots.progress.now,
total: data.userData.achievements.slots.progress.total, total: data.userData.achievements.slots.progress.total,
percent: Math.round(100 * (data.userData.achievements.slots.progress.now/data.userData.achievements.slots.progress.total)) percent: Math.round(100 * (data.userData.achievements.slots.progress.now / data.userData.achievements.slots.progress.total))
})); }));
embed.addField(message.translate("economy/achievements:TIP"), message.translate("economy/achievements:PROGRESS", { embed.addField(message.translate("economy/achievements:TIP"), message.translate("economy/achievements:PROGRESS", {
now: data.userData.achievements.tip.progress.now, now: data.userData.achievements.tip.progress.now,
total: data.userData.achievements.tip.progress.total, total: data.userData.achievements.tip.progress.total,
percent: Math.round(100 * (data.userData.achievements.tip.progress.now/data.userData.achievements.tip.progress.total)) percent: Math.round(100 * (data.userData.achievements.tip.progress.now / data.userData.achievements.tip.progress.total))
})); }));
embed.addField(message.translate("economy/achievements:REP"), message.translate("economy/achievements:PROGRESS", { embed.addField(message.translate("economy/achievements:REP"), message.translate("economy/achievements:PROGRESS", {
now: data.userData.achievements.rep.progress.now, now: data.userData.achievements.rep.progress.now,
total: data.userData.achievements.rep.progress.total, total: data.userData.achievements.rep.progress.total,
percent: Math.round(100 * (data.userData.achievements.rep.progress.now/data.userData.achievements.rep.progress.total)) percent: Math.round(100 * (data.userData.achievements.rep.progress.now / data.userData.achievements.rep.progress.total))
})); }));
embed.addField(message.translate("economy/achievements:INVITE"), message.translate("economy/achievements:PROGRESS", { embed.addField(message.translate("economy/achievements:INVITE"), message.translate("economy/achievements:PROGRESS", {
now: data.userData.achievements.invite.progress.now, now: data.userData.achievements.invite.progress.now,
total: data.userData.achievements.invite.progress.total, total: data.userData.achievements.invite.progress.total,
percent: Math.round(100 * (data.userData.achievements.invite.progress.now/data.userData.achievements.invite.progress.total)) percent: Math.round(100 * (data.userData.achievements.invite.progress.now / data.userData.achievements.invite.progress.total))
})); }));
message.channel.send(embed); message.channel.send(embed);

View file

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Birthdate extends Command { class Birthdate extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "birthdate", name: "birthdate",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "anniversaire" ], aliases: ["anniversaire"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 1000 cooldown: 1000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const date = args[0]; const date = args[0];
if (!date) return message.error("economy/birthdate:MISSING_DATE"); if (!date) return message.error("economy/birthdate:MISSING_DATE");
@ -28,18 +28,21 @@ 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);
if (!(tday == d.getDate() && tmonth == d.getMonth() && tyear == d.getFullYear())) return message.error("economy/birthdate:INVALID_DATE_FORMAT"); if (!(tday == d.getDate() && tmonth == d.getMonth() && tyear == d.getFullYear())) return message.error("economy/birthdate:INVALID_DATE_FORMAT");
if (d.getTime() > Date.now()) return message.error("economy/birthdate:DATE_TOO_HIGH"); if (d.getTime() > Date.now()) return message.error("economy/birthdate:DATE_TOO_HIGH");
if (d.getTime() < (Date.now() - 2.523e+12))return message.error("economy/birthdate:DATE_TOO_LOW"); if (d.getTime() < (Date.now() - 2.523e+12)) return message.error("economy/birthdate:DATE_TOO_LOW");
data.userData.birthdate = d; data.userData.birthdate = d;
data.userData.save(); data.userData.save();
message.success("economy/birthdate:SUCCESS", { date: message.printDate(d)}); message.success("economy/birthdate:SUCCESS", {
date: message.printDate(d)
});
} }
}; };

View file

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Deposit extends Command { class Deposit extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "deposit", name: "deposit",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "bank", "banque", "dep" ], aliases: ["bank", "banque", "dep"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 1000 cooldown: 1000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
let amount = args[0]; let amount = args[0];
if (!(parseInt(data.memberData.money, 10) > 0)) return message.error("economy/deposit:NO_CREDIT"); if (!(parseInt(data.memberData.money, 10) > 0)) return message.error("economy/deposit:NO_CREDIT");
@ -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

@ -1,37 +1,38 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Divorce extends Command { class Divorce extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "divorce", name: "divorce",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "profil" ], aliases: ["profil"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -2,48 +2,52 @@ const Command = require("../../base/Command.js"),
AsciiTable = require("ascii-table"); AsciiTable = require("ascii-table");
class Leaderboard extends Command { class Leaderboard extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "leaderboard", name: "leaderboard",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "lb" ], aliases: ["lb"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args) { async run(message, args) {
const isOnlyOnMobile = (message.author.presence.clientStatus ? JSON.stringify(Object.keys(message.author.presence.clientStatus)) === JSON.stringify([ "mobile" ]) : false); const isOnlyOnMobile = (message.author.presence.clientStatus ? JSON.stringify(Object.keys(message.author.presence.clientStatus)) === JSON.stringify(["mobile"]) : false);
const type = args[0]; const type = args[0];
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,
value: m.money + m.bankSold value: m.money + m.bankSold
}; };
}).sort((a,b) => b.value - a.value); }).sort((a, b) => b.value - a.value);
const table = new AsciiTable("Таблица лидеров"); const table = new AsciiTable("Таблица лидеров");
table.setHeading("#", message.translate("common:USER"), message.translate("common:CREDITS")); table.setHeading("#", message.translate("common:USER"), message.translate("common:CREDITS"));
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
const newTable = await fetchUsers(membersLeaderboard, table, this.client); const newTable = await fetchUsers(membersLeaderboard, table, this.client);
message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``); message.channel.send(`\`\`\`\n${newTable.toString()}\`\`\``);
} else if (type === "level") { } else if (type === "level") {
const members = await this.client.membersData.find({ guildID: message.guild.id }).lean(), const members = await this.client.membersData.find({
guildID: message.guild.id
}).lean(),
membersLeaderboard = members.map((m) => { membersLeaderboard = members.map((m) => {
return { return {
id: m.id, id: m.id,
value: m.level value: m.level
}; };
}).sort((a,b) => b.value - a.value); }).sort((a, b) => b.value - a.value);
const table = new AsciiTable("Таблица лидеров"); const table = new AsciiTable("Таблица лидеров");
table.setHeading("#", message.translate("common:USER"), message.translate("common:LEVEL")); table.setHeading("#", message.translate("common:USER"), message.translate("common:LEVEL"));
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20; if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
@ -56,7 +60,7 @@ class Leaderboard extends Command {
id: u.id, id: u.id,
value: u.rep value: u.rep
}; };
}).sort((a,b) => b.value - a.value); }).sort((a, b) => b.value - a.value);
const table = new AsciiTable("Таблица лидеров"); const table = new AsciiTable("Таблица лидеров");
table.setHeading("#", message.translate("common:USER"), message.translate("common:POINTS")); table.setHeading("#", message.translate("common:USER"), message.translate("common:POINTS"));
if (usersLeaderboard.length > 20) usersLeaderboard.length = 20; if (usersLeaderboard.length > 20) usersLeaderboard.length = 20;

View file

@ -1,37 +1,42 @@
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 {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "marry", name: "marry",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "mariage" ], aliases: ["mariage"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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");
@ -41,24 +46,37 @@ class Marry extends Command {
const receiver = pendings[requester]; const receiver = pendings[requester];
// 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

@ -8,42 +8,52 @@ const asyncForEach = async (array, callback) => {
}; };
class Credits extends Command { class Credits extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "money", name: "money",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "credits", "balance" ], aliases: ["credits", "balance"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 1000 cooldown: 1000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
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;
const user = member.user; const user = member.user;
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({
globalMoney+=memberData.money; id: user.id,
globalMoney+=memberData.bankSold; guildID: guild.id
});
globalMoney += memberData.money;
globalMoney += memberData.bankSold;
}); });
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

@ -1,7 +1,7 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Pay extends Command { class Pay extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "pay", name: "pay",
dirname: __dirname, dirname: __dirname,
@ -9,29 +9,29 @@ class Pay extends Command {
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -8,42 +8,45 @@ const asyncForEach = async (array, callback) => {
}; };
class Profile extends Command { class Profile extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "profile", name: "profile",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "profil" ], aliases: ["profil"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const client = this.client; const client = this.client;
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"))
@ -71,7 +81,7 @@ class Profile extends Command {
.addField(message.translate("economy/profile:LEVEL"), `**${memberData.level}**`, true) .addField(message.translate("economy/profile:LEVEL"), `**${memberData.level}**`, true)
.addField(message.translate("economy/profile:EXP"), `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`, true) .addField(message.translate("economy/profile:EXP"), `**${memberData.exp}/${5 * (memberData.level * memberData.level) + 80 * memberData.level + 100}** xp`, true)
.addField(message.translate("economy/profile:REGISTERED"), message.printDate(new Date(memberData.registeredAt)), true) .addField(message.translate("economy/profile:REGISTERED"), message.printDate(new Date(memberData.registeredAt)), true)
.addField(message.translate("economy/profile:BIRTHDATE"), (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE"): message.printDate(new Date(userData.birthdate))), true) .addField(message.translate("economy/profile:BIRTHDATE"), (!userData.birthdate ? message.translate("economy/profile:NO_BIRTHDATE") : message.printDate(new Date(userData.birthdate))), true)
.addField(message.translate("economy/profile:LOVER"), (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag), true) .addField(message.translate("economy/profile:LOVER"), (!userData.lover ? message.translate("economy/profile:NO_LOVER") : this.client.users.cache.get(userData.lover).tag), true)
.addField(message.translate("economy/profile:ACHIEVEMENTS"), message.translate("economy/profile:ACHIEVEMENTS_CONTENT", { .addField(message.translate("economy/profile:ACHIEVEMENTS"), message.translate("economy/profile:ACHIEVEMENTS_CONTENT", {
prefix: data.guild.prefix prefix: data.guild.prefix

View file

@ -1,29 +1,33 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Rep extends Command { class Rep extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "rep", name: "rep",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "reputation" ], aliases: ["reputation"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -1,42 +1,55 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Rob extends Command { class Rob extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "rob", name: "rob",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "steal" ], aliases: ["steal"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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/rob:MISSING_MEMBER"); if (!member) return message.error("economy/rob:MISSING_MEMBER");
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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Setbio extends Command { class Setbio extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "setbio", name: "setbio",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "biography", "setdesc" ], aliases: ["biography", "setdesc"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const newBio = args.join(" "); const newBio = args.join(" ");
if (!newBio) return message.error("economy/setbio:MISSING"); if (!newBio) return message.error("economy/setbio:MISSING");
if (newBio.length > 100) return message.error("economy/setbio:MAX_CHARACT"); if (newBio.length > 100) return message.error("economy/setbio:MAX_CHARACT");

View file

@ -1,27 +1,27 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Slots extends Command { class Slots extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "slots", name: "slots",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "casino", "slot" ], aliases: ["casino", "slot"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const fruits = [ "🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓" ]; const fruits = ["🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓"];
let i1=0, j1=0, k1=0, let i1 = 0, j1 = 0, k1 = 0,
i2=1, j2=1, k2=1, i2 = 1, j2 = 1, k2 = 1,
i3=2, j3=2, k3=2; i3 = 2, j3 = 2, k3 = 2;
// Gets three random fruits array // Gets three random fruits array
const colonnes = [ const colonnes = [
@ -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(() => {
@ -56,7 +57,7 @@ class Slots extends Command {
}, 4000); }, 4000);
async function end() { async function end() {
let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n"; let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n";
i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0; i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0;
i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0; i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0;
@ -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();
@ -132,7 +147,7 @@ class Slots extends Command {
}; };
function editMsg() { function editMsg() {
let msg = "[ :slot_machine: l SLOTS ]\n------------------\n"; let msg = "[ :slot_machine: l SLOTS ]\n------------------\n";
i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0; i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0;
i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0; i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0;
@ -144,9 +159,9 @@ class Slots extends Command {
k2 = (k2 < fruits.length - 1) ? k2 + 1 : 0; k2 = (k2 < fruits.length - 1) ? k2 + 1 : 0;
k3 = (k3 < fruits.length - 1) ? k3 + 1 : 0; k3 = (k3 < fruits.length - 1) ? k3 + 1 : 0;
msg += colonnes[0][i1] + " : " + colonnes[1][j1] + " : "+ colonnes[2][k1] + "\n"; msg += colonnes[0][i1] + " : " + colonnes[1][j1] + " : " + colonnes[2][k1] + "\n";
msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : "+ colonnes[2][k2] + " **<**\n"; msg += colonnes[0][i2] + " : " + colonnes[1][j2] + " : " + colonnes[2][k2] + " **<**\n";
msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : "+ colonnes[2][k3] + "\n"; msg += colonnes[0][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n";
tmsg.edit(msg); tmsg.edit(msg);
}; };

View file

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Withdraw extends Command { class Withdraw extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "withdraw", name: "withdraw",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "wd" ], aliases: ["wd"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 1000 cooldown: 1000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
let amount = args[0]; let amount = args[0];
if (!(parseInt(data.memberData.bankSold, 10) > 0)) return message.error("economy/withdraw:NO_CREDIT"); if (!(parseInt(data.memberData.bankSold, 10) > 0)) return message.error("economy/withdraw:NO_CREDIT");
@ -25,7 +25,7 @@ class Withdraw extends Command {
if (args[0] === "all") { if (args[0] === "all") {
amount = parseInt(data.memberData.bankSold, 10); amount = parseInt(data.memberData.bankSold, 10);
} else { } else {
if (isNaN(amount) || parseInt(amount, 10) < 1)return message.error("economy/withdraw:MISSING_AMOUNT"); if (isNaN(amount) || parseInt(amount, 10) < 1) return message.error("economy/withdraw:MISSING_AMOUNT");
amount = parseInt(amount, 10); amount = parseInt(amount, 10);
}; };
@ -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

@ -2,29 +2,31 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Work extends Command { class Work extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "work", name: "work",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "salaire", "salary", "travail", "daily", "dailies" ], aliases: ["salaire", "salary", "travail", "daily", "dailies"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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.memberData.cooldowns.work; const isInCooldown = data.memberData.cooldowns.work;
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/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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Eightball extends Command { class Eightball extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "8ball", name: "8ball",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "eight-ball", "eightball" ], aliases: ["eight-ball", "eightball"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args) { async run(message, args) {
if (!args[0] || !message.content.endsWith("?")) return message.error("fun/8ball:ERR_QUESTION"); if (!args[0] || !message.content.endsWith("?")) return message.error("fun/8ball:ERR_QUESTION");
const answerNO = parseInt(Math.floor(Math.random() * 10), 10); const answerNO = parseInt(Math.floor(Math.random() * 10), 10);

View file

@ -4,7 +4,7 @@ const Command = require("../../base/Command.js"),
figletAsync = util.promisify(figlet); figletAsync = util.promisify(figlet);
class Ascii extends Command { class Ascii extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "ascii", name: "ascii",
dirname: __dirname, dirname: __dirname,
@ -12,18 +12,20 @@ class Ascii extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args) { async run(message, args) {
const text = args.join(" "); const text = args.join(" ");
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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Choice extends Command { class Choice extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "choice", name: "choice",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "random" ], aliases: ["random"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args) { async run(message, args) {
// Gets the answers by spliting on "/" // Gets the answers by spliting on "/"
const answers = args.join(" ").split("/"); const answers = args.join(" ").split("/");
if (answers.length < 2) return message.error("fun/choice:MISSING"); if (answers.length < 2) return message.error("fun/choice:MISSING");
@ -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

@ -4,7 +4,7 @@ const Command = require("../../base/Command.js"),
const currentGames = {}; const currentGames = {};
class FindWords extends Command { class FindWords extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "findwords", name: "findwords",
dirname: __dirname, dirname: __dirname,
@ -12,14 +12,14 @@ class FindWords extends Command {
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
if (currentGames[message.guild.id]) return message.error("fun/number:GAME_RUNNING"); if (currentGames[message.guild.id]) return message.error("fun/number:GAME_RUNNING");
// Reads words file // Reads words 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

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

View file

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Fml extends Command { class Fml extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "fml", name: "fml",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "vdm" ], aliases: ["vdm"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED"); if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED");
// const fml = await this.client.joker.randomVDM(null, data.guild.language.substr(0, 2)); // const fml = await this.client.joker.randomVDM(null, data.guild.language.substr(0, 2));

View file

@ -2,26 +2,26 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Joke extends Command { class Joke extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "joke", name: "joke",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "blague" ], aliases: ["blague"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED"); if (!this.client.config.apiKeys.blagueXYZ) return message.error("misc:COMMAND_DISABLED");
// const joke = await this.client.joker.randomJoke(data.guild.language.substr(0, 2)); // const joke = await this.client.joker.randomJoke(data.guild.language.substr(0, 2));
const joke = await this.client.joker.randomJoke("en"); const joke = await this.client.joker.randomJoke("en");
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.setDescription(joke.toDiscordSpoils()) .setDescription(joke.toDiscordSpoils())

View file

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Lmg extends Command { class Lmg extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "lmg", name: "lmg",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "lmgtfy" ], aliases: ["lmgtfy"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 1000 cooldown: 1000
}); });
} }
async run (message, args) { async run(message, args) {
const question = args.join(" "); const question = args.join(" ");
if (!question) return message.error("fun/lmg:MISSING"); if (!question) return message.error("fun/lmg:MISSING");
const encodedQuestion = question.replace(/[' '_]/g, "+"); const encodedQuestion = question.replace(/[' '_]/g, "+");

View file

@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"),
md5 = require("md5"); md5 = require("md5");
class Lovecalc extends Command { class Lovecalc extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "lovecalc", name: "lovecalc",
dirname: __dirname, dirname: __dirname,
@ -11,14 +11,14 @@ class Lovecalc extends Command {
guildOnly: true, guildOnly: true,
aliases: ["lc"], aliases: ["lc"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 1000 cooldown: 1000
}); });
} }
async run (message) { async run(message) {
const firstMember = message.mentions.members.filter(m => m.id !== message.author.id).first(); const firstMember = message.mentions.members.filter(m => m.id !== message.author.id).first();
if (!firstMember) return message.error("fun/lovecalc:MISSING"); if (!firstMember) return message.error("fun/lovecalc:MISSING");
const secondMember = message.mentions.members const secondMember = message.mentions.members
@ -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

@ -4,7 +4,7 @@ const Command = require("../../base/Command.js"),
const currentGames = {}; const currentGames = {};
class Number extends Command { class Number extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "number", name: "number",
dirname: __dirname, dirname: __dirname,
@ -12,14 +12,14 @@ class Number extends Command {
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message) { async run(message) {
if (currentGames[message.guild.id]) return message.error("fun/number:GAME_RUNNING"); if (currentGames[message.guild.id]) return message.error("fun/number:GAME_RUNNING");
const participants = []; const participants = [];
@ -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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Activity extends Command { class Activity extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "activity", name: "activity",
dirname: __dirname, dirname: __dirname,
@ -10,14 +10,14 @@ class Activity extends Command {
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const voice = message.member.voice.channel; const voice = message.member.voice.channel;
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
@ -38,7 +38,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "betrayal": case "betrayal":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "betrayal").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "betrayal").then(async invite => {
@ -50,7 +50,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "checkers": case "checkers":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "checkers").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "checkers").then(async invite => {
@ -62,7 +62,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "chess": case "chess":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "chess").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "chess").then(async invite => {
@ -74,7 +74,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "doodlecrew": case "doodlecrew":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "doodlecrew").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "doodlecrew").then(async invite => {
@ -86,7 +86,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "fishing": case "fishing":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "fishing").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "fishing").then(async invite => {
@ -98,7 +98,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "lettertile": case "lettertile":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "lettertile").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "lettertile").then(async invite => {
@ -110,7 +110,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "poker": case "poker":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "poker").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "poker").then(async invite => {
@ -122,7 +122,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "spellcast": case "spellcast":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "spellcast").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "spellcast").then(async invite => {
@ -134,7 +134,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "wordsnack": case "wordsnack":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "wordsnack").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "wordsnack").then(async invite => {
@ -146,7 +146,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "puttparty": case "puttparty":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "puttparty").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "puttparty").then(async invite => {
@ -158,7 +158,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
case "youtube": case "youtube":
this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "youtube").then(async invite => { this.client.discordTogether.createTogetherCode(message.member.voice.channelID, "youtube").then(async invite => {
@ -170,7 +170,7 @@ class Activity extends Command {
.setTimestamp() .setTimestamp()
return message.channel.send(embed); return message.channel.send(embed);
}); });
break; break;
default: default:
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
@ -180,7 +180,7 @@ class Activity extends Command {
.setFooter(message.translate("general/activity:FOOTER")) .setFooter(message.translate("general/activity:FOOTER"))
.setTimestamp() .setTimestamp()
message.channel.send(embed); message.channel.send(embed);
break; break;
}; };
} }
}; };

View file

@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Fortnite extends Command { class Fortnite extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "fortnite", name: "fortnite",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "fn" ], aliases: ["fn"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
if (!data.config.apiKeys.fortniteTRN || data.config.apiKeys.fortniteTRN.length === "") return message.success("misc:COMMAND_DISABLED"); if (!data.config.apiKeys.fortniteTRN || data.config.apiKeys.fortniteTRN.length === "") return message.success("misc:COMMAND_DISABLED");
const stats = new Canvas.FortniteStats(); const stats = new Canvas.FortniteStats();
@ -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,17 +53,22 @@ 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", {
.attachFiles(attachment) username: `[${stats.data.username}](${stats.data.url.replace(new RegExp(" ", "g"), "%20")})`
.setImage("attachment://fortnite-stats-image.png") }))
.setColor(data.config.embed.color) .attachFiles(attachment)
.setFooter(data.config.embed.footer); .setImage("attachment://fortnite-stats-image.png")
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
message.channel.send(embed); message.channel.send(embed);
m.delete(); m.delete();
} }

View file

@ -3,15 +3,15 @@ const Command = require("../../base/Command.js"),
Canvas = require("discord-canvas"); Canvas = require("discord-canvas");
class Fortniteshop extends Command { class Fortniteshop extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "fortniteshop", name: "fortniteshop",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "fnshop" ], aliases: ["fnshop"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
@ -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

@ -3,27 +3,33 @@ const Command = require("../../base/Command.js"),
fetch = require("node-fetch"); fetch = require("node-fetch");
class Github extends Command { class Github extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "github", name: "github",
dirname: __dirname, dirname: __dirname,
enabled: false, enabled: false,
guildOnly: false, guildOnly: false,
aliases: [ "git", "code" ], aliases: ["git", "code"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
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

@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"),
fetch = require("node-fetch"); fetch = require("node-fetch");
class Hastebin extends Command { class Hastebin extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "hastebin", name: "hastebin",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "pastebin" ], aliases: ["pastebin"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const content = args.join(" "); const content = args.join(" ");
if (!content) return message.error("general/hastebin:MISSING_TEXT"); if (!content) return message.error("general/hastebin:MISSING_TEXT");
@ -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();
@ -39,7 +41,7 @@ class Hastebin extends Command {
.setDescription(url) .setDescription(url)
.setColor(data.config.embed.color); .setColor(data.config.embed.color);
message.channel.send(embed); message.channel.send(embed);
} catch(e) { } catch (e) {
message.error("misc:ERR_OCCURRED"); message.error("misc:ERR_OCCURRED");
}; };
} }

View file

@ -2,41 +2,49 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Help extends Command { class Help extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "help", name: "help",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "aide", "h", "commands" ], aliases: ["aide", "h", "commands"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Invitations extends Command { class Invitations extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "invitations", name: "invitations",
dirname: __dirname, dirname: __dirname,
@ -10,18 +10,17 @@ class Invitations extends Command {
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "MANAGE_GUILD" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_GUILD"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
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

@ -2,31 +2,33 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Invite extends Command { class Invite extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "invite", name: "invite",
dirname: __dirname, dirname: __dirname,
enabled: false, enabled: false,
guildOnly: false, guildOnly: false,
aliases: [ "i", "add", "vote" ], aliases: ["i", "add", "vote"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -5,22 +5,22 @@ const Command = require("../../base/Command.js"),
Sentry = require("@sentry/node"); Sentry = require("@sentry/node");
class Minecraft extends Command { class Minecraft extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "minecraft", name: "minecraft",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "mc" ], aliases: ["mc"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const ip = args[0]; const ip = args[0];
if (!ip) return message.error("general/minecraft:MISSING_IP"); if (!ip) return message.error("general/minecraft:MISSING_IP");
@ -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,17 +66,23 @@ 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)
.setThumbnail(favicon) .setThumbnail(favicon)
.setFooter(data.config.embed.footer); .setFooter(data.config.embed.footer);
m.edit(null, [ mcEmbed, imgAttachment ]); m.edit(null, [mcEmbed, imgAttachment]);
} }
}; };

View file

@ -1,24 +1,25 @@
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 {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "permissions", name: "permissions",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "perms" ], aliases: ["perms"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message) { async run(message) {
const member = message.mentions.members.first() || message.member; const member = message.mentions.members.first() || message.member;
let text = "```\n" + `${message.translate("general/permissions:TITLE", { user: member.user.username, channel: message.channel.name })}\n\n`; let text = "```\n" + `${message.translate("general/permissions:TITLE", { user: member.user.username, channel: message.channel.name })}\n\n`;
const mPermissions = message.channel.permissionsFor(member); const mPermissions = message.channel.permissionsFor(member);

View file

@ -1,24 +1,30 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Ping extends Command { class Ping extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "ping", name: "ping",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "pong", "latency" ], aliases: ["pong", "latency"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES" ], botPermissions: ["SEND_MESSAGES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -2,25 +2,29 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Quote extends Command { class Quote extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "quote", name: "quote",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "quoter" ], aliases: ["quoter"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
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

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
ms = require("ms"); ms = require("ms");
class Remindme extends Command { class Remindme extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "remindme", name: "remindme",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "reminder" ], aliases: ["reminder"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const time = args[0]; const time = args[0];
if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME"); if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME");
@ -27,7 +27,7 @@ class Remindme extends Command {
const rData = { const rData = {
message: msg, message: msg,
createdAt: Date.now(), createdAt: Date.now(),
sendAt: Date.now()+ms(time) sendAt: Date.now() + ms(time)
}; };
if (!data.userData.reminds) data.userData.reminds = []; if (!data.userData.reminds) data.userData.reminds = [];
@ -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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Report extends Command { class Report extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "report", name: "report",
dirname: __dirname, dirname: __dirname,
@ -10,14 +10,14 @@ class Report extends Command {
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const repChannel = message.guild.channels.cache.get(data.guild.plugins.reports); const repChannel = message.guild.channels.cache.get(data.guild.plugins.reports);
if (!repChannel) return message.error("general/report:MISSING_CHANNEL"); if (!repChannel) return message.error("general/report:MISSING_CHANNEL");
@ -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

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Serverinfo extends Command { class Serverinfo extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "serverinfo", name: "serverinfo",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "si" ], aliases: ["si"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
let guild = message.guild; let guild = message.guild;
if (args[0]) { if (args[0]) {
@ -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

@ -1,27 +1,28 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Setafk extends Command { class Setafk extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "setafk", name: "setafk",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "afk" ], aliases: ["afk"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
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

@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"),
fetch = require("node-fetch"); fetch = require("node-fetch");
class ShortURL extends Command { class ShortURL extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "shorturl", name: "shorturl",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "minimize" ], aliases: ["minimize"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const url = args[0]; const url = args[0];
if (!url) return message.error("general/shorturl:MISSING_URL"); if (!url) return message.error("general/shorturl:MISSING_URL");

View file

@ -2,29 +2,33 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Someone extends Command { class Someone extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "someone", name: "someone",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "somebody", "something" ], aliases: ["somebody", "something"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 1000 cooldown: 1000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const member = message.guild.members.cache.random(1)[0]; const member = message.guild.members.cache.random(1)[0];
const embed = new Discord.MessageEmbed() const embed = new Discord.MessageEmbed()
.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

@ -2,27 +2,29 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Staff extends Command { class Staff extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "staff", name: "staff",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "stafflist", "staffliste" ], aliases: ["stafflist", "staffliste"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
await message.guild.members.fetch(); await message.guild.members.fetch();
const administrators = message.guild.members.cache.filter((m) => m.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

@ -2,35 +2,42 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Stats extends Command { class Stats extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "stats", name: "stats",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "statistics", "infobot", "botinfos", "bot-infos", "bot-info", "infos-bot", "info-bot" ], aliases: ["statistics", "infobot", "botinfos", "bot-infos", "bot-info", "infos-bot", "info-bot"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const statsEmbed = new Discord.MessageEmbed() const statsEmbed = new Discord.MessageEmbed()
.setColor(data.config.embed.color) .setColor(data.config.embed.color)
.setFooter(data.config.embed.footer) .setFooter(data.config.embed.footer)
.setAuthor(message.translate("common:STATS")) .setAuthor(message.translate("common:STATS"))
.setDescription(message.translate("general/stats:MADE")) .setDescription(message.translate("general/stats:MADE"))
.addField(this.client.customEmojis.stats + " " + message.translate("general/stats:COUNTS_TITLE"), message.translate("general/stats:COUNTS_CONTENT", { 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")
})); }));
statsEmbed.addField(this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", { statsEmbed.addField(this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", {

View file

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Suggest extends Command { class Suggest extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "suggest", name: "suggest",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "suggestion", "sugg" ], aliases: ["suggestion", "sugg"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const suggChannel = message.guild.channels.cache.get(data.guild.plugins.suggestions); const suggChannel = message.guild.channels.cache.get(data.guild.plugins.suggestions);
if (!suggChannel) return message.error("general/suggest:MISSING_CHANNEL"); if (!suggChannel) return message.error("general/suggest:MISSING_CHANNEL");
@ -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

@ -5,22 +5,22 @@ const Command = require("../../base/Command.js"),
const langs = ["afrikaans", "albanian", "amharic", "arabic", "armenian", "azerbaijani", "bangla", "basque", "belarusian", "bengali", "bosnian", "bulgarian", "burmese", "catalan", "cebuano", "chichewa", "corsican", "croatian", "czech", "danish", "dutch", "english", "esperanto", "estonian", "filipino", "finnish", "french", "frisian", "galician", "georgian", "german", "greek", "gujarati", "haitian creole", "hausa", "hawaiian", "hebrew", "hindi", "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian", "japanese", "javanese", "kannada", "kazakh", "khmer", "korean", "kurdish (kurmanji)", "kyrgyz", "lao", "latin", "latvian", "lithuanian", "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese", "maori", "marathi", "mongolian", "myanmar (burmese)", "nepali", "norwegian", "nyanja", "pashto", "persian", "polish", "portugese", "punjabi", "romanian", "russian", "samoan", "scottish gaelic", "serbian", "sesotho", "shona", "sindhi", "sinhala", "slovak", "slovenian", "somali", "spanish", "sundanese", "swahili", "swedish", "tajik", "tamil", "telugu", "thai", "turkish", "ukrainian", "urdu", "uzbek", "vietnamese", "welsh", "xhosa", "yiddish", "yoruba", "zulu"]; const langs = ["afrikaans", "albanian", "amharic", "arabic", "armenian", "azerbaijani", "bangla", "basque", "belarusian", "bengali", "bosnian", "bulgarian", "burmese", "catalan", "cebuano", "chichewa", "corsican", "croatian", "czech", "danish", "dutch", "english", "esperanto", "estonian", "filipino", "finnish", "french", "frisian", "galician", "georgian", "german", "greek", "gujarati", "haitian creole", "hausa", "hawaiian", "hebrew", "hindi", "hmong", "hungarian", "icelandic", "igbo", "indonesian", "irish", "italian", "japanese", "javanese", "kannada", "kazakh", "khmer", "korean", "kurdish (kurmanji)", "kyrgyz", "lao", "latin", "latvian", "lithuanian", "luxembourgish", "macedonian", "malagasy", "malay", "malayalam", "maltese", "maori", "marathi", "mongolian", "myanmar (burmese)", "nepali", "norwegian", "nyanja", "pashto", "persian", "polish", "portugese", "punjabi", "romanian", "russian", "samoan", "scottish gaelic", "serbian", "sesotho", "shona", "sindhi", "sinhala", "slovak", "slovenian", "somali", "spanish", "sundanese", "swahili", "swedish", "tajik", "tamil", "telugu", "thai", "turkish", "ukrainian", "urdu", "uzbek", "vietnamese", "welsh", "xhosa", "yiddish", "yoruba", "zulu"];
class Translate extends Command { class Translate extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "translate", name: "translate",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "traduction", "translation", "trad" ], aliases: ["traduction", "translation", "trad"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
if (args[0] === "langs-list") { if (args[0] === "langs-list") {
const langsList = "```css\n" + (langs.map((lang, i) => `${i + 1} - ${lang}`).join("\n")) + "```"; const langsList = "```css\n" + (langs.map((lang, i) => `${i + 1} - ${lang}`).join("\n")) + "```";
message.author.send(langsList).then(() => { message.author.send(langsList).then(() => {
@ -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 });
@ -40,18 +42,26 @@ class Translate extends Command {
const language = args[0].toLowerCase(); const language = args[0].toLowerCase();
const toTranslate = args.slice(1).join(" "); const toTranslate = args.slice(1).join(" ");
if (!langs.includes(language)) 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

@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"),
fetch = require("node-fetch"); fetch = require("node-fetch");
class Userinfo extends Command { class Userinfo extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "userinfo", name: "userinfo",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "ui" ], aliases: ["ui"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
let displayPresence = true; let displayPresence = true;
const isID = !isNaN(args[0]); const isID = !isNaN(args[0]);
@ -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);
@ -58,15 +68,19 @@ class Userinfo extends Command {
if (member) { if (member) {
embed.addField(this.client.customEmojis.up + " " + message.translate("general/userinfo:ROLE"), (member.roles.highest ? member.roles.highest : message.translate("general/userinfo:NO_ROLE")), true) embed.addField(this.client.customEmojis.up + " " + message.translate("general/userinfo:ROLE"), (member.roles.highest ? member.roles.highest : message.translate("general/userinfo:NO_ROLE")), true)
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Approved extends Command { class Approved extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "approved", name: "approved",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Approved extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Avatar extends Command { class Avatar extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "avatar", name: "avatar",
dirname: __dirname, dirname: __dirname,
@ -10,20 +10,25 @@ class Avatar extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class BatSlap extends Command { class BatSlap extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "batslap", name: "batslap",
dirname: __dirname, dirname: __dirname,
@ -10,22 +10,34 @@ class BatSlap extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
async run (message, args) { async run(message, args) {
const users = [ const users = [
await this.client.resolveUser(args[0]) || message.author, await this.client.resolveUser(args[0]) || message.author,
await this.client.resolveUser(args[1]) || message.author await this.client.resolveUser(args[1]) || message.author
]; ];
const m = await message.sendT("misc:PLEASE_WAIT", null, { 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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Beautiful extends Command { class Beautiful extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "beautiful", name: "beautiful",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Beautiful extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"),
canvacord = require("canvacord"); canvacord = require("canvacord");
class Bed extends Command { class Bed extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "bed", name: "bed",
dirname: __dirname, dirname: __dirname,
@ -11,28 +11,36 @@ class Bed extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
async run (message, args) { async run(message, args) {
const users = [ const users = [
await this.client.resolveUser(args[0]) || message.author, await this.client.resolveUser(args[0]) || message.author,
await this.client.resolveUser(args[1]) || message.author await this.client.resolveUser(args[1]) || message.author
]; ];
const m = await message.sendT("misc:PLEASE_WAIT", null, { 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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Brazzers extends Command { class Brazzers extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "brazzers", name: "brazzers",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Brazzers extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Burn extends Command { class Burn extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "burn", name: "burn",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Burn extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"),
fetch = require("node-fetch"); fetch = require("node-fetch");
class Captcha extends Command { class Captcha extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "captcha", name: "captcha",
dirname: __dirname, dirname: __dirname,
@ -11,23 +11,25 @@ class Captcha extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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();
const attachment = new Discord.MessageAttachment(json.message, "captcha.png"); const attachment = new Discord.MessageAttachment(json.message, "captcha.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:ERR_OCCURRED", null, { m.error("misc:ERR_OCCURRED", null, {
edit: true edit: true

View file

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Challenger extends Command { class Challenger extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "challenger", name: "challenger",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Challenger extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"),
fetch = require("node-fetch"); fetch = require("node-fetch");
class Clyde extends Command { class Clyde extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "clyde", name: "clyde",
dirname: __dirname, dirname: __dirname,
@ -11,28 +11,32 @@ class Clyde extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
async run (message, args) { async run(message, args) {
const text = args.join(" "); const text = args.join(" ");
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();
const attachment = new Discord.MessageAttachment(json.message, "clyde.png"); const attachment = new Discord.MessageAttachment(json.message, "clyde.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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Dictator extends Command { class Dictator extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "dictator", name: "dictator",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Dictator extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -3,24 +3,26 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Facepalm extends Command { class Facepalm extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "facepalm", name: "facepalm",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "palm" ], aliases: ["palm"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Fire extends Command { class Fire extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "fire", name: "fire",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Fire extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Jail extends Command { class Jail extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "jail", name: "jail",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Jail extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"),
fetch = require("node-fetch"); fetch = require("node-fetch");
class Love extends Command { class Love extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "love", name: "love",
dirname: __dirname, dirname: __dirname,
@ -11,29 +11,33 @@ class Love extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
async run (message, args) { async run(message, args) {
const users = [ const users = [
await this.client.resolveUser(args[0]) || message.author, await this.client.resolveUser(args[0]) || message.author,
await this.client.resolveUser(args[1]) || message.author await this.client.resolveUser(args[1]) || message.author
]; ];
const m = await message.sendT("misc:PLEASE_WAIT", null, { 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();
const attachment = new Discord.MessageAttachment(json.message, "love.png"); const attachment = new Discord.MessageAttachment(json.message, "love.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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Mission extends Command { class Mission extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "mission", name: "mission",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Mission extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"),
canvacord = require("canvacord"); canvacord = require("canvacord");
class Phcomment extends Command { class Phcomment extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "phcomment", name: "phcomment",
dirname: __dirname, dirname: __dirname,
@ -11,14 +11,14 @@ class Phcomment extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
async run (message, args) { async run(message, args) {
let user = await this.client.resolveUser(args[0]); let user = await this.client.resolveUser(args[0]);
let text = args.join(" "); let text = args.join(" ");
@ -36,15 +36,19 @@ 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");
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

@ -2,32 +2,36 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Qrcode extends Command { class Qrcode extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "qrcode", name: "qrcode",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "qr" ], aliases: ["qr"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 3000 cooldown: 3000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Rip extends Command { class Rip extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "rip", name: "rip",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Rip extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Scary extends Command { class Scary extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "scary", name: "scary",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Scary extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Tobecontinued extends Command { class Tobecontinued extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "tobecontinued", name: "tobecontinued",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Tobecontinued extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -3,7 +3,7 @@ const Command = require("../../base/Command.js"),
canvacord = require("canvacord"); canvacord = require("canvacord");
class Trash extends Command { class Trash extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "trash", name: "trash",
dirname: __dirname, dirname: __dirname,
@ -11,19 +11,25 @@ class Trash extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Triggered extends Command { class Triggered extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "triggered", name: "triggered",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,29 @@ class Triggered extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Tweet extends Command { class Tweet extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "tweet", name: "tweet",
dirname: __dirname, dirname: __dirname,
enabled: false, enabled: false,
guildOnly: false, guildOnly: false,
aliases: [ "twitter" ], aliases: ["twitter"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
async run (message, args) { async run(message, args) {
const user = message.mentions.users.first() || message.author; const user = message.mentions.users.first() || message.author;
const text = args.slice(1).join(" "); const text = args.slice(1).join(" ");
@ -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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Wanted extends Command { class Wanted extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "wanted", name: "wanted",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Wanted extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -2,7 +2,7 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Wasted extends Command { class Wasted extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "wasted", name: "wasted",
dirname: __dirname, dirname: __dirname,
@ -10,19 +10,27 @@ class Wasted extends Command {
guildOnly: false, guildOnly: false,
aliases: [], aliases: [],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
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

@ -3,22 +3,22 @@ const Command = require("../../base/Command.js"),
canvacord = require("canvacord"); canvacord = require("canvacord");
class YouTubeComment extends Command { class YouTubeComment extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "youtube-comment", name: "youtube-comment",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: false, guildOnly: false,
aliases: [ "ytcomment" ], aliases: ["ytcomment"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 5000 cooldown: 5000
}); });
} }
async run (message, args) { async run(message, args) {
let user = await this.client.resolveUser(args[0]); let user = await this.client.resolveUser(args[0]);
let text = args.join(" "); let text = args.join(" ");
@ -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

@ -2,22 +2,22 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Announcement extends Command { class Announcement extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "announcement", name: "announcement",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [ "MENTION_EVERYONE" ], memberPermissions: ["MENTION_EVERYONE"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const text = args.join(" "); const text = args.join(" ");
if (!text) return message.error("moderation/announcement:MISSING_TEXT"); if (!text) return message.error("moderation/announcement:MISSING_TEXT");
if (text.length > 1030) return message.error("moderation/announcement:TOO_LONG"); if (text.length > 1030) return message.error("moderation/announcement:TOO_LONG");
@ -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

@ -2,32 +2,37 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Ban extends Command { class Ban extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "ban", name: "ban",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [], aliases: [],
memberPermissions: [ "BAN_MEMBERS" ], memberPermissions: ["BAN_MEMBERS"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const user = await this.client.resolveUser(args[0]); const user = await this.client.resolveUser(args[0]);
if (!user) 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(" ");
@ -37,7 +42,7 @@ class Ban extends Command {
if (member) { if (member) {
const memberPosition = member.roles.highest.position; const memberPosition = member.roles.highest.position;
const moderationPosition = message.member.roles.highest.position; const moderationPosition = message.member.roles.highest.position;
if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition))return message.error("moderation/ban:SUPERIOR"); if (message.member.ownerID !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR");
if (!member.bannable) return message.error("moderation/ban:MISSING_PERM"); if (!member.bannable) return message.error("moderation/ban:MISSING_PERM");
}; };
@ -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

@ -2,27 +2,27 @@ const Command = require("../../base/Command.js"),
Discord = require("discord.js"); Discord = require("discord.js");
class Checkinvites extends Command { class Checkinvites extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "checkinvites", name: "checkinvites",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "checkinvite", "checki" ], aliases: ["checkinvite", "checki"],
memberPermissions: [], memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args, data) { async run(message, args, data) {
const members = message.guild.members; const members = message.guild.members;
const withInvite = []; const withInvite = [];
members.cache.forEach((m) => { members.cache.forEach((m) => {
const possibleLinks = m.user.presence.activities.map((a) => [ a.state, a.details, a.name ]).flat(); const possibleLinks = m.user.presence.activities.map((a) => [a.state, a.details, a.name]).flat();
const inviteLinks = possibleLinks.filter((l) => /(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(l)); const inviteLinks = possibleLinks.filter((l) => /(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(l));
if (inviteLinks.length > 0) { if (inviteLinks.length > 0) {
withInvite.push({ withInvite.push({
@ -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

@ -1,22 +1,22 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Clear extends Command { class Clear extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "clear", name: "clear",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "clear", "bulkdelete", "purge" ], aliases: ["clear", "bulkdelete", "purge"],
memberPermissions: [ "MANAGE_MESSAGES" ], memberPermissions: ["MANAGE_MESSAGES"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS", "MANAGE_MESSAGES" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_MESSAGES"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args) { async run(message, args) {
if (args[0] === "all") { if (args[0] === "all") {
message.sendT("moderation/clear:ALL_CONFIRM"); message.sendT("moderation/clear:ALL_CONFIRM");
await message.channel.awaitMessages((m) => (m.author.id === message.author.id) && (m.content === "confirm"), { await message.channel.awaitMessages((m) => (m.author.id === message.author.id) && (m.content === "confirm"), {
@ -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,12 +55,17 @@ 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 () {
toDelete.delete(); toDelete.delete();
}, 2000); }, 2000);
} }

View file

@ -1,29 +1,34 @@
const Command = require("../../base/Command.js"); const Command = require("../../base/Command.js");
class Clearsanctions extends Command { class Clearsanctions extends Command {
constructor (client) { constructor(client) {
super(client, { super(client, {
name: "clearsanctions", name: "clearsanctions",
dirname: __dirname, dirname: __dirname,
enabled: true, enabled: true,
guildOnly: true, guildOnly: true,
aliases: [ "clearwarns" ], aliases: ["clearwarns"],
memberPermissions: [ "MANAGE_MESSAGES" ], memberPermissions: ["MANAGE_MESSAGES"],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ], botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false, nsfw: false,
ownerOnly: false, ownerOnly: false,
cooldown: 2000 cooldown: 2000
}); });
} }
async run (message, args) { async run(message, args) {
const member = await this.client.resolveMember(args[0], message.guild); const member = await this.client.resolveMember(args[0], message.guild);
if (!member) 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
});
} }
}; };

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