Основа готова, осталось переписать команды под интеракции

This commit is contained in:
JonnyBro 2022-07-23 17:14:42 +05:00
parent dd8367f97c
commit 5a1e5b64c5
176 changed files with 839 additions and 9618 deletions

18
base/BaseCommand.js Normal file
View file

@ -0,0 +1,18 @@
class BaseCommand {
constructor(options) {
/**
* @type {import("@discordjs/builders").SlashCommandBuilder | import("discord.js").ApplicationCommandData}
*/
this.command = options.command;
/**
* @type {Array<String>}
*/
this.aliases = options.aliases;
/**
* @type {Boolean}
*/
this.guildOnly = options.guildOnly || true;
}
}
module.exports = BaseCommand;

14
base/BaseEvent.js Normal file
View file

@ -0,0 +1,14 @@
class BaseEvent {
constructor(options) {
/**
* @type {String}
*/
this.name = options.name;
/**
* @type {Boolean}
*/
this.once = options.once;
}
}
module.exports = BaseEvent;

View file

@ -1,23 +0,0 @@
const path = require("path");
module.exports = class Command {
constructor(client, {
name = null,
dirname = false,
enabled = true,
guildOnly = false,
aliases = new Array(),
botPermissions = new Array(),
memberPermissions = new Array(),
nsfw = false,
ownerOnly = false,
cooldown = 3000
})
{
const category = (dirname ? dirname.split(path.sep)[parseInt(dirname.split(path.sep).length - 1, 10)] : "Other");
this.client = client;
this.conf = { enabled, guildOnly, memberPermissions, botPermissions, nsfw, ownerOnly, cooldown};
this.help = { name, category, aliases };
}
};

View file

@ -1,6 +1,5 @@
const mongoose = require("mongoose"),
Schema = mongoose.Schema,
config = require("../config"),
languages = require("../languages/language-meta.json");
module.exports = mongoose.model("Guild", new Schema({
@ -13,7 +12,6 @@ module.exports = mongoose.model("Guild", new Schema({
/* CONFIGURATION */
language: { type: String, default: languages.find((l) => l.default).name }, // Language of the guild
prefix: { type: String, default: config.prefix }, // Default or custom prefix of the guild
plugins: { type: Object, default: { // Plugins data
// Welcome messages
welcome: {
@ -55,14 +53,6 @@ module.exports = mongoose.model("Guild", new Schema({
reports: false, // the channel in which the reports will be sent
logs: false // the channel in which the logs (message deleted, etc...) will be sent
}},
slowmode: { type: Object, default: { // Servers slowmode
users: [],
channels: []
}},
casesCount: { type: Number, default: 0 },
ignoredChannels: { type: Array, default: [] }, // Channels ignored by the bot
customCommands: { type: Array, default: [] }, // Custom commands of the guild
commands: { type: Array, default: [] }, // Commands logs
autoDeleteModCommands: { type: Boolean, default: false }, // Whether to auto delete moderation commands
disabledCategories: { type: Array, default: [] } // Disabled categories
}));

View file

@ -2,12 +2,18 @@ const { MessageEmbed, Client, Collection } = require("discord.js"),
{ GiveawaysManager } = require("discord-giveaways"),
{ SoundCloudPlugin } = require("@distube/soundcloud"),
{ SpotifyPlugin } = require("@distube/spotify"),
{ YtDlpPlugin } = require("@distube/yt-dlp");
{ YtDlpPlugin } = require("@distube/yt-dlp"),
{ SlashCommandBuilder } = require("@discordjs/builders"),
{ REST } = require("@discordjs/rest"),
{ Routes } = require("discord-api-types/v9");
const util = require("util"),
BaseEvent = require("./BaseEvent.js"),
BaseCommand = require("./BaseCommand.js"),
AmeClient = require("amethyste-api"),
path = require("path"),
fetch = require("node-fetch"),
fs = require("fs").promises,
mongoose = require("mongoose"),
DisTube = require("distube"),
moment = require("moment");
@ -26,16 +32,13 @@ class JaBa extends Client {
this.customEmojis = require("../emojis"); // load the bot's emojis
this.languages = require("../languages/language-meta"); // Load the bot's languages
this.commands = new Collection(); // Creates new commands collection
this.aliases = new Collection(); // Creates new command aliases collection
this.logger = require("../helpers/logger"); // Load the logger file
this.wait = util.promisify(setTimeout); // client.wait(1000) - Wait 1 second
this.functions = require("../helpers/functions"); // Load the functions file
this.guildsData = require("../base/Guild"); // Guild mongoose model
this.usersData = require("../base/User"); // User mongoose model
this.membersData = require("../base/Member"); // Member mongoose model
this.logs = require("../base/Log"); // Log mongoose model
this.dashboard = require("../dashboard/app"); // Dashboard app
this.queues = new Collection(); // This collection will be used for the music
this.states = {}; // Used for the dashboard
this.knownGuilds = [];
@ -43,22 +46,11 @@ class JaBa extends Client {
this.databaseCache.users = new Collection();
this.databaseCache.guilds = new Collection();
this.databaseCache.members = new Collection();
this.databaseCache.usersReminds = new Collection(); // members with active reminds
this.databaseCache.mutedUsers = new Collection(); // members who are currently muted
if (this.config.apiKeys.amethyste) this.AmeAPI = new AmeClient(this.config.apiKeys.amethyste);
this.icanhazdadjoke = async function() {
const joke = await fetch("https://icanhazdadjoke.com/", {
headers: {
"Accept": "application/json"
}
});
return joke.json();
};
this.player = new DisTube.default(this, {
plugins: [
new SpotifyPlugin({
@ -167,39 +159,140 @@ class JaBa extends Client {
return five;
}
// This function is used to load a command and add it to the collection
loadCommand(commandPath, commandName) {
/**
*
* @param {String} dir
* @param {String} guild_id
* @returns
*/
async loadCommands(dir, guild_id) {
const filePath = path.join(__dirname, dir);
const files = await fs.readdir(filePath);
const rest = new REST({ version: "9" }).setToken(this.config.token);
const commands = [];
const guild_commands = [];
for (let index = 0; index < files.length; index++) {
const file = files[index];
const stat = await fs.lstat(path.join(filePath, file));
if (stat.isDirectory()) this.loadCommands(this, path.join(dir, file));
if (file.endsWith(".js")) {
const Command = require(path.join(filePath, file));
if (Command.prototype instanceof BaseCommand) {
const command = new Command();
this.commands.set(command.command.name, command);
const aliases = [];
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0) {
command.aliases.forEach((alias) => {
const command_alias = command.command instanceof SlashCommandBuilder ? { ...command.command.toJSON() } : { ...command.command };
command_alias.name = alias;
aliases.push(command_alias);
this.commands.set(alias, command);
});
}
if (command.guildOnly) guild_commands.push(command.command instanceof SlashCommandBuilder ? command.command.toJSON() : command.command, ...aliases);
else commands.push(command.command instanceof SlashCommandBuilder ? command.command.toJSON() : command.command, ...aliases);
if (command.onLoad || typeof command.onLoad === "function") await command.onLoad(this);
this.logger.log(`Successfully loaded "${file}" command file. (Command: ${command.command.name})`);
}
}
}
try {
const props = new(require(`.${commandPath}${path.sep}${commandName}`))(this);
this.logger.log(`Loading Command: ${props.help.name}. 👌`, "log");
props.conf.location = commandPath;
if (props.init) props.init(this);
this.commands.set(props.help.name, props);
props.help.aliases.forEach((alias) => {
this.aliases.set(alias, props.help.name);
});
return false;
} catch (e) {
return `Unable to load command ${commandName}: ${e}`;
if (guild_id && guild_id.length) {
await rest.put(
Routes.applicationGuildCommands(this.config.user, guild_id), {
body: guild_commands
},
);
}
await rest.put(
Routes.applicationCommands(this.config.user), {
body: commands
},
);
this.logger.log("Successfully registered application commands.");
} catch (err) {
this.logger.log("Cannot load commands: " + err.message, "error");
}
}
// This function is used to unload a command (you need to load them again)
async unloadCommand(commandPath, commandName) {
let command;
if (this.commands.has(commandName)) command = this.commands.get(commandName);
else if (this.aliases.has(commandName)) command = this.commands.get(this.aliases.get(commandName));
if (!command) return `The command \`${commandName}\` doesn't seem to exist, nor is it an alias. Try again!`;
if (command.shutdown) await command.shutdown(this);
delete require.cache[require.resolve(`.${commandPath}${path.sep}${commandName}.js`)];
return false;
/**
*
* @param {String} dir
* @returns
*/
async loadEvents(dir) {
const filePath = path.join(__dirname, dir);
const files = await fs.readdir(filePath);
for (let index = 0; index < files.length; index++) {
const file = files[index];
const stat = await fs.lstat(path.join(filePath, file));
if (stat.isDirectory()) this.loadEvents(this, path.join(dir, file));
if (file.endsWith(".js")) {
const Event = require(path.join(filePath, file));
if (Event.prototype instanceof BaseEvent) {
const event = new Event();
if (!event.name || !event.name.length) return console.error(`Cannot load "${file}" event file: Event name is not set!`);
if (event.once) this.once(event.name, event.execute.bind(event, this));
else this.on(event.name, event.execute.bind(event, this));
this.logger.log(`Successfully loaded "${file}" event file. (Event: ${event.name})`);
}
}
}
}
async init() {
this.login(this.config.token);
mongoose.connect(this.config.mongoDB, {
useNewUrlParser: true,
useUnifiedTopology: true
}).then(() => {
this.logger.log("Connected to the Mongodb database.", "log");
}).catch((err) => {
this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error");
});
const languages = require("../helpers/languages");
this.translations = await languages();
// const autoUpdateDocs = require("../helpers/autoUpdateDocs");
// autoUpdateDocs.update(this);
}
// loadCommand(commandPath, commandName) {
// try {
// const props = new(require(`.${commandPath}${path.sep}${commandName}`))(this);
// this.logger.log(`Loading Command: ${props.help.name}. 👌`, "log");
// props.conf.location = commandPath;
// if (props.init) props.init(this);
// this.commands.set(props.help.name, props);
// props.help.aliases.forEach((alias) => {
// this.aliases.set(alias, props.help.name);
// });
// return false;
// } catch (e) {
// return `Unable to load command ${commandName}: ${e}`;
// }
// }
// async unloadCommand(commandPath, commandName) {
// let command;
// if (this.commands.has(commandName)) command = this.commands.get(commandName);
// else if (this.aliases.has(commandName)) command = this.commands.get(this.aliases.get(commandName));
// if (!command) return `The command \`${commandName}\` doesn't seem to exist, nor is it an alias. Try again!`;
// if (command.shutdown) await command.shutdown(this);
// delete require.cache[require.resolve(`.${commandPath}${path.sep}${commandName}.js`)];
// return false;
// }
// This function is used to find a user data or create it
async findOrCreateUser({ id: userID }, isLean) {
if (this.databaseCache.users.get(userID)) return isLean ? this.databaseCache.users.get(userID).toJSON() : this.databaseCache.users.get(userID);

View file

@ -1,15 +0,0 @@
const mongoose = require("mongoose");
module.exports = mongoose.model("Log", new mongoose.Schema({
commandName: { type: String, default: "unknown" },
date: { type: Number, default: Date.now() },
author: { type: Object, default: {
username: "Unknown",
discrminator: "0000",
id: null
}},
guild: { type: Object, default: {
name: "Unknown",
id: null
}}
}));

View file

@ -84,17 +84,10 @@ const userSchema = new mongoose.Schema({
/* OTHER INFORMATIONS */
afk: { type: String, default: null }, // The AFK reason (if any)
reminds: { type: Array, default: [] }, // The reminds of the user
playlists: { type: Array, default: [] }, // The playlists of the user
logged: { type: Boolean, default: false }, // If the user is logged to the dashboard
apiToken: { type: String, default: genToken() } // The API token of the user
});
userSchema.method("genApiToken", async function() {
this.apiToken = genToken();
await this.save();
return this.apiToken;
});
userSchema.method("getAchievements", async function() {
const canvas = Canvas.createCanvas(1800, 250),
ctx = canvas.getContext("2d");

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Addcommand extends Command {
constructor(client) {
super(client, {
name: "addcommand",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["addc"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
if (!args[0]) return message.error("administration/addcommand:MISSING_NAME");
const name = args[0].split("\n")[0];
if (this.client.commands.get(name) || this.client.aliases.get(name) || data.guild.customCommands.find((c) => c.name === name)) return message.error("administration/addcommand:COMMAND_ALREADY_EXISTS");
const answer = (args[0].split("\n")[1] || "") + args.slice(1).join(" ");
if (!answer) return message.error("administration/addcommand:MISSING_ANSWER");
data.guild.customCommands.push({
name: name.toLowerCase(),
answer: answer
});
data.guild.save();
message.success("administration/addcommand:SUCCESS", {
commandName: name
});
}
}
module.exports = Addcommand;

View file

@ -1,38 +0,0 @@
const Command = require("../../base/Command");
class Addemoji extends Command {
constructor(client) {
super(client, {
name: "addemoji",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["adde"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args) {
const url = args[0];
if (!url) return message.error("administration/addemoji:MISSING_URL");
const name = args[1] ? args[1].replace(/[^a-z0-9]/gi, "") : null;
if (!name) return message.error("administration/addemoji:MISSING_NAME");
if (name.length < 2 || name.length > 32) return message.error("administration/addemoji:INVALID_NAME");
message.guild.emojis
.create(url, name)
.then(emoji => message.success("administration/addemoji:SUCCESS", {
emoji: emoji.name
}))
.catch(() => message.error("administration/addemoji:ERROR", {
emoji: name
}));
}
}
module.exports = Addemoji;

View file

@ -1,55 +0,0 @@
const Command = require("../../base/Command");
class Automod extends Command {
constructor(client) {
super(client, {
name: "automod",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["autom"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const status = args[0];
if (!status || (status !== "on" && status !== "off")) return message.error("administration/automod:MISSING_STATUS");
if (status === "on") {
data.guild.plugins.automod = {
enabled: true,
ignored: []
};
data.guild.markModified("plugins.automod");
data.guild.save();
message.success("administration/automod:ENABLED", {
prefix: data.guild.prefix
});
} else if (status === "off") {
if (message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first()) {
const channel = message.mentions.channels.first();
data.guild.plugins.automod.ignored.push(channel);
data.guild.markModified("plugins.automod");
data.guild.save();
message.success("administration/automod:DISABLED_CHANNEL", {
channel: channel.toString()
});
} else {
data.guild.plugins.automod = {
enabled: false,
ignored: []
};
data.guild.markModified("plugins.automod");
data.guild.save();
message.success("administration/automod:DISABLED");
}
}
}
}
module.exports = Automod;

View file

@ -1,60 +0,0 @@
const Command = require("../../base/Command"),
Resolvers = require("../../helpers/resolvers");
class Autorole extends Command {
constructor(client) {
super(client, {
name: "autorole",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["autor"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const status = args[0];
if (status !== "on" && status !== "off") return message.error("administration/autorole:MISSING_STATUS");
if (status === "on") {
const role = await Resolvers.resolveRole({
message,
search: args.slice(1).join(" ")
});
if (!role) return message.error("administration/autorole:MISSING_ROLE");
data.guild.plugins.autorole = {
enabled: true,
role: role.id
};
data.guild.markModified("plugins.autorole");
await data.guild.save();
message.success("administration/autorole:SUCCESS_ENABLED", {
roleName: role.name
});
} else if (status === "off") {
if (!data.guild.plugins.autorole.enabled) return message.success("administration/autorole:ALREADY_DISABLED", {
prefix: data.guild.prefix
});
data.guild.plugins.autorole = {
enabled: false,
role: null
};
data.guild.markModified("plugins.autorole");
await data.guild.save();
message.success("administration/autorole:SUCCESS_DISABLED", {
prefix: data.guild.prefix
});
}
}
}
module.exports = Autorole;

View file

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

View file

@ -1,98 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Configuration extends Command {
constructor(client) {
super(client, {
name: "configuration",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["conf", "config"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const guildData = data.guild;
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.guild.name,
iconURL: message.guild.iconURL({
dynamic: true
})
})
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
// Guild prefix
embed.addField(message.translate("administration/configuration:PREFIX_TITLE"), guildData.prefix);
// 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
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
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
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
embed.addField(message.translate("administration/configuration:SPECIAL_CHANNELS"),
message.translate("administration/configuration:SUGGESTIONS", {
channel: guildData.plugins.suggestions ? `<#${guildData.plugins.suggestions}>` : message.translate("common:NOT_DEFINED")
}) + "\n" +
message.translate("administration/configuration:REPORTS", {
channel: guildData.plugins.reports ? `<#${guildData.plugins.reports}>` : message.translate("common:NOT_DEFINED")
}) + "\n" +
message.translate("administration/configuration:MODLOGS", {
channel: guildData.plugins.modlogs ? `<#${guildData.plugins.modlogs}>` : message.translate("common:NOT_DEFINED")
}) + "\n" +
message.translate("administration/configuration:BIRTHDAYS", {
channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : message.translate("common:NOT_DEFINED")
})
);
// 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")));
// 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"));
// 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"));
// Dashboard link
embed.addField(message.translate("administration/configuration:DASHBOARD_TITLE"), `[${message.translate("administration/configuration:DASHBOARD_CONTENT")}](${data.config.dashboard.baseURL})`);
message.reply({
embeds: [embed]
});
}
}
module.exports = Configuration;

View file

@ -1,33 +0,0 @@
const Command = require("../../base/Command");
class Delcommand extends Command {
constructor(client) {
super(client, {
name: "delcommand",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["delc"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const name = args[0];
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 });
data.guild.customCommands = data.guild.customCommands.filter((c) => c.name !== name);
data.guild.save();
message.success("administration/delcommand:SUCCESS", {
commandName: name
});
}
}
module.exports = Delcommand;

View file

@ -1,35 +0,0 @@
const Command = require("../../base/Command");
class Deletemod extends Command {
constructor(client) {
super(client, {
name: "deletemod",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["delm"],
memberPermissions: ["MANAGE_MESSAGES"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const status = args[0];
if (!status || status !== "on" && status !== "off") return message.error("administration/deletemod:MISSING_STATUS");
if (status === "on") {
data.guild.autoDeleteModCommands = true;
data.guild.save();
message.success("administration/deletemod:ENABLED");
} else {
data.guild.autoDeleteModCommands = false;
data.guild.save();
message.success("administration/deletemod:DISABLED");
}
}
}
module.exports = Deletemod;

View file

@ -1,108 +0,0 @@
const Command = require("../../base/Command"),
Resolvers = require("../../helpers/resolvers");
class Goodbye extends Command {
constructor(client) {
super(client, {
name: "goodbye",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["gb"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
if (args[0] === "test" && data.guild.plugins.goodbye.enabled) {
this.client.emit("guildMemberRemove", message.member);
return message.success("administration/goodbye:TEST_SUCCESS");
}
if ((!args[0] || !["edit", "off"].includes(args[0])) && data.guild.plugins.goodbye.enabled) return message.error("administration/goodbye:MISSING_STATUS");
if (args[0] === "off") {
data.guild.plugins.goodbye = {
enabled: false,
message: null,
channelID: null,
withImage: null
};
data.guild.markModified("plugins.goodbye");
data.guild.save();
return message.error("administration/goodbye:DISABLED", {
prefix: data.guild.prefix
});
} else {
const goodbye = {
enabled: true,
channel: null,
message: null,
withImage: null,
};
message.sendT("administration/goodbye:FORM_1", {
author: message.author.toString()
});
const filter = m => m.author.id === message.author.id;
const collector = message.channel.createMessageCollector({
filter,
time: 120000 // 2 minutes
});
collector.on("collect", async msg => {
// If the message is filled, it means the user sent yes or no for the image
if (goodbye.message) {
if (msg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) goodbye.withImage = true;
else if (msg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) goodbye.withImage = false;
else return message.error("misc:INVALID_YES_NO");
data.guild.plugins.goodbye = goodbye;
data.guild.markModified("plugins.goodbye");
await data.guild.save();
message.sendT("administration/goodbye:FORM_SUCCESS", {
prefix: data.guild.prefix,
channel: `<#${goodbye.channel}>`
});
return collector.stop();
}
// If the channel is filled and the message is not, it means the user sent the message
if (goodbye.channel && !goodbye.message) {
if (msg.content.length < 1800) {
goodbye.message = msg.content;
return message.sendT("administration/goodbye:FORM_3");
}
return message.error("administration/goodbye:MAX_CHARACT");
}
// If the channel is not filled, it means the user sent it
if (!goodbye.channel) {
const channel = await Resolvers.resolveChannel({
message: msg,
channelType: "GUILD_TEXT"
});
if (!channel) return message.error("misc:INVALID_CHANNEL");
goodbye.channel = channel.id;
return message.sendT("administration/goodbye:FORM_2", {
channel: channel.toString(),
author: msg.author.tag,
memberCount: msg.guild.memberCount
});
}
});
collector.on("end", (_, reason) => {
if (reason === "time") return message.error("misc:TIMES_UP");
});
}
}
}
module.exports = Goodbye;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Ignore extends Command {
constructor(client) {
super(client, {
name: "ignore",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["ig"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const channel = message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first();
if (!channel) return message.error("misc:INVALID_CHANNEL");
const ignored = data.guild.ignoredChannels.includes(channel.id);
if (ignored) {
data.guild.ignoredChannels = data.guild.ignoredChannels.filter((ch) => ch !== channel.id);
data.guild.save();
return message.success("administration/ignore:ALLOWED", {
channel: channel.toString()
});
} else if (!ignored) {
data.guild.ignoredChannels.push(channel.id);
data.guild.save();
return message.success("administration/ignore:IGNORED", {
channel: channel.toString()
});
}
}
}
module.exports = Ignore;

View file

@ -1,57 +0,0 @@
const Command = require("../../base/Command");
class Set extends Command {
constructor(client) {
super(client, {
name: "set",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: [],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args) {
const status = args[0];
if (!status || !["level", "xp", "credits", "bank"].includes(status)) return message.error("administration/set:NO_STATUS");
const member = await this.client.resolveMember(args[1], message.guild);
if (!member) return message.error("administration/set:INVALID_MEMBER");
if (member.user.bot) return message.error("administration/set:BOT_USER");
const number = args[2];
if (!number || isNaN(number) || parseInt(number, 10) < 0) return message.error("administration/set:INVALID_AMOUNT");
const amount = Math.ceil(parseInt(number, 10));
const memberData = await this.client.findOrCreateMember({
id: member.id,
guildID: message.guild.id
});
if (status === "level") {
memberData.level = parseInt(amount, 10);
memberData.save();
} else if (status === "xp") {
memberData.exp = parseInt(amount, 10);
memberData.save();
} else if (status === "credits") {
memberData.money = parseInt(amount, 10);
memberData.save();
} else if (status === "bank") {
memberData.bankSold = parseInt(amount, 10);
memberData.save();
}
message.success("administration/set:SUCCESS_" + status.toUpperCase(), {
username: member.user.tag,
amount
});
}
}
module.exports = Set;

View file

@ -1,45 +0,0 @@
const Command = require("../../base/Command"),
Resolvers = require("../../helpers/resolvers");
class Setbirthdays extends Command {
constructor(client) {
super(client, {
name: "setbirthdays",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["setb"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const areBirthdaysEnabled = Boolean(data.guild.plugins.birthdays);
const sentChannel = await Resolvers.resolveChannel({
message,
search: args.join(" "),
channelType: "GUILD_TEXT"
});
if (!sentChannel && areBirthdaysEnabled) {
data.guild.plugins.birthdays = null;
data.guild.markModified("plugins.birthdays");
await data.guild.save();
return message.success("administration/setbirthdays:DISABLED");
} else {
const channel = sentChannel || message.channel;
data.guild.plugins.birthdays = channel.id;
data.guild.markModified("plugins.birthdays");
await data.guild.save();
return message.success("administration/setbirthdays:ENABLED", {
channel: channel.toString()
});
}
}
}
module.exports = Setbirthdays;

View file

@ -1,33 +0,0 @@
const Command = require("../../base/Command");
class Setlang extends Command {
constructor(client) {
super(client, {
name: "setlang",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["setl"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
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} (${l.aliases.slice(0, 2).join(", ")})\``).join(", ") });
data.guild.language = language.name;
await data.guild.save();
return message.sendT("administration/setlang:SUCCESS", {
lang: language.nativeName
});
}
}
module.exports = Setlang;

View file

@ -1,45 +0,0 @@
const Command = require("../../base/Command"),
Resolvers = require("../../helpers/resolvers");
class Setmodlogs extends Command {
constructor(client) {
super(client, {
name: "setmodlogs",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["setm"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const areModLogsEnabled = Boolean(data.guild.plugins.modlogs);
const sentChannel = await Resolvers.resolveChannel({
message,
search: args.join(" "),
channelType: "GUILD_TEXT"
});
if (!sentChannel && areModLogsEnabled) {
data.guild.plugins.modlogs = null;
data.guild.markModified("plugins.modlogs");
await data.guild.save();
return message.success("administration/setmodlogs:DISABLED");
} else {
const channel = sentChannel || message.channel;
data.guild.plugins.modlogs = channel.id;
data.guild.markModified("plugins.modlogs");
await data.guild.save();
return message.success("administration/setmodlogs:ENABLED", {
channel: channel.toString()
});
}
}
}
module.exports = Setmodlogs;

View file

@ -1,33 +0,0 @@
const Command = require("../../base/Command");
class Setprefix extends Command {
constructor(client) {
super(client, {
name: "setprefix",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["setp"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const prefix = args[0];
if (!prefix) return message.error("administration/setprefix:MISSING_PREFIX");
if (prefix.length > 5) return message.error("administration/setprefix:TOO_LONG");
data.guild.prefix = prefix;
data.guild.save();
return message.success("administration/setprefix:SUCCESS", {
prefix
});
}
}
module.exports = Setprefix;

View file

@ -1,45 +0,0 @@
const Command = require("../../base/Command"),
Resolvers = require("../../helpers/resolvers");
class Setreports extends Command {
constructor(client) {
super(client, {
name: "setreports",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["setr"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const areReportsEnabled = Boolean(data.guild.plugins.reports);
const sentChannel = await Resolvers.resolveChannel({
message,
search: args.join(" "),
channelType: "GUILD_TEXT"
});
if (!sentChannel && areReportsEnabled) {
data.guild.plugins.reports = null;
data.guild.markModified("plugins.reports");
await data.guild.save();
return message.success("administration/setreports:DISABLED");
} else {
const channel = sentChannel || message.channel;
data.guild.plugins.reports = channel.id;
data.guild.markModified("plugins.reports");
await data.guild.save();
return message.success("administration/setreports:ENABLED", {
channel: channel.toString()
});
}
}
}
module.exports = Setreports;

View file

@ -1,45 +0,0 @@
const Command = require("../../base/Command"),
Resolvers = require("../../helpers/resolvers");
class Setsuggests extends Command {
constructor(client) {
super(client, {
name: "setsuggests",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["setsu"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const areSuggestsEnabled = Boolean(data.guild.plugins.suggestions);
const sentChannel = await Resolvers.resolveChannel({
message,
search: args.join(" "),
channelType: "GUILD_TEXT"
});
if (!sentChannel && areSuggestsEnabled) {
data.guild.plugins.suggestions = null;
data.guild.markModified("plugins.suggestions");
await data.guild.save();
return message.success("administration/setsuggests:DISABLED");
} else {
const channel = sentChannel || message.channel;
data.guild.plugins.suggestions = channel.id;
data.guild.markModified("plugins.suggestions");
await data.guild.save();
return message.success("administration/setsuggests:ENABLED", {
channel: channel.toString()
});
}
}
}
module.exports = Setsuggests;

View file

@ -1,54 +0,0 @@
const Command = require("../../base/Command"),
ms = require("ms");
class Slowmode extends Command {
constructor(client) {
super(client, {
name: "slowmode",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["sl"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const channel = message.mentions.channels.filter((ch) => ch.type === "GUILD_TEXT" && ch.guild.id === message.guild.id).first();
if (!channel) return message.error("misc:INVALID_CHANNEL");
const time = args[1];
if (!time) {
if (!data.guild.slowmode.channels.find((ch) => ch.id === channel.id)) return message.error("misc:INVALID_TIME");
data.guild.slowmode.channels = data.guild.slowmode.channels.filter((ch) => ch.id !== channel.id);
data.guild.markModified("slowmode.channels");
data.guild.save();
message.success("administration/slowmode:DISABLED", {
prefix: data.guild.prefix,
channel: `#${channel.name}`
});
} else {
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);
data.guild.slowmode.channels.push({
id: channel.id,
time: ms(time)
});
data.guild.markModified("slowmode.channels");
data.guild.save();
message.success("administration/slowmode:ENABLED", {
prefix: data.guild.prefix,
channel: `#${channel.name}`,
time: this.client.functions.convertTime(message.guild, ms(time))
});
}
}
}
module.exports = Slowmode;

View file

@ -1,39 +0,0 @@
const Command = require("../../base/Command"),
{ Util } = require("discord.js");
class Stealemoji extends Command {
constructor(client) {
super(client, {
name: "stealemoji",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["steale"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args) {
if (!args.length) return message.error("administration/stealemoji:MISSING_EMOJI");
for (const rawEmoji of args) {
const parsedEmoji = Util.parseEmoji(rawEmoji);
const extension = parsedEmoji.animated ? "gif" : "png";
message.guild.emojis
.create(`https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${extension}`, parsedEmoji.name)
.then(emoji => message.success("administration/stealemoji:SUCCESS", {
emoji: emoji.name
}))
.catch(() => message.error("administration/stealemoji:ERROR", {
emoji: parsedEmoji.name
}));
}
}
}
module.exports = Stealemoji;

View file

@ -1,111 +0,0 @@
const Command = require("../../base/Command"),
Resolvers = require("../../helpers/resolvers");
class Welcome extends Command {
constructor(client) {
super(client, {
name: "welcome",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["welc"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
if (args[0] === "test" && data.guild.plugins.welcome.enabled) {
this.client.emit("guildMemberAdd", message.member);
return message.success("administration/welcome:TEST_SUCCESS");
}
if ((!args[0] || !["edit", "off"].includes(args[0])) && data.guild.plugins.welcome.enabled) return message.error("administration/welcome:MISSING_STATUS");
if (args[0] === "off") {
data.guild.plugins.welcome = {
enabled: false,
message: null,
channelID: null,
withImage: null
};
data.guild.markModified("plugins.welcome");
data.guild.save();
return message.error("administration/welcome:DISABLED", {
prefix: data.guild.prefix
});
} else {
const welcome = {
enabled: true,
channel: null,
message: null,
withImage: null,
};
message.sendT("administration/welcome:FORM_1", {
author: message.author.toString()
});
const filter = m => m.author.id === message.author.id;
const collector = message.channel.createMessageCollector({
filter,
time: 120000 // 2 minutes
});
collector.on("collect", async msg => {
// If the message is filled, it means the user sent yes or no for the image
if (welcome.message) {
if (msg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
welcome.withImage = true;
} else if (msg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) {
welcome.withImage = false;
} else {
return message.error("misc:INVALID_YES_NO");
}
data.guild.plugins.welcome = welcome;
data.guild.markModified("plugins.welcome");
await data.guild.save();
message.sendT("administration/welcome:FORM_SUCCESS", {
prefix: data.guild.prefix,
channel: `<#${welcome.channel}>`
});
return collector.stop();
}
// If the channel is filled and the message is not, it means the user sent the message
if (welcome.channel && !welcome.message) {
if (msg.content.length < 1800) {
welcome.message = msg.content;
return message.sendT("administration/welcome:FORM_3");
}
return message.error("administration/goodbye:MAX_CHARACT");
}
// If the channel is not filled, it means the user sent it
if (!welcome.channel) {
const channel = await Resolvers.resolveChannel({
message: msg,
channelType: "GUILD_TEXT"
});
if (!channel) return message.error("misc:INVALID_CHANNEL");
welcome.channel = channel.id;
return message.sendT("administration/welcome:FORM_2", {
guildName: message.guild.name,
author: msg.author.tag,
memberCount: msg.guild.memberCount
});
}
});
collector.on("end", (_, reason) => {
if (reason === "time") return message.error("misc:TIMES_UP");
});
}
}
}
module.exports = Welcome;

View file

@ -1,80 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Achievements extends Command {
constructor(client) {
super(client, {
name: "achievements",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["ac"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
let member = message.guild ? message.member : message.author;
if (args[0]) member = await this.client.resolveMember(args[0], message.guild);
if (message.guild && member.user.bot) return message.error("economy/profile:BOT_USER");
const userData = (member.id === message.author.id ? data.userData : await this.client.findOrCreateUser({
id: member.id
}));
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("economy/achievements:TITLE")
})
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
embed.addField(message.translate("economy/achievements:SEND_CMD"), message.translate("economy/achievements:PROGRESS", {
now: userData.achievements.firstCommand.progress.now,
total: userData.achievements.firstCommand.progress.total,
percent: Math.round(100 * (userData.achievements.firstCommand.progress.now / userData.achievements.firstCommand.progress.total))
}));
embed.addField(message.translate("economy/achievements:CLAIM_SALARY"), message.translate("economy/achievements:PROGRESS", {
now: userData.achievements.work.progress.now,
total: userData.achievements.work.progress.total,
percent: Math.round(100 * (userData.achievements.work.progress.now / userData.achievements.work.progress.total))
}));
embed.addField(message.translate("economy/achievements:MARRY"), message.translate("economy/achievements:PROGRESS", {
now: userData.achievements.married.progress.now,
total: userData.achievements.married.progress.total,
percent: Math.round(100 * (userData.achievements.married.progress.now / userData.achievements.married.progress.total))
}));
embed.addField(message.translate("economy/achievements:SLOTS"), message.translate("economy/achievements:PROGRESS", {
now: userData.achievements.slots.progress.now,
total: userData.achievements.slots.progress.total,
percent: Math.round(100 * (userData.achievements.slots.progress.now / userData.achievements.slots.progress.total))
}));
embed.addField(message.translate("economy/achievements:TIP"), message.translate("economy/achievements:PROGRESS", {
now: userData.achievements.tip.progress.now,
total: userData.achievements.tip.progress.total,
percent: Math.round(100 * (userData.achievements.tip.progress.now / userData.achievements.tip.progress.total))
}));
embed.addField(message.translate("economy/achievements:REP"), message.translate("economy/achievements:PROGRESS", {
now: userData.achievements.rep.progress.now,
total: userData.achievements.rep.progress.total,
percent: Math.round(100 * (userData.achievements.rep.progress.now / userData.achievements.rep.progress.total))
}));
embed.addField(message.translate("economy/achievements:INVITE"), message.translate("economy/achievements:PROGRESS", {
now: userData.achievements.invite.progress.now,
total: userData.achievements.invite.progress.total,
percent: Math.round(100 * (userData.achievements.invite.progress.now / userData.achievements.invite.progress.total))
}));
message.reply({
embeds: [embed]
});
}
}
module.exports = Achievements;

View file

@ -1,50 +0,0 @@
const Command = require("../../base/Command");
class Birthdate extends Command {
constructor(client) {
super(client, {
name: "birthdate",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["bd"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const date = args[0];
if (!date) return message.error("economy/birthdate:MISSING_DATE");
const tArgs = date.split("/");
const [day, month, year] = tArgs;
if (!day || !month || !year) return message.error("economy/birthdate:INVALID_DATE");
const match = date.match(/\d+/g);
if (!match) return message.error("economy/birthdate:INVALID_DATE");
const tday = +match[0],
tmonth = +match[1] - 1;
let tyear = +match[2];
if (tyear < 100) tyear += tyear < 50 ? 2000 : 1900;
const d = new Date(tyear, tmonth, tday);
if (!(tday == d.getDate() && tmonth == d.getMonth() && tyear == d.getFullYear())) return message.error("economy/birthdate:INVALID_DATE");
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");
data.userData.birthdate = d;
data.userData.save();
message.success("economy/birthdate:SUCCESS", {
date: message.printDate(d)
});
}
}
module.exports = Birthdate;

View file

@ -1,52 +0,0 @@
const Command = require("../../base/Command");
class Deposit extends Command {
constructor(client) {
super(client, {
name: "deposit",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["bank", "dep"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
let amount = args[0];
if (!(parseInt(data.memberData.money, 10) > 0)) return message.error("economy/deposit:NO_CREDIT");
if (args[0] === "all") {
amount = parseInt(data.memberData.money, 10);
} else {
if (isNaN(amount) || parseInt(amount, 10) < 1) return message.error("economy/deposit:MISSING_AMOUNT");
amount = parseInt(amount, 10);
}
if (data.memberData.money < amount) return message.error("economy/deposit:NOT_ENOUGH_CREDIT", { money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
const info = {
user: message.translate("economy/transactions:BANK"),
amount: amount,
date: Date.now(),
type: "send"
};
data.memberData.transactions.push(info);
data.memberData.money = data.memberData.money - amount;
data.memberData.bankSold = data.memberData.bankSold + amount;
data.memberData.save();
message.success("economy/deposit:SUCCESS", {
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
});
}
}
module.exports = Deposit;

View file

@ -1,45 +0,0 @@
const Command = require("../../base/Command");
class Divorce extends Command {
constructor(client) {
super(client, {
name: "divorce",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["di"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (!data.userData.lover) return message.error("economy/divorce:NOT_MARRIED");
const user = this.client.users.cache.get(data.userData.lover) || await this.client.users.fetch(data.userData.lover);
data.userData.lover = null;
data.userData.save();
const oldLover = await this.client.findOrCreateUser({
id: user.id
});
oldLover.lover = null;
oldLover.save();
message.success("economy/divorce:DIVORCED", {
username: user.username
});
user.send({
content: message.translate("economy/divorce:DIVORCED_U", {
username: message.author.username
})
});
}
}
module.exports = Divorce;

View file

@ -1,157 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
const currentGames = {};
class FindWords extends Command {
constructor(client) {
super(client, {
name: "findwords",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["findw"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (currentGames[message.guild.id]) return message.error("economy/number:GAME_RUNNING");
// Reads words file
let lang = null;
if (message.guild.data.language === "uk-UA") return lang = "ru-RU";
else lang = message.guild.data.language;
const wordList = require(`../../assets/json/words/${lang}.json`);
// Init some utils variables
const participants = [],
winners = [],
words = [],
nbGames = this.client.functions.randomNum(3, 10);
// Store the date wich the game has started
const createdAt = Date.now(); // 20929038303
for (let i = 0; i < nbGames; i++) {
const result = Math.floor((Math.random() * wordList.length));
words.push(wordList[result].substring(0, 3).toLowerCase());
}
let i = 0; // Inits i variable to count games
currentGames[message.guild.id] = true; // Update current game variable
generateGame.call(this, words[i]); // Generate a new round
function generateGame(word) {
word = word.toLowerCase();
// Launch timer
const delay = (i === 0) ? 10000 : 0;
if (i === 0) message.sendT("economy/findwords:GAME_STARTING");
setTimeout(() => {
// Send announcment message
message.sendT("economy/findwords:FIND_WORD", {
word: word.toUpperCase()
}, false, false, "warn");
// init a collector to receive the answers
const filter = m => !m.author.bot;
const collector = new Discord.MessageCollector(message.channel, {
filter,
time: 20000
});
collector.on("collect", (msg) => {
if (this.client.functions.getPrefix(msg, data)) return;
if (!participants.includes(msg.author.id)) participants.push(msg.author.id);
if (msg.content === "STOP") return collector.stop("force");
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
} else msg.error("economy/findwords:INVALID_WORD", { member: msg.author.toString() });
});
collector.on("end", async (collected, reason) => {
if (reason === "time") message.error("economy/findwords:NO_WINNER");
else if (reason === "force") return message.error("misc:FORCE_STOP", { user: message.author.toString() });
else {
message.success("economy/findwords:WORD_FOUND", {
winner: `<@${reason}>`
});
winners.push(reason);
}
if (i < nbGames - 1) {
i++;
generateGame.call(this, words[i]);
} else {
currentGames[message.guild.id] = false;
if (winners.length < 1) return message.error("economy/findwords:NO_WINNER_ALL");
const winnerID = await getWinner(winners);
const time = message.convertTime(createdAt, "from", true);
const user = await this.client.users.fetch(winnerID);
message.sendT("economy/findwords:GAME_STATS", {
winner: user.username,
duration: time,
participantCount: participants.length,
participants: participants.map((p) => `<@${p}>`).join(", ")
});
if (participants.length > 1 && data.guild.disabledCategories && !data.guild.disabledCategories.includes("Economy")) {
const won = 150 * (participants.length * 0.5);
message.sendT("economy/findwords:CREDITS", {
winner: user.username,
credits: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
});
const memberData = await this.client.findOrCreateMember({
id: user.id,
guildID: message.guild.id
});
const info = {
user: message.translate("economy/transactions:WORDS"),
amount: won,
date: Date.now(),
type: "got"
};
data.memberData.transactions.push(info);
memberData.money += won;
memberData.save();
}
}
});
}, delay);
}
async function getWinner(array) {
return new Promise(function (resolve) {
const counts = {};
let compare = 0,
mostFrequent;
for (let i = 0, len = array.length; i < len; i++) {
const winner = array[i];
if (!counts[winner]) counts[winner] = 1;
else counts[winner] = counts[winner] + 1;
if (counts[winner] > compare) {
compare = counts[winner];
mostFrequent = array[i];
}
}
resolve(mostFrequent);
});
}
}
}
module.exports = FindWords;

View file

@ -1,184 +0,0 @@
const Command = require("../../base/Command");
const games = {};
class Horserace extends Command {
constructor(client) {
super(client, {
name: "horserace",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["hr"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (!args[0]) return message.error("economy/horserace:MISSING_STATUS");
const author = message.author;
if (args[0] === "create") {
let thisGame = games[message.channel.id];
if (thisGame) return message.error("economy/horserace:GAME_RUNNING");
else {
games[message.channel.id] = {
horseSpeeds: [],
bets: []
};
thisGame = games[message.channel.id];
const f = [];
for (let i = 0; i < 5; i++) {
const speed = this.client.functions.randomNum(1, 5);
const profit = {
1: 3.5,
2: 3,
3: 2.5,
4: 2,
5: 1.5,
};
// const profit = Math.floor((((8.9 / 9) * (6 - speed)) + 1.1) * 10) / 10;
thisGame.horseSpeeds.push(speed);
f.push({
name: message.translate("economy/horserace:HORSE_NAME", {
number: i + 1
}),
value: message.translate("economy/horserace:HORSE_VALUE", {
speed,
profit: profit[speed]
})
});
}
message.reply({
embeds: [{
color: data.config.embed.color,
title: message.translate("economy/horserace:EMBED_T"),
fields: f
}]
});
}
} else if (args[0] === "bet") {
const thisGame = games[message.channel.id];
const horse = parseInt(args[1]);
const amount = parseInt(args[2]);
if (horse > 5) return message.error("economy/horserace:HORSE_NUM");
if (!thisGame) return message.error("economy/horserace:NO_GAME_RUNNING");
if (!amount || isNaN(amount) || parseInt(amount, 10) <= 0) return message.error("economy/pay:INVALID_AMOUNT");
if (amount > data.memberData.money) return message.error("economy/pay:ENOUGH_MONEY", {
amount: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}`
});
thisGame.bets[author.id] = {
amount,
horse
};
message.sendT("economy/horserace:BET", {
user: author,
amount: `**${Math.floor(amount)}** ${message.getNoun(Math.floor(amount), message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}`,
horse
});
} else if (args[0] === "go") {
const thisGame = games[message.channel.id];
const horsePositions = [0, 0, 0, 0, 0];
if (!thisGame) return message.error("economy/horserace:NO_GAME_RUNNING");
// eslint-disable-next-line no-constant-condition
while (true) {
for (let i = 0; i < 5; i++) {
if (thisGame.horseSpeeds[i] >= Math.floor(Math.random() * 15)) {
horsePositions[i] += 1;
if (horsePositions[i] === 3) {
const winnings = [];
const profit = {
1: 3.5,
2: 3,
3: 2.5,
4: 2,
5: 1.5,
};
// const profit = Math.floor((((8.9 / 9) * (6 - thisGame.horseSpeeds[i])) + 1.1) * 10) / 10;
for (let j = 0; j < Object.keys(thisGame.bets).length; j++) {
if (Object.values(thisGame.bets)[j].horse === i + 1) {
winnings.push([Object.keys(thisGame.bets)[j], Object.values(thisGame.bets)[j].amount * profit[thisGame.horseSpeeds[i]]]);
}
}
if (winnings.length === 0) {
for (let j = 0; j < Object.keys(thisGame.bets).length; j++) {
if (Object.values(thisGame.bets)[j].horse !== i + 1) {
const memberData = await this.client.findOrCreateMember({
id: Object.keys(thisGame.bets)[j],
guildID: message.guild.id
});
const info = {
user: message.translate("economy/transactions:HORSERACE"),
amount: Object.values(thisGame.bets)[j].amount,
date: Date.now(),
type: "send"
};
memberData.transactions.push(info);
memberData.money -= Object.values(thisGame.bets)[j].amount;
}
}
message.sendT("economy/horserace:NO_WINNERS", {
horse: i + 1
});
} else {
let winners = "";
for (let j = 0; j < winnings.length; j++) {
winners += `\n<@${winnings[j][0]}> выиграл **${Math.floor(winnings[j][1])}** ${message.getNoun(Math.floor(winnings[j][1]), message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}!`;
const memberData = await this.client.findOrCreateMember({
id: winnings[j][0],
guildID: message.guild.id
});
const toAdd = Math.floor(winnings[j][1]) - Object.values(thisGame.bets)[j].amount;
const info = {
user: message.translate("economy/transactions:HORSERACE"),
amount: toAdd,
date: Date.now(),
type: "got"
};
memberData.transactions.push(info);
memberData.money += toAdd;
memberData.save();
}
message.sendT("economy/horserace:WINNERS", {
horse: i + 1,
winners
});
}
delete games[message.channel.id];
return;
}
}
}
}
}
}
}
module.exports = Horserace;

View file

@ -1,174 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Leaderboard extends Command {
constructor(client) {
super(client, {
name: "leaderboard",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["lb"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const isOnlyOnMobile = (message.member.presence.clientStatus ? JSON.stringify(Object.keys(message.member.presence.clientStatus)) === JSON.stringify(["mobile"]) : false);
const type = args[0];
if (!type || !["credits", "level", "rep"].includes(type)) return message.error("economy/leaderboard:MISSING_TYPE");
if (type === "credits") {
const members = await this.client.membersData.find({
guildID: message.guild.id
}).lean(),
membersLeaderboard = members.map((m) => {
return {
id: m.id,
money: m.money + m.bankSold
};
}).sort((a, b) => b.money - a.money);
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
let userNames = "";
let money = "";
for (let i = 0; i < membersLeaderboard.length; i++) {
const data = membersLeaderboard[i];
const user = (await this.client.users.fetch(data.id)).tag;
userNames += `**${i + 1}**. ${user}\n`;
money += `${data.money}\n`;
}
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("economy/leaderboard:TABLE", {
name: message.guild.name
}),
iconURL: message.guild.iconURL({
dynamic: true
})
})
.setColor(data.config.embed.color)
.addFields({
name: message.translate("economy/leaderboard:TOP"),
value: userNames,
inline: true
}, {
name: message.translate("economy/leaderboard:CREDITS"),
value: money,
inline: true
});
message.reply({
embeds: [embed]
});
} else if (type === "level") {
const members = await this.client.membersData.find({
guildID: message.guild.id
}).lean(),
membersLeaderboard = members.map((m) => {
return {
id: m.id,
level: m.level,
xp: m.exp
};
}).sort((a, b) => b.level - a.level);
if (membersLeaderboard.length > 20) membersLeaderboard.length = 20;
let userNames = "";
let level = "";
let xp = "";
for (let i = 0; i < membersLeaderboard.length; i++) {
const data = membersLeaderboard[i];
const user = (await this.client.users.fetch(data.id)).tag;
userNames += `**${i + 1}**. ${user}\n`;
level += `${data.level}\n`;
xp += `${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}\n`;
}
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("economy/leaderboard:TABLE", {
name: message.guild.name
}),
iconURL: message.guild.iconURL({
dynamic: true
})
})
.setColor(data.config.embed.color)
.addFields({
name: message.translate("economy/leaderboard:TOP"),
value: userNames,
inline: true
}, {
name: message.translate("economy/leaderboard:LEVEL"),
value: level,
inline: true
}, {
name: message.translate("economy/leaderboard:XP"),
value: xp,
inline: true
});
message.reply({
embeds: [embed]
});
} else if (type === "rep") {
const users = await this.client.usersData.find({
rep: { $gt: 0 }
}).lean(),
usersLeaderboard = users.map((u) => {
return {
id: u.id,
rep: u.rep
};
}).sort((a, b) => b.rep - a.rep);
if (usersLeaderboard.length > 20) usersLeaderboard.length = 20;
let userNames = "";
let rep = "";
for (let i = 0; i < usersLeaderboard.length; i++) {
const data = usersLeaderboard[i];
const user = (await this.client.users.fetch(data.id)).tag;
userNames += `**${i + 1}**. ${user}\n`;
rep += `${data.rep}\n`;
}
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("economy/leaderboard:TABLE", {
name: message.guild.name
}),
iconURL: message.guild.iconURL({
dynamic: true
})
})
.setColor(data.config.embed.color)
.addFields({
name: message.translate("economy/leaderboard:TOP"),
value: userNames,
inline: true
}, {
name: message.translate("economy/leaderboard:REP"),
value: rep,
inline: true
});
message.reply({
embeds: [embed]
});
}
if (isOnlyOnMobile) message.sendT("economy/leaderboard:MOBILE");
}
}
module.exports = Leaderboard;

View file

@ -1,134 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
const pendings = {};
class Marry extends Command {
constructor(client) {
super(client, {
name: "marry",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (data.userData.lover) return message.error("economy/marry:ALREADY_MARRIED", { prefix: data.guild.prefix });
const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("economy/marry:INVALID_MEMBER");
const userData = await this.client.findOrCreateUser({
id: member.id
});
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.id === message.author.id) return message.error("economy/marry:YOURSELF");
for (const requester in pendings) {
const receiver = pendings[requester];
// If the member already sent a request to someone
if (requester === message.author.id) {
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
});
} 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);
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
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
});
} 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);
return message.error("economy/marry:REQUEST_MEMBER_TO_AMEMBER", {
firstUsername: member.user.tag,
secondUsername: user.tag
});
}
}
// Update pending requests
pendings[message.author.id] = member.id;
message.sendT("economy/marry:REQUEST", {
from: message.author.toString(),
to: member.user.toString()
});
const filter = m => m.author.id === member.id;
const collector = new Discord.MessageCollector(message.channel, {
filter,
time: 120000
});
collector.on("collect", (msg) => {
if (msg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) {
return collector.stop(true);
} else if (msg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) {
return collector.stop(false);
} else {
return message.error("misc:INVALID_YES_NO");
}
});
collector.on("end", async (_collected, reason) => {
// Delete pending request
delete pendings[message.author.id];
if (reason === "time") return message.error("economy/marry:TIMEOUT", { username: member.user.toString() });
if (reason) {
data.userData.lover = member.id;
await data.userData.save();
userData.lover = message.author.id;
await userData.save();
const messageOptions = {
content: `${member.toString()} :heart: ${message.author.toString()}`,
files: [{
name: "achievement_unlocked3.png",
attachment: "./assets/img/achievements/achievement_unlocked3.png"
}]
};
let sent = false;
if (!userData.achievements.married.achieved) {
message.channel.send(messageOptions);
sent = true;
userData.achievements.married.achieved = true;
userData.achievements.married.progress.now = 1;
userData.markModified("achievements.married");
userData.save();
}
if (!data.userData.achievements.married.achieved) {
if (!sent) message.channel.send(messageOptions);
data.userData.achievements.married.achieved = true;
data.userData.achievements.married.progress.now = 1;
data.userData.markModified("achievements.married");
data.userData.save();
}
return message.success("economy/marry:SUCCESS", {
creator: message.author.toString(),
partner: member.user.toString()
});
} else {
return message.success("economy/marry:DENIED", {
creator: message.author.toString(),
partner: member.user.toString()
});
}
});
}
}
module.exports = Marry;

View file

@ -1,75 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
const asyncForEach = async (collection, callback) => {
const allPromises = collection.map(async key => {
await callback(key);
});
return await Promise.all(allPromises);
};
class Money extends Command {
constructor(client) {
super(client, {
name: "money",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["balance", "mon"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
let member = await this.client.resolveMember(args[0], message.guild);
if (!member) member = message.member;
const user = member.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 commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(user.id));
let globalMoney = 0;
await asyncForEach(commonsGuilds, async (guild) => {
const data = await this.client.findOrCreateMember({
id: user.id,
guildID: guild.id
});
globalMoney += data.money;
globalMoney += data.bankSold;
});
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("economy/money:TITLE", {
username: member.user.username
}),
iconURL: member.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
.addField(message.translate("economy/profile:CASH"), `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
.addField(message.translate("economy/profile:BANK"), `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
.addField(message.translate("economy/profile:GLOBAL"), `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
message.reply({
embeds: [embed]
});
}
}
module.exports = Money;

View file

@ -1,98 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
const currentGames = {};
class Number extends Command {
constructor(client) {
super(client, {
name: "number",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["num"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (currentGames[message.guild.id]) return message.error("economy/number:GAME_RUNNING");
const participants = [],
number = this.client.functions.randomNum(1000, 6000);
await message.sendT("economy/number:GAME_START");
// Store the date wich the game has started
const gameCreatedAt = Date.now();
const filter = m => !m.author.bot;
const collector = new Discord.MessageCollector(message.channel, {
filter,
time: 480000 // 8 minutes
});
currentGames[message.guild.id] = true;
collector.on("collect", async msg => {
if (this.client.functions.getPrefix(msg, data)) return;
if (!participants.includes(msg.author.id)) participants.push(msg.author.id);
if (msg.content === "STOP") return collector.stop("force");
if (isNaN(msg.content)) return;
const parsedNumber = parseInt(msg.content, 10);
if (parsedNumber === number) {
const time = this.client.functions.convertTime(message.guild, Date.now() - gameCreatedAt);
message.sendT("economy/number:GAME_STATS", {
winner: msg.author.toString(),
number,
time,
participantCount: participants.length,
participants: participants.map(p => `<@${p}>`).join(", ")
});
if (participants.length > 1 && data.guild.disabledCategories && !data.guild.disabledCategories.includes("Economy")) {
const won = 100 * (participants.length * 0.5);
message.sendT("economy/number:WON", {
winner: msg.author.username,
credits: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
});
const memberData = await this.client.findOrCreateMember({
id: msg.author.id,
guildID: message.guild.id
});
const info = {
user: message.translate("economy/transactions:NUMBERS"),
amount: won,
date: Date.now(),
type: "got"
};
data.memberData.transactions.push(info);
memberData.money += won;
memberData.save();
}
collector.stop();
}
if (parseInt(msg.content) < number) message.error("economy/number:BIG", { user: msg.author.toString(), number: parsedNumber });
if (parseInt(msg.content) > number) message.error("economy/number:SMALL", { user: msg.author.toString(), number: parsedNumber });
});
collector.on("end", (_collected, reason) => {
delete currentGames[message.guild.id];
if (reason === "time") return message.error("economy/number:DEFEAT", { number });
else if (reason === "force") return message.error("misc:FORCE_STOP", { user: message.author.toString() });
});
}
}
module.exports = Number;

View file

@ -1,59 +0,0 @@
const Command = require("../../base/Command");
class Pay extends Command {
constructor(client) {
super(client, {
name: "pay",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("economy/pay:INVALID_MEMBER");
if (member.user.bot) return message.error("economy/pay:BOT_USER");
if (member.id === message.author.id) return message.error("economy/pay:YOURSELF");
const sentAmount = args[1];
if (!sentAmount || isNaN(sentAmount) || parseInt(sentAmount, 10) <= 0) return message.error("economy/pay:INVALID_AMOUNT");
const amount = Math.ceil(parseInt(sentAmount, 10));
if (amount > data.memberData.money) return message.error("economy/pay:ENOUGH_MONEY", {
amount: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDITS:1"), message.translate("misc:NOUNS:CREDITS:2"), message.translate("misc:NOUNS:CREDITS:5"))}`
});
const memberData = await this.client.findOrCreateMember({
id: member.id,
guildID: message.guild.id
});
const info = {
user: member.user.tag,
amount: parseInt(amount, 10),
date: Date.now(),
type: "send"
};
data.memberData.transactions.push(info);
data.memberData.money = data.memberData.money - parseInt(amount, 10);
data.memberData.save();
memberData.money = memberData.money + parseInt(amount, 10);
memberData.save();
message.success("economy/pay:SUCCESS", {
amount: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
username: member.user.tag
});
}
}
module.exports = Pay;

View file

@ -1,98 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
const asyncForEach = async (collection, callback) => {
const allPromises = collection.map(async key => {
await callback(key);
});
return await Promise.all(allPromises);
};
class Profile extends Command {
constructor(client) {
super(client, {
name: "profile",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["prof"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const arg = args[0] || message.author;
let member = await this.client.resolveMember(arg, message.guild);
if (!member) member = message.member;
if (member.user.bot) return message.error("economy/profile:BOT_USER");
const memberData = (member.id === message.author.id ? data.memberData : await this.client.findOrCreateMember({
id: member.id,
guildID: message.guild.id
}));
const userData = (member.id === message.author.id ? data.userData : await this.client.findOrCreateUser({
id: member.id
}));
if (userData.lover && !this.client.users.cache.get(userData.lover)) await this.client.users.fetch(userData.lover, true);
const commonsGuilds = this.client.guilds.cache.filter((g) => g.members.cache.get(member.id));
let globalMoney = 0;
await asyncForEach(commonsGuilds, async (guild) => {
const data = await this.client.findOrCreateMember({
id: member.id,
guildID: guild.id
});
globalMoney += data.money;
globalMoney += data.bankSold;
});
const profileEmbed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("economy/profile:TITLE", {
username: member.user.tag
}),
iconURL: member.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
.setImage("attachment://achievements.png")
.addField(this.client.customEmojis.link + " " + message.translate("economy/profile:LINK"), `[${message.translate("economy/profile:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/user/${member.user.id}/${message.guild.id})`)
.addField(message.translate("economy/profile:BIO"), userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO"))
.addField(message.translate("economy/profile:CASH"), `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
.addField(message.translate("economy/profile:BANK"), `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
.addField(message.translate("economy/profile:GLOBAL"), `**${globalMoney}** ${message.getNoun(globalMoney, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true)
.addField(message.translate("economy/profile:REPUTATION"), `**${userData.rep}** ${message.getNoun(userData.rep, message.translate("misc:NOUNS:POINTS:1"), message.translate("misc:NOUNS:POINTS:2"), message.translate("misc:NOUNS:POINTS:5"))}`, true)
.addField(message.translate("economy/profile:LEVEL"), `**${memberData.level}**`, true)
.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: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:ACHIEVEMENTS"), message.translate("economy/profile:ACHIEVEMENTS_CONTENT", {
prefix: data.guild.prefix
}))
.setColor(data.config.embed.color) // Sets the color of the embed
.setFooter({
text: data.config.embed.footer
}) // Sets the footer of the embed
.setTimestamp();
const buffer = await userData.getAchievements();
message.reply({
embeds: [profileEmbed],
files: [{
name: "achievements.png",
attachment: buffer
}]
});
}
}
module.exports = Profile;

View file

@ -1,71 +0,0 @@
const Command = require("../../base/Command");
class Rep extends Command {
constructor(client) {
super(client, {
name: "rep",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["reputation"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
// if the member is already in the cooldown db
const isInCooldown = (data.userData.cooldowns || {
rep: 0
}).rep;
if (isInCooldown) {
/*if the timestamp recorded in the database indicating
when the member will be able to execute the order again
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)
});
}
const user = await this.client.resolveUser(args[0]);
if (!user) return message.error("economy/rep:INVALID_USER");
if (user.bot) return message.error("economy/rep:BOT_USER");
if (user.id === message.author.id) return message.error("economy/rep:YOURSELF");
// Records in the database the time when the member will be able to execute the command again (in 12 hours)
const toWait = Date.now() + 21600000;
data.userData.cooldowns = {};
data.userData.cooldowns.rep = toWait;
data.userData.markModified("cooldowns");
data.userData.save();
const userData = await this.client.findOrCreateUser({
id: user.id
});
userData.rep++;
if (!userData.achievements.rep.achieved) {
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) {
userData.achievements.rep.achieved = true;
message.channel.send({
content: `${user}`,
files: [{
name: "achievement_unlocked6.png",
attachment: "./assets/img/achievements/achievement_unlocked6.png"
}]
});
}
userData.markModified("achievements.rep");
}
await userData.save();
message.success("economy/rep:SUCCESS", {
username: user.username
});
}
}
module.exports = Rep;

View file

@ -1,78 +0,0 @@
const Command = require("../../base/Command");
class Rob extends Command {
constructor(client) {
super(client, {
name: "rob",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["steal"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("economy/rob:MISSING_MEMBER");
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 isInCooldown = memberData.cooldowns.rob || 0;
if (isInCooldown) {
if (isInCooldown > Date.now()) return message.error("economy/rob:COOLDOWN", { user: member.user });
}
let amountToRob = args[1];
if (!amountToRob || isNaN(amountToRob) || parseInt(amountToRob, 10) <= 0) return message.error("economy/rob:MISSING_AMOUNT", { user: member.user });
amountToRob = Math.floor(parseInt(amountToRob, 10));
if (amountToRob > memberData.money) return message.error("economy/rob:NOT_ENOUGH_MEMBER", { user: member.user });
const potentiallyLose = Math.floor(amountToRob * 1.5);
if (potentiallyLose > data.memberData.money) return message.error("economy/rob:NOT_ENOUGH_AUTHOR", {
moneyMin: `${potentiallyLose} ${message.getNoun(potentiallyLose, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
moneyCurrent: `${data.memberData.money} ${message.getNoun(data.memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
});
const itsAWon = Math.floor(this.client.functions.randomNum(0, 100) < 25);
if (itsAWon) {
const toWait = Date.now() + 6 * (60 * 60000); // 6 hours
memberData.cooldowns.rob = toWait;
memberData.markModified("cooldowns");
await memberData.save();
const randomNum = this.client.functions.randomNum(1, 2);
message.sendT("economy/rob:ROB_WON_" + randomNum, {
money: `${amountToRob} ${message.getNoun(amountToRob, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
user: member.user
});
data.memberData.money += amountToRob;
memberData.money -= amountToRob, 10;
memberData.save();
data.memberData.save();
} else {
const won = Math.floor(0.9 * amountToRob);
const randomNum = this.client.functions.randomNum(1, 2);
message.sendT("economy/rob:ROB_LOSE_" + randomNum, {
fine: `${potentiallyLose} ${message.getNoun(potentiallyLose, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
offset: `${won} ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
user: member.user
});
data.memberData.money -= potentiallyLose;
memberData.money += won;
memberData.save();
data.memberData.save();
}
}
}
module.exports = Rob;

View file

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

View file

@ -1,208 +0,0 @@
const Command = require("../../base/Command");
class Slots extends Command {
constructor(client) {
super(client, {
name: "slots",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["casino", "slot"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const fruits = ["🍎", "🍐", "🍌", "🍇", "🍉", "🍒", "🍓"];
let i1 = 0, j1 = 0, k1 = 0,
i2 = 1, j2 = 1, k2 = 1,
i3 = 2, j3 = 2, k3 = 2;
// Gets three random fruits array
const colonnes = [
this.client.functions.shuffle(fruits),
this.client.functions.shuffle(fruits),
this.client.functions.shuffle(fruits)
];
// Gets the amount provided
let amount = args[0];
if (!amount || isNaN(amount) || amount < 1) amount = 50;
if (amount > data.memberData.money) return message.error("economy/slots:NOT_ENOUGH", { money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
amount = Math.round(amount);
function getCredits(number, isJackpot) {
if (!isJackpot) number = number * 1.5;
else if (isJackpot) number = number * 5;
return Math.round(number);
}
const tmsg = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
editMsg();
const interval = setInterval(editMsg, 1000);
setTimeout(() => {
clearInterval(interval);
end(tmsg);
}, 4000);
async function end() {
let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n";
i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0;
i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0;
i3 = (i3 < fruits.length - 1) ? i3 + 1 : 0;
j1 = (j1 < fruits.length - 1) ? j1 + 1 : 0;
j2 = (j2 < fruits.length - 1) ? j2 + 1 : 0;
j3 = (j3 < fruits.length - 1) ? j3 + 1 : 0;
k1 = (k1 < fruits.length - 1) ? k1 + 1 : 0;
k2 = (k2 < fruits.length - 1) ? k2 + 1 : 0;
k3 = (k3 < fruits.length - 1) ? k3 + 1 : 0;
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][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n------------------\n";
if ((colonnes[0][i2] == colonnes[1][j2]) && (colonnes[1][j2] == colonnes[2][k2])) {
msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |";
tmsg.edit(msg);
const credits = getCredits(amount, true);
message.channel.send({
content: "**!! ДЖЕКПОТ !!**\n" + message.translate("economy/slots:VICTORY", {
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
won: `**${credits}** ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
username: message.author.username
})
});
const toAdd = credits - amount;
const info = {
user: message.translate("economy/slots:DESCRIPTION"),
amount: toAdd,
date: Date.now(),
type: "got"
};
data.memberData.transactions.push(info);
data.memberData.money = data.memberData.money + toAdd;
if (!data.userData.achievements.slots.achieved) {
data.userData.achievements.slots.progress.now += 1;
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
data.userData.achievements.slots.achieved = true;
message.reply({
files: [{
name: "achievement_unlocked4.png",
attachment: "./assets/img/achievements/achievement_unlocked4.png"
}]
});
}
data.userData.markModified("achievements.slots");
await data.userData.save();
}
await data.memberData.save();
return;
}
if (colonnes[0][i2] == colonnes[1][j2] || colonnes[1][j2] == colonnes[2][k2] || colonnes[0][i2] == colonnes[2][k2]) {
msg += "| : : : **" + (message.translate("common:VICTORY").toUpperCase()) + "** : : : |";
tmsg.edit(msg);
const credits = getCredits(amount, false);
message.channel.send({
content: message.translate("economy/slots:VICTORY", {
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
won: `**${credits}** ${message.getNoun(credits, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
username: message.author.username
})
});
const toAdd = credits - amount;
const info = {
user: message.translate("economy/slots:DESCRIPTION"),
amount: toAdd,
date: Date.now(),
type: "got"
};
data.memberData.transactions.push(info);
data.memberData.money = data.memberData.money + toAdd;
if (!data.userData.achievements.slots.achieved) {
data.userData.achievements.slots.progress.now += 1;
if (data.userData.achievements.slots.progress.now === data.userData.achievements.slots.progress.total) {
data.userData.achievements.slots.achieved = true;
message.reply({
files: [{
name: "achievement_unlocked4.png",
attachment: "./assets/img/achievements/achievement_unlocked4.png"
}]
});
}
data.userData.markModified("achievements.slots");
await data.userData.save();
}
await data.memberData.save();
return;
}
msg += "| : : : **" + (message.translate("common:DEFEAT").toUpperCase()) + "** : : : |";
message.channel.send({
content: message.translate("economy/slots:DEFEAT", {
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`,
username: message.author.username
})
});
const info = {
user: message.translate("economy/slots:DESCRIPTION"),
amount: amount,
date: Date.now(),
type: "send"
};
data.memberData.transactions.push(info);
data.memberData.money = data.memberData.money - amount;
if (!data.userData.achievements.slots.achieved) {
data.userData.achievements.slots.progress.now = 0;
data.userData.markModified("achievements.slots");
await data.userData.save();
}
await data.memberData.save();
return;
}
function editMsg() {
let msg = "[ :slot_machine: | **СЛОТЫ** ]\n------------------\n";
i1 = (i1 < fruits.length - 1) ? i1 + 1 : 0;
i2 = (i2 < fruits.length - 1) ? i2 + 1 : 0;
i3 = (i3 < fruits.length - 1) ? i3 + 1 : 0;
j1 = (j1 < fruits.length - 1) ? j1 + 1 : 0;
j2 = (j2 < fruits.length - 1) ? j2 + 1 : 0;
j3 = (j3 < fruits.length - 1) ? j3 + 1 : 0;
k1 = (k1 < fruits.length - 1) ? k1 + 1 : 0;
k2 = (k2 < fruits.length - 1) ? k2 + 1 : 0;
k3 = (k3 < fruits.length - 1) ? k3 + 1 : 0;
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][i3] + " : " + colonnes[1][j3] + " : " + colonnes[2][k3] + "\n";
tmsg.edit(msg);
}
}
}
module.exports = Slots;

View file

@ -1,46 +0,0 @@
const Command = require("../../base/Command"),
tictactoe = require("../../helpers/tictactoe");
class TicTacToe extends Command {
constructor(client) {
super(client, {
name: "tictactoe",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["ttt"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
tictactoe(message, {
resultBtn: true,
embedColor: data.config.embed.color,
embedFoot: data.config.embed.footer
}).then(async winner => {
const memberData = await this.client.findOrCreateMember({
id: winner.id,
guildID: message.guild.id
});
const info = {
user: message.translate("economy/transactions:TTT"),
amount: 100,
date: Date.now(),
type: "got"
};
memberData.transactions.push(info);
memberData.money += 100;
memberData.save();
});
}
}
module.exports = TicTacToe;

View file

@ -1,56 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Transactions extends Command {
constructor(client) {
super(client, {
name: "transactions",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["tr"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("economy/transactions:EMBED_TRANSACTIONS"),
iconURL: message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
const transactions = data.memberData.transactions,
sortedTransactions = [ [], [] ];
transactions.slice(-20).forEach((t) => {
const array = t.type === "got" ? sortedTransactions[0] : sortedTransactions[1];
array.push(`${message.translate("economy/transactions:T_USER_" + t.type.toUpperCase())}: ${t.user}\n${message.translate("economy/transactions:T_AMOUNT")}: ${t.amount}\n${message.translate("economy/transactions:T_DATE")}: ${message.printDate(t.date, "Do MMMM YYYY, HH:mm")}\n`);
});
if (transactions.length < 1) {
embed.setDescription(message.translate("economy/transactions:NO_TRANSACTIONS"));
} else {
if (sortedTransactions[0].length > 0) embed.addField(message.translate("economy/transactions:T_GOT"), sortedTransactions[0].join("\n"), true);
if (sortedTransactions[1].length > 0) embed.addField(message.translate("economy/transactions:T_SEND"), sortedTransactions[1].join("\n"), true);
}
message.reply({
embeds: [embed]
});
}
}
module.exports = Transactions;

View file

@ -1,52 +0,0 @@
const Command = require("../../base/Command");
class Withdraw extends Command {
constructor(client) {
super(client, {
name: "withdraw",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["wd"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
let amount = args[0];
if (!(parseInt(data.memberData.bankSold, 10) > 0)) return message.error("economy/withdraw:NO_CREDIT");
if (args[0] === "all") {
amount = parseInt(data.memberData.bankSold, 10);
} else {
if (isNaN(amount) || parseInt(amount, 10) < 1) return message.error("economy/withdraw:MISSING_AMOUNT");
amount = parseInt(amount, 10);
}
if (data.memberData.bankSold < amount) return message.error("economy/withdraw:NOT_ENOUGH", { money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}` });
const info = {
user: message.translate("economy/transactions:BANK"),
amount: amount,
date: Date.now(),
type: "got"
};
data.memberData.transactions.push(info);
data.memberData.money = data.memberData.money + amount;
data.memberData.bankSold = data.memberData.bankSold - amount;
data.memberData.save();
message.success("economy/withdraw:SUCCESS", {
money: `**${amount}** ${message.getNoun(amount, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
});
}
}
module.exports = Withdraw;

View file

@ -1,114 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Work extends Command {
constructor(client) {
super(client, {
name: "work",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["salary", "daily"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
// if the member is already in the cooldown db
const isInCooldown = data.memberData.cooldowns.work;
if (isInCooldown) {
/*if the timestamp recorded in the database indicating
when the member will be able to execute the order again
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 (Date.now() > data.memberData.cooldowns.work + (24 * 3600000)) data.memberData.workStreak = 0;
// Records in the database the time when the member will be able to execute the command again (in 12 hours)
const toWait = Date.now() + 43200000;
data.memberData.cooldowns.work = toWait;
data.memberData.markModified("cooldowns");
data.memberData.workStreak = (data.memberData.workStreak || 0) + 1;
await data.memberData.save();
const embed = new Discord.MessageEmbed()
.setFooter({
text: message.translate("economy/work:AWARD"),
iconURL: message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
.setColor(data.config.embed.color);
const award = [
this.client.customEmojis.letters.a,
this.client.customEmojis.letters.w,
this.client.customEmojis.letters.a,
this.client.customEmojis.letters.r,
this.client.customEmojis.letters.d
];
let won = 200;
if (data.memberData.workStreak >= 5) {
won += 200;
embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", {
won: `${won} ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
}))
.addField(message.translate("economy/work:STREAK"), message.translate("economy/work:STREAK_CONTENT"));
data.memberData.workStreak = 0;
} else {
for (let i = 0; i < award.length; i++) {
if (data.memberData.workStreak > i) {
const letter = Discord.Util.parseEmoji(award[i]).name.split("_")[1];
award[i] = `:regional_indicator_${letter.toLowerCase()}:`;
}
}
embed.addField(message.translate("economy/work:SALARY"), message.translate("economy/work:SALARY_CONTENT", {
won: `**${won}** ${message.getNoun(won, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`
}))
.addField(message.translate("economy/work:STREAK"), award.join(""));
}
const info = {
user: message.translate("economy/work:SALARY"),
amount: won,
date: Date.now(),
type: "got"
};
data.memberData.transactions.push(info);
data.memberData.money = data.memberData.money + won;
data.memberData.save();
const messageOptions = {
embeds: [embed]
};
if (!data.userData.achievements.work.achieved) {
data.userData.achievements.work.progress.now += 1;
if (data.userData.achievements.work.progress.now === data.userData.achievements.work.progress.total) {
messageOptions.files = [{
name: "unlocked.png",
attachment: "./assets/img/achievements/achievement_unlocked1.png"
}];
data.userData.achievements.work.achieved = true;
}
data.userData.markModified("achievements.work");
data.userData.save();
}
// Send the embed in the current channel
message.reply(messageOptions);
}
}
module.exports = Work;

View file

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

View file

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

View file

@ -1,36 +0,0 @@
const Command = require("../../base/Command");
class Choice extends Command {
constructor(client) {
super(client, {
name: "choice",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["cho", "ra"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args) {
// Gets the answers by spliting on "/"
const answers = args.join(" ").split("/");
if (answers.length < 2) return message.error("fun/choice:MISSING");
if (answers.some(answer => !answer)) return message.error("fun/choice:EMPTY");
const m = await message.sendT("fun/choice:PROGRESS", null, false, false, "loading");
setTimeout(() => {
const result = answers[parseInt(Math.floor(Math.random() * answers.length))];
m.success("fun/choice:DONE", { result }, {
edit: true
});
}, 1500);
}
}
module.exports = Choice;

View file

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

View file

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

View file

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

View file

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

View file

@ -1,263 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Activity extends Command {
constructor(client) {
super(client, {
name: "activity",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["act"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const voice = message.member.voice.channel;
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
const perms = voice.permissionsFor(this.client.user);
if (!perms.has(Discord.Permissions.FLAGS.CONNECT) || !perms.has(Discord.Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT");
const activities = [
"betrayal",
`checkers (${message.translate("general/activity:NO_BOOST")})`,
`chess (${message.translate("general/activity:NO_BOOST")})`,
"sketchheads",
`ocho (${message.translate("general/activity:NO_BOOST")})`,
"fishing",
"lettertile",
`poker (${message.translate("general/activity:NO_BOOST")})`,
`spellcast (${message.translate("general/activity:NO_BOOST")})`,
"wordsnack",
"puttparty",
"youtube"
];
const activity = args[0];
switch (activity) {
case "betrayal":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "betrayal").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Betrayal.io")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Betrayal.io", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "checkers":
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "checkers").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Checkers In The Park")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Checkers In The Park", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "chess":
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "chess").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Chess In The Park")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Chess In The Park", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "sketchheads":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "sketchheads").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Sketch Heads")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Sketch Heads", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "ocho":
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "ocho").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Ocho")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Ocho", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "fishing":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "fishing").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Fishington.io")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Fishington.io", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "lettertile":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "lettertile").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Letter Tile")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Letter Tile", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "poker":
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "poker").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Poker Night")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Poker Night", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "spellcast":
if (message.guild.premiumTier === "NONE") return message.error("general/activity:NO_BOOST");
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "spellcast").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Spell Cast")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Spell Cast", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "wordsnack":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "wordsnack").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Words Snack")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Words Snack", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "puttparty":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "puttparty").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Puttparty")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Puttparty", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
case "youtube":
this.client.discordTogether.createTogetherCode(message.member.voice.channelId, "youtube").then(async invite => {
const embed = new Discord.MessageEmbed()
.setTitle("Youtube Together")
.setColor(data.config.embed.color)
.setDescription(`**[${message.translate("misc:CLICK_HERE", { activity: "Youtube Together", channel: voice.name })}](${invite.code})**`)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
});
break;
default: {
const embed = new Discord.MessageEmbed()
.setTitle(message.translate("general/activity:TITLE"))
.setDescription(activities.join("\n"))
.setColor(data.config.embed.color)
.setFooter({
text: message.translate("general/activity:FOOTER")
})
.setTimestamp();
message.reply({
embeds: [embed]
});
}
}
}
}
module.exports = Activity;

View file

@ -1,46 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class EmojiInfo extends Command {
constructor(client) {
super(client, {
name: "emoji",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["emi"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const rawEmoji = args[0];
if (!rawEmoji) return message.error("administration/stealemoji:MISSING_EMOJI");
const parsedEmoji = Discord.Util.parseEmoji(rawEmoji);
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("general/emoji:TITLE", {
emoji: parsedEmoji.name
})
})
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
})
.addField(message.translate("general/emoji:NAME"), parsedEmoji.name)
.addField(message.translate("general/emoji:ANIMATED"), parsedEmoji.animated ? message.translate("common:YES") : message.translate("common:NO"))
.addField(message.translate("general/emoji:ID"), parsedEmoji.id ? parsedEmoji.id.toString() : message.translate("general/emoji:STANDART"));
message.reply({
embeds: [embed]
});
}
}
module.exports = EmojiInfo;

View file

@ -1,117 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Help extends Command {
constructor(client) {
super(client, {
name: "help",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["h", "commands"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
if (args[0]) {
const isCustom = (message.guild && data.guild.customCommands ? data.guild.customCommands.find((c) => c.name === args[0]) : false);
const cmd = this.client.commands.get(args[0]) || this.client.commands.get(this.client.aliases.get(args[0]));
if (!cmd && isCustom) {
return message.error("general/help:CUSTOM", {
cmd: args[0]
});
} else if (!cmd) {
return message.error("general/help:NOT_FOUND", {
search: args[0]
});
}
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 examples = message.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:EXAMPLES`, {
prefix: message.guild ? data.guild.prefix : ""
});
const groupEmbed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("general/help:CMD_TITLE", {
cmd: cmd.help.name
})
})
.addField(message.translate("general/help:FIELD_DESCRIPTION"), description)
.addField(message.translate("general/help:FIELD_USAGE"), usage)
.addField(message.translate("general/help:FIELD_EXAMPLES"), examples)
.addField(message.translate("general/help:FIELD_ALIASES"), cmd.help.aliases.length > 0 ? cmd.help.aliases.map(a => "`" + a + "`").join("\n") : message.translate("general/help:NO_ALIAS"))
.addField(message.translate("general/help:FIELD_PERMISSIONS"), cmd.conf.memberPermissions.length > 0 ? cmd.conf.memberPermissions.map((p) => `\`${p}\``).join("\n") : message.translate("general/help:NO_REQUIRED_PERMISSION"))
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
return message.reply({
embeds: [groupEmbed]
});
}
const categories = [];
const commands = this.client.commands;
commands.forEach((command) => {
if (!categories.includes(command.help.category)) {
if (command.help.category === "Owner" && message.author.id !== data.config.owner.id) return;
categories.push(command.help.category);
}
});
const emojis = this.client.customEmojis;
const embed = new Discord.MessageEmbed()
.setDescription(message.translate("general/help:INFO", {
prefix: message.guild ? data.guild.prefix : ""
}))
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
categories.sort().forEach((cat) => {
const tCommands = commands.filter((cmd) => cmd.help.category === cat);
embed.addField(`${emojis.categories[cat.toLowerCase()]} ${cat} - (${tCommands.size})`, `${tCommands.map((cmd) => `\`${cmd.help.name}\``).join(", ")}`);
});
if (message.guild) {
if (data.guild.customCommands.length > 0) embed.addField(`${emojis.categories.custom} ${message.guild.name} | ${message.translate("general/help:CUSTOM_COMMANDS")} - (${data.guild.customCommands.length})`, data.guild.customCommands.map((cmd) => `\`${cmd.name}\``).join(", "));
}
embed.addField("\u200B", message.translate("misc:STATS_FOOTER", {
dashboardLink: this.client.config.dashboard.baseURL,
docsLink: `${this.client.config.dashboard.baseURL}/docs/`,
inviteLink: this.client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR] }),
donateLink: "https://qiwi.com/n/JONNYBRO/",
owner: data.config.owner.id
}));
embed.setAuthor({
name: message.translate("general/help:TITLE", {
name: this.client.user.username
}),
iconURL: this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
});
return message.reply({
embeds: [embed]
});
}
}
module.exports = Help;

View file

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

View file

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

View file

@ -1,85 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js"),
gamedig = require("gamedig");
class Minecraft extends Command {
constructor(client) {
super(client, {
name: "minecraft",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["mc"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const ip = args[0];
if (!ip) return message.error("general/minecraft:MISSING_IP");
const favicon = `https://eu.mc-api.net/v3/server/favicon/${ip}`;
let options = {
type: "minecraft",
host: ip
};
if (ip.split(":").length > 1) {
const ipp = ip.split(":");
options = {
type: "minecraft",
host: ipp[0],
port: ipp[1]
};
}
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
let json = null;
await gamedig.query(options).then((res) => {
json = res;
}).catch((err) => {
console.error(err);
});
if (!json) {
options.type = "minecraftpe";
await gamedig.query(options).then((res) => {
json = res;
}).catch((err) => {
console.error(err);
});
}
if (!json) return m.error("general/minecraft:FAILED", null, { edit: true });
const embed = new Discord.MessageEmbed()
.setAuthor({
name: json.name
})
.addField(message.translate("general/minecraft:FIELD_STATUS"), message.translate("general/minecraft:ONLINE"))
.addField(message.translate("general/minecraft:FIELD_CONNECTED"), `**${(json.raw.players ? json.raw.players.online : json.players.length)}** ${message.getNoun((json.raw.players ? json.raw.players.online : json.players.length), message.translate("misc:NOUNS:PLAYERS:1"), message.translate("misc:NOUNS:PLAYERS:2"), message.translate("misc:NOUNS:PLAYERS:5"))} / **${(json.raw.players ? json.raw.players.max : json.maxplayers)}** ${message.getNoun((json.raw.players ? json.raw.players.max : json.maxplayers), message.translate("misc:NOUNS:PLAYERS:1"), message.translate("misc:NOUNS:PLAYERS:2"), message.translate("misc:NOUNS:PLAYERS:5"))}`)
.addField(message.translate("general/minecraft:FIELD_IP"), json.connect, true)
.addField(message.translate("general/minecraft:FIELD_VERSION"), json.raw.vanilla.raw.version.name, true)
.addField(message.translate("general/minecraft:FIELD_PING"), json.raw.vanilla.ping.toString())
.setColor(data.config.embed.color)
.setThumbnail(favicon)
.setFooter({
text: data.config.embed.footer
});
m.edit({
content: null,
embeds: [embed]
});
}
}
module.exports = Minecraft;

View file

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

View file

@ -1,30 +0,0 @@
const Command = require("../../base/Command");
class Ping extends Command {
constructor(client) {
super(client, {
name: "ping",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["pi"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message) {
message.sendT("general/ping:CONTENT", {
ping: "..."
}).then((m) => {
m.sendT("general/ping:CONTENT", {
ping: Math.round(this.client.ws.ping)
}, { edit: true });
});
}
}
module.exports = Ping;

View file

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

View file

@ -1,45 +0,0 @@
const Command = require("../../base/Command"),
ms = require("ms");
class Remindme extends Command {
constructor(client) {
super(client, {
name: "remindme",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["reminder", "remind", "rem"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const time = args[0];
if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME");
const msg = args.slice(1).join(" ");
if (!msg) return message.error("general/remindme:MISSING_MESSAGE");
const rData = {
message: msg,
createdAt: Date.now(),
sendAt: Date.now() + ms(time)
};
if (!data.userData.reminds) data.userData.reminds = [];
data.userData.reminds.push(rData);
data.userData.markModified("reminds");
data.userData.save();
this.client.databaseCache.usersReminds.set(message.author.id, data.userData);
message.success("general/remindme:SAVED");
}
}
module.exports = Remindme;

View file

@ -1,69 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Report extends Command {
constructor(client) {
super(client, {
name: "report",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["repo"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (message.author.id === "285109105717280768") return message.reply({ content: "Пошёл нахуй фахон" });
const repChannel = message.guild.channels.cache.get(data.guild.plugins.reports);
if (!repChannel) return message.error("general/report:MISSING_CHANNEL");
const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("general/report:MISSING_USER");
if (member.id === message.author.id) return message.error("general/report:INVALID_USER");
const rep = args.slice(1).join(" ");
if (!rep) return message.error("general/report:MISSING_REASON");
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("general/report:TITLE", {
user: member.user.tag
}),
iconURL: message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
.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:REASON"), rep, true)
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true)
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
const success = Discord.Util.parseEmoji(this.client.customEmojis.success).id;
const error = Discord.Util.parseEmoji(this.client.customEmojis.error).id;
repChannel.send({
embeds: [embed]
}).then(async (m) => {
await m.react(success);
await m.react(error);
});
message.success("general/report:SUCCESS", {
channel: repChannel.toString()
});
}
}
module.exports = Report;

View file

@ -1,71 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Serverinfo extends Command {
constructor(client) {
super(client, {
name: "serverinfo",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["si"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
let guild = message.guild;
if (args[0]) {
let found = this.client.guilds.cache.get(args[0]);
if (!found) {
found = this.client.guilds.cache.find(g => g.name.includes(args.join(" ")) || g.id === args[0]);
if (found) guild = found;
}
}
await guild.members.fetch();
const owner = await guild.fetchOwner();
const embed = new Discord.MessageEmbed()
.setAuthor({
name: guild.name,
iconURL: guild.iconURL({
dynamic: true
})
})
.setThumbnail(guild.iconURL({
dynamic: true
}))
.addField(this.client.customEmojis.link + " " + message.translate("general/serverinfo:LINK"), `[${message.translate("general/serverinfo:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/stats/${guild.id})`)
.addField(this.client.customEmojis.title + message.translate("common:NAME"), guild.name, true)
.addField(this.client.customEmojis.calendar + message.translate("common:CREATION"), message.printDate(guild.createdAt), true)
.addField(this.client.customEmojis.users + message.translate("common:MEMBERS"),
`${guild.members.cache.filter(m => !m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => !m.user.bot).size, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}` +
"\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => m.user.bot).size, message.translate("misc:NOUNS:BOTS:1"), message.translate("misc:NOUNS:BOTS:2"), message.translate("misc:NOUNS:BOTS:5"))}`, true
)
.addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel ? guild.afkChannel.toString() : message.translate("general/serverinfo:NO_AFK_CHANNEL"), true)
.addField(this.client.customEmojis.id + message.translate("common:ID"), guild.id, true)
.addField(this.client.customEmojis.crown + message.translate("common:OWNER"), owner.toString(), true)
.addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount.toString() || "0", true)
.addField(this.client.customEmojis.channels + message.translate("common:CHANNELS"),
`${guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size, message.translate("misc:NOUNS:TEXT:1"), message.translate("misc:NOUNS:TEXT:2"), message.translate("misc:NOUNS:TEXT:5"))}` +
"\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size, message.translate("misc:NOUNS:VOICE:1"), message.translate("misc:NOUNS:VOICE:2"), message.translate("misc:NOUNS:VOICE:5"))}` +
"\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size} ${message.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size, message.translate("misc:NOUNS:CATEGORY:1"), message.translate("misc:NOUNS:CATEGORY:2"), message.translate("misc:NOUNS:CATEGORY:5"))}`, true
)
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
message.reply({
embeds: [embed]
});
}
}
module.exports = Serverinfo;

View file

@ -1,49 +0,0 @@
const Command = require("../../base/Command");
class Setafk extends Command {
constructor(client) {
super(client, {
name: "setafk",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["afk"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
const reason = args.join(" ");
if (!reason || reason.length > 250) return message.error("general/setafk:MISSING_REASON");
if (reason === "delete") {
if (data.userData.afk) {
data.userData.afk = null;
data.userData.save();
return message.sendT("general/setafk:DELETED", {
username: message.author.username
});
}
} else {
data.userData.afk = reason;
data.userData.save();
const m = await message.success("general/setafk:SUCCESS", {
reason,
prefix: message.guild ? data.guild.prefix : ""
});
setTimeout(() => {
if (m.deletable) m.delete();
if (message.deletable) message.delete();
}, 10 * 1000);
}
}
}
module.exports = Setafk;

View file

@ -1,42 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js"),
fetch = require("node-fetch");
class ShortURL extends Command {
constructor(client) {
super(client, {
name: "shorturl",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["minimize"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const url = args[0];
if (!url) return message.error("general/shorturl:MISSING_URL");
const res = await fetch(`https://is.gd/create.php?format=simple&url=${encodeURI(url)}`);
const body = await res.text();
if (body === "Error: Please enter a valid URL to shorten") return message.error("general/shorturl:MISSING_URL");
const embed = new Discord.MessageEmbed()
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
})
.setDescription(body);
message.reply({
embeds: [embed]
});
}
}
module.exports = ShortURL;

View file

@ -1,42 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Staff extends Command {
constructor(client) {
super(client, {
name: "staff",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["staf"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
await message.guild.members.fetch();
const administrators = message.guild.members.cache.filter((m) => m.permissions.has(Discord.Permissions.FLAGS.ADMINISTRATOR) && !m.user.bot);
const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.permissions.has(Discord.Permissions.FLAGS.MANAGE_MESSAGES) && !m.user.bot);
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("general/staff:TITLE", {
guild: message.guild.name
})
})
.addField(message.translate("general/staff:ADMINS"), (administrators.size > 0 ? administrators.map((a) => `${a.presence ? this.client.customEmojis.status[a.presence.status] : this.client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : message.translate("general/staff:NO_ADMINS")))
.addField(message.translate("general/staff:MODS"), (moderators.size > 0 ? moderators.map((m) => `${m.presence ? this.client.customEmojis.status[m.presence.status] : this.client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : message.translate("general/staff:NO_MODS")))
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
message.reply({
embeds: [embed]
});
}
}
module.exports = Staff;

View file

@ -1,63 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Stats extends Command {
constructor(client) {
super(client, {
name: "stats",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["stat"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const hiddenGuild = await this.client.guilds.fetch("568120814776614924");
const users = this.client.users.cache.size - hiddenGuild.memberCount;
const servers = this.client.guilds.cache.size - 1;
const statsEmbed = new Discord.MessageEmbed()
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
})
.setAuthor({
name: message.translate("common:STATS")
})
.setDescription(message.translate("general/stats:MADE"))
.addField(this.client.customEmojis.stats + " " + message.translate("general/stats:COUNTS_TITLE"), message.translate("general/stats:COUNTS_CONTENT", {
servers: servers,
users: users
}), true)
.addField(this.client.customEmojis.version + " " + message.translate("general/stats:VERSIONS_TITLE"), `\`Discord.js : v${Discord.version}\`\n\`Nodejs : v${process.versions.node}\``, true)
.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.voice + " " + message.translate("general/stats:MUSIC_TITLE"), message.translate("general/stats:MUSIC_CONTENT", {
count: `${this.client.player.voices.collection.size} ${message.getNoun(this.client.player.voices.collection.size, message.translate("misc:NOUNS:SERVERS:1"), message.translate("misc:NOUNS:SERVERS:2"), message.translate("misc:NOUNS:SERVERS:5"))}`
}))
.addField(message.translate("general/stats:CREDITS_TITLE"), message.translate("general/stats:CREDITS_CONTENT", {
donators: ["**`Добрый Спецназ#8801`** - Тестер, генератор идей"].join("\n"),
translators: ["**`Jonny_Bro#4226`** - :flag_ru:", "**`[ДАННЫЕ УДАЛЕНЫ]#4507`** - :flag_ua:"].join("\n")
}))
.addField(this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", {
dashboardLink: this.client.config.dashboard.baseURL,
docsLink: `${this.client.config.dashboard.baseURL}/docs/`,
inviteLink: this.client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR] }),
donateLink: "https://qiwi.com/n/JONNYBRO/",
owner: data.config.owner.id
}));
message.reply({
embeds: [statsEmbed]
});
}
}
module.exports = Stats;

View file

@ -1,64 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Suggest extends Command {
constructor(client) {
super(client, {
name: "suggest",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["sugg"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
if (message.author.id === "285109105717280768") return message.reply({ content: "Пошёл нахуй фахон" });
const suggChannel = message.guild.channels.cache.get(data.guild.plugins.suggestions);
if (!suggChannel) return message.error("general/suggest:MISSING_CHANNEL");
const sugg = args.join(" ");
if (!sugg) return message.error("general/suggest:MISSING_CONTENT");
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("general/suggest:TITLE", {
user: message.author.username
}),
iconURL: 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:DATE"), message.printDate(new Date(Date.now())), true)
.addField(message.translate("common:CONTENT"), sugg)
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
const success = Discord.Util.parseEmoji(this.client.customEmojis.cool).id;
const error = Discord.Util.parseEmoji(this.client.customEmojis.notcool).id;
suggChannel.send({
embeds: [embed]
}).then(async (m) => {
await m.react(success);
await m.react(error);
});
message.success("general/suggest:SUCCESS", {
channel: suggChannel.toString()
});
}
}
module.exports = Suggest;

View file

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

View file

@ -1,114 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js"),
fetch = require("node-fetch");
class Userinfo extends Command {
constructor(client) {
super(client, {
name: "userinfo",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["ui"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
let displayPresence = true;
const isID = !isNaN(args[0]);
let user;
if (!args[0]) user = message.author;
if (message.mentions.users.first()) user = message.mentions.users.first();
if (isID && !user) {
user = this.client.users.cache.get(args[0]);
if (!user) {
user = await this.client.users.fetch(args[0], true).catch(() => {});
displayPresence = false;
}
}
if (!user) return message.error("general/userinfo:INVALID_USER");
let member = null;
if (message.guild) member = await message.guild.members.fetch(user).catch(() => {});
const embed = new Discord.MessageEmbed()
.setAuthor({
name: `${user.tag} (${user.id})`,
iconURL: user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
.setThumbnail(user.displayAvatarURL({
dynamic: 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.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.avatar + " " + message.translate("common:AVATAR"), user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
if (displayPresence) {
if (member.presence.activities[0].name === "Custom Status") {
embed.addField(this.client.customEmojis.games + " " + message.translate("common:GAME"), (member.presence.activities[0] ? `Пользовательский статус\n${member.presence.activities[0].state || message.translate("common:NOT_DEFINED")}` : message.translate("general/userinfo:NO_GAME")), true);
embed.addField(this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"), message.translate("common:STATUS_" + (member.presence.status.toUpperCase())), true);
} else {
embed.addField(this.client.customEmojis.games + " " + message.translate("common:GAME"), (member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : message.translate("general/userinfo:NO_GAME")), true);
embed.addField(this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"), message.translate("common:STATUS_" + (member.presence.status.toUpperCase())), true);
}
}
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.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.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(", ")));
}
if (user.bot && data.config.apiKeys.dbl && (data.config.apiKeys.dbl !== "")) {
const res = await fetch("https://discordbots.org/api/bots/" + user.id, {
headers: {
"Authorization": data.config.apiKeys.dbl
}
});
const data = await res.json();
if (!data.error) {
embed.addField(this.client.customEmojis.desc + " " + message.translate("common:DESCRIPTION"), data.shortdesc, true)
.addField(this.client.customEmojis.stats + " " + message.translate("common:STATS"), message.translate("general/userinfo:BOT_STATS", {
votes: data.monthlyPoints || 0,
servers: data.server_count || 0,
shards: (data.shards || [0]).length,
lib: data.lib || "unknown"
}), true)
.addField(this.client.customEmojis.link + " " + message.translate("common:LINKS"), `${data.support ? `[${message.translate("common:SUPPORT")}](${data.support}) | ` : ""}${data.invite ? `[${message.translate("common:INVITE")}](${data.invite}) | ` : ""}${data.github ? `[GitHub](${data.github}) | ` : ""}${data.website ? `[${message.translate("common:WEBSITE")}](${data.website})` : ""}`, true);
}
}
message.reply({
embeds: [embed]
});
}
}
module.exports = Userinfo;

View file

@ -1,73 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js"),
fetch = require("node-fetch");
class Whois extends Command {
constructor(client) {
super(client, {
name: "whois",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["ip"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
if (!args[0]) return message.error("general/whois:NO_IP");
const whois = await fetch(`http://ip-api.com/json/${args[0]}?fields=status,message,continent,continentCode,country,countryCode,region,regionName,city,zip,timezone,currency,isp,org,as,mobile,proxy,hosting,query`).then(response => response.json());
if (whois.status === "fail") {
const embed = new Discord.MessageEmbed()
.setDescription(whois.message)
.setTitle(message.translate("general/whois:ERROR", {
ip: args[0]
}))
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
})
.setTimestamp();
return message.reply({
embeds: [embed]
});
}
const embed = new Discord.MessageEmbed()
.setTitle(message.translate("general/whois:INFO_ABOUT", {
ip: args[0]
}))
.setFooter({
text: data.config.embed.footer
})
.setColor(data.config.embed.color)
.addFields(
{ name: "IP", value: whois.query, inline: true },
{ name: message.translate("general/whois:COUNTRY"), value: `${whois.country || "Неизвестно"} (${whois.countryCode || "Неизвестно"})`, inline: true },
{ name: message.translate("general/whois:REGION"), value: `${whois.regionName || "Неизвестно"} (${whois.region || "Неизвестно"})`, inline: true },
{ name: message.translate("general/whois:CITY"), value: `${whois.city || "Неизвестно"}`, inline: true },
{ name: message.translate("general/whois:ZIP"), value: `${whois.zip || "Неизвестно"}`, inline: true },
{ name: message.translate("general/whois:TIMEZONE"), value: `${whois.timezone || "Неизвестно"}`, inline: true },
{ name: message.translate("general/whois:CONTINENT"), value: `${whois.continent || "Неизвестно"} (${whois.continentCode || "Неизвестно"})`, inline: true },
{ name: message.translate("general/whois:CURRENCY"), value: `${whois.currency || "Неизвестно"}`, inline: true },
{ name: message.translate("general/whois:ISP"), value: `${whois.isp || "Неизвестно"}`, inline: true }
)
.setTimestamp();
if (whois.proxy == true) embed.addFields({ name: message.translate("general/whois:INFO"), value: message.translate("general/whois:PROXY") });
else if (whois.mobile == true) embed.addFields({ name: message.translate("general/whois:INFO"), value: message.translate("general/whois:MOBILE") });
else if (whois.hosting == true) embed.addFields({ name: message.translate("general/whois:INFO"), value: message.translate("general/whois:HOSTING") });
message.reply({
embeds: [embed]
});
}
}
module.exports = Whois;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Approved extends Command {
constructor(client) {
super(client, {
name: "approved",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("approved", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "approved.png",
attachment: buffer
}]
});
}
}
module.exports = Approved;

View file

@ -1,37 +0,0 @@
const Command = require("../../base/Command");
class Avatar extends Command {
constructor(client) {
super(client, {
name: "avatar",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
let user = await this.client.resolveUser(args[0]);
if (!user) user = message.author;
const avatarURL = user.displayAvatarURL({
dynamic: true,
size: 512
});
if (args[0] === "link") return message.reply({ content: `<${avatarURL}>` });
message.reply({
files: [{
attachment: avatarURL
}]
});
}
}
module.exports = Avatar;

View file

@ -1,48 +0,0 @@
const Command = require("../../base/Command");
class BatSlap extends Command {
constructor(client) {
super(client, {
name: "batslap",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const users = [
await this.client.resolveUser(args[0]) || message.author,
await this.client.resolveUser(args[1]) || message.author
];
const m = await message.sendT("misc:PLEASE_WAIT", null, {
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
})
});
m.delete();
message.reply({
files: [{
name: "batslap.png",
attachment: buffer
}]
});
}
}
module.exports = BatSlap;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Beautiful extends Command {
constructor(client) {
super(client, {
name: "beautiful",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("beautiful", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "beautiful.png",
attachment: buffer
}]
});
}
}
module.exports = Beautiful;

View file

@ -1,52 +0,0 @@
const Command = require("../../base/Command"),
canvacord = require("canvacord");
class Bed extends Command {
constructor(client) {
super(client, {
name: "bed",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const users = [
await this.client.resolveUser(args[0]) || message.author,
await this.client.resolveUser(args[1]) || message.author
];
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
try {
const buffer = await canvacord.Canvas.bed(users[0].displayAvatarURL({
format: "png"
}), users[1].displayAvatarURL({
format: "png"
}));
m.delete();
message.reply({
files: [{
name: "bed.png",
attachment: buffer
}]
});
} catch (e) {
console.log(e);
m.error("misc:ERR_OCCURRED", null, {
edit: true
});
}
}
}
module.exports = Bed;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Brazzers extends Command {
constructor(client) {
super(client, {
name: "brazzers",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("brazzers", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "brazzers.png",
attachment: buffer
}]
});
}
}
module.exports = Brazzers;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Burn extends Command {
constructor(client) {
super(client, {
name: "burn",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("burn", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "burn.png",
attachment: buffer
}]
});
}
}
module.exports = Burn;

View file

@ -1,45 +0,0 @@
const Command = require("../../base/Command"),
fetch = require("node-fetch");
class Captcha extends Command {
constructor(client) {
super(client, {
name: "captcha",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
try {
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();
m.delete();
message.reply({
files: [{
name: "captcha.png",
attachment: json.message
}]
});
} catch (e) {
console.log(e);
m.error("misc:ERR_OCCURRED", null, {
edit: true
});
}
}
}
module.exports = Captcha;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Challenger extends Command {
constructor(client) {
super(client, {
name: "challenger",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["cha"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("challenger", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "challenger.png",
attachment: buffer
}]
});
}
}
module.exports = Challenger;

View file

@ -1,47 +0,0 @@
const Command = require("../../base/Command"),
fetch = require("node-fetch");
class Clyde extends Command {
constructor(client) {
super(client, {
name: "clyde",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const text = args.join(" ");
if (!text) return message.error("images/clyde:MISSING_TEXT");
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
try {
const res = await fetch(encodeURI(`https://nekobot.xyz/api/imagegen?type=clyde&text=${text}`));
const json = await res.json();
message.reply({
files: [{
name: "clyde.png",
attachment: json.message
}]
});
m.delete();
} catch (e) {
console.log(e);
m.error("misc:ERR_OCCURRED", null, {
edit: true
});
}
}
}
module.exports = Clyde;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Crush extends Command {
constructor(client) {
super(client, {
name: "crush",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("crush", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "crush.png",
attachment: buffer
}]
});
}
}
module.exports = Crush;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Dictator extends Command {
constructor(client) {
super(client, {
name: "dictator",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("dictator", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "dictator.png",
attachment: buffer
}]
});
}
}
module.exports = Dictator;

View file

@ -1,55 +0,0 @@
const Command = require("../../base/Command"),
Canvas = require("canvas");
class Facepalm extends Command {
constructor(client) {
super(client, {
name: "facepalm",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["palm"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author,
m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const canvas = Canvas.createCanvas(632, 357),
ctx = canvas.getContext("2d");
// Draw background for transparent avatar
ctx.fillStyle = "black";
ctx.fillRect(0, 0, 632, 357);
// Draw avatar
const avatar = await Canvas.loadImage(user.displayAvatarURL({
format: "png",
size: 512
}));
ctx.drawImage(avatar, 199, 112, 235, 235);
// Draw layer
const layer = await Canvas.loadImage("./assets/img/facepalm.png");
ctx.drawImage(layer, 0, 0, 632, 357);
m.delete();
message.reply({
files: [{
name: "facepalm.png",
attachment: canvas.toBuffer()
}]
});
}
}
module.exports = Facepalm;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Fire extends Command {
constructor(client) {
super(client, {
name: "fire",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("fire", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "fire.png",
attachment: buffer
}]
});
}
}
module.exports = Fire;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Jail extends Command {
constructor(client) {
super(client, {
name: "jail",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["ja"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("jail", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "jail.png",
attachment: buffer
}]
});
}
}
module.exports = Jail;

View file

@ -1,48 +0,0 @@
const Command = require("../../base/Command"),
fetch = require("node-fetch");
class Love extends Command {
constructor(client) {
super(client, {
name: "love",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const users = [
await this.client.resolveUser(args[0]) || message.author,
await this.client.resolveUser(args[1]) || message.author
];
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
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 json = await res.json();
message.reply({
files: [{
name: "love.png",
attachment: json.message
}]
});
m.delete();
} catch (e) {
console.log(e);
m.error("misc:ERR_OCCURRED", null, {
edit: true
});
}
}
}
module.exports = Love;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Magik extends Command {
constructor(client) {
super(client, {
name: "magik",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("magik", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "magik.png",
attachment: buffer
}]
});
}
}
module.exports = Magik;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Mission extends Command {
constructor(client) {
super(client, {
name: "mission",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("missionpassed", {
url: user.displayAvatarURL({
format: "png",
size: 2048
})
});
m.delete();
message.reply({
files: [{
name: "mission.png",
attachment: buffer
}]
});
}
}
module.exports = Mission;

View file

@ -1,58 +0,0 @@
const Command = require("../../base/Command"),
canvacord = require("canvacord");
class Phcomment extends Command {
constructor(client) {
super(client, {
name: "phcomment",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
let user = await this.client.resolveUser(args[0]);
let text = args.join(" ");
if (user) text = args.slice(1).join(" ");
else user = message.author;
if (!text) return message.error("images/phcomment:MISSING_TEXT");
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
try {
const buffer = await canvacord.Canvas.phub({
username: user.username,
image: user.displayAvatarURL({
format: "png"
}),
message: text
});
m.delete();
message.reply({
files: [{
name: "phcomment.png",
attachment: buffer
}]
});
} catch (e) {
console.log(e);
m.error("misc:ERR_OCCURRED", null, {
edit: true
});
}
}
}
module.exports = Phcomment;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Ps4 extends Command {
constructor(client) {
super(client, {
name: "ps4",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("ps4", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "ps4.png",
attachment: buffer
}]
});
}
}
module.exports = Ps4;

View file

@ -1,39 +0,0 @@
const Command = require("../../base/Command"),
Discord = require("discord.js");
class Qrcode extends Command {
constructor(client) {
super(client, {
name: "qrcode",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["qr"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args, data) {
const text = args.join(" ");
if (!text) return message.error("images/qrcode:MISSING_TEXT");
const pleaseWait = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const embed = new Discord.MessageEmbed()
.setImage(`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${text.replace(new RegExp(" ", "g"), "%20")}`)
.setColor(data.config.embed.color);
pleaseWait.edit({
content: message.translate("images/qrcode:SUCCESS"),
embeds: [embed]
});
}
}
module.exports = Qrcode;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Rip extends Command {
constructor(client) {
super(client, {
name: "rip",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("rip", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "rip.png",
attachment: buffer
}]
});
}
}
module.exports = Rip;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Scary extends Command {
constructor(client) {
super(client, {
name: "scary",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("scary", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "scary.png",
attachment: buffer
}]
});
}
}
module.exports = Scary;

View file

@ -1,45 +0,0 @@
const Command = require("../../base/Command");
class SteamCard extends Command {
constructor(client) {
super(client, {
name: "steamcard",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: ["sc"],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const nArgs = args.join(" ").split(new RegExp(/ <(@!|@)(\d+)>/));
if (!args[0]) return message.error("images/qrcode:MISSING_TEXT");
const user = await this.client.resolveUser(nArgs[1]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("steamcard", {
text: nArgs[0],
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "steamcard.png",
attachment: buffer
}]
});
}
}
module.exports = SteamCard;

View file

@ -1,41 +0,0 @@
const Command = require("../../base/Command");
class Tobecontinued extends Command {
constructor(client) {
super(client, {
name: "tobecontinued",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await this.client.AmeAPI.generate("tobecontinued", {
url: user.displayAvatarURL({
format: "png",
size: 512
})
});
m.delete();
message.reply({
files: [{
name: "tobecontinued.png",
attachment: buffer
}]
});
}
}
module.exports = Tobecontinued;

View file

@ -1,40 +0,0 @@
const Command = require("../../base/Command"),
canvacord = require("canvacord");
class Trash extends Command {
constructor(client) {
super(client, {
name: "trash",
dirname: __dirname,
enabled: true,
guildOnly: false,
aliases: [],
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"],
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
async run(message, args) {
const user = await this.client.resolveUser(args[0]) || message.author;
const m = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
const buffer = await canvacord.Canvas.trash(user.displayAvatarURL({
format: "png",
size: 512
}));
m.delete();
message.reply({
files: [{
name: "trash.png",
attachment: buffer
}]
});
}
}
module.exports = Trash;

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