From 5a1e5b64c5c3a0d9160ec59cef4e61f2d1623e6c Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Sat, 23 Jul 2022 17:14:42 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=20=D0=B3?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B2=D0=B0,=20=D0=BE=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=BB=D0=BE=D1=81=D1=8C=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D1=82=D1=8C=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4?= =?UTF-8?q?=D1=8B=20=D0=BF=D0=BE=D0=B4=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80?= =?UTF-8?q?=D0=B0=D0=BA=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/BaseCommand.js | 18 + base/BaseEvent.js | 14 + base/Command.js | 23 - base/Guild.js | 10 - base/JaBa.js | 179 ++++-- base/Log.js | 15 - base/User.js | 7 - commands/Administration/addcommand.js | 41 -- commands/Administration/addemoji.js | 38 -- commands/Administration/automod.js | 55 -- commands/Administration/autorole.js | 60 -- commands/Administration/backup.js | 145 ----- commands/Administration/configuration.js | 98 --- commands/Administration/delcommand.js | 33 - commands/Administration/deletemod.js | 35 -- commands/Administration/goodbye.js | 108 ---- commands/Administration/ignore.js | 41 -- commands/Administration/set.js | 57 -- commands/Administration/setbirthdays.js | 45 -- commands/Administration/setlang.js | 33 - commands/Administration/setmodlogs.js | 45 -- commands/Administration/setprefix.js | 33 - commands/Administration/setreports.js | 45 -- commands/Administration/setsuggests.js | 45 -- commands/Administration/slowmode.js | 54 -- commands/Administration/stealemoji.js | 39 -- commands/Administration/welcome.js | 111 ---- commands/Economy/achievements.js | 80 --- commands/Economy/birthdate.js | 50 -- commands/Economy/deposit.js | 52 -- commands/Economy/divorce.js | 45 -- commands/Economy/findwords.js | 157 ----- commands/Economy/horserace.js | 184 ------ commands/Economy/leaderboard.js | 174 ------ commands/Economy/marry.js | 134 ---- commands/Economy/money.js | 75 --- commands/Economy/number.js | 98 --- commands/Economy/pay.js | 59 -- commands/Economy/profile.js | 98 --- commands/Economy/rep.js | 71 --- commands/Economy/rob.js | 78 --- commands/Economy/setbio.js | 30 - commands/Economy/slots.js | 208 ------ commands/Economy/tictactoe.js | 46 -- commands/Economy/transactions.js | 56 -- commands/Economy/withdraw.js | 52 -- commands/Economy/work.js | 114 ---- commands/Fun/8ball.js | 31 - commands/Fun/ascii.js | 34 - commands/Fun/choice.js | 36 -- commands/Fun/flip.js | 25 - commands/Fun/lmg.js | 30 - commands/Fun/lovecalc.js | 59 -- commands/Fun/memes.js | 78 --- commands/General/activity.js | 263 -------- commands/General/emoji.js | 46 -- commands/General/help.js | 117 ---- commands/General/invite.js | 57 -- commands/General/invites.js | 72 --- commands/General/minecraft.js | 85 --- commands/General/permissions.js | 50 -- commands/General/ping.js | 30 - commands/General/quote.js | 88 --- commands/General/remindme.js | 45 -- commands/General/report.js | 69 -- commands/General/serverinfo.js | 71 --- commands/General/setafk.js | 49 -- commands/General/shorturl.js | 42 -- commands/General/staff.js | 42 -- commands/General/stats.js | 63 -- commands/General/suggest.js | 64 -- commands/General/translate.js | 72 --- commands/General/userinfo.js | 114 ---- commands/General/whois.js | 73 --- commands/Images/approved.js | 41 -- commands/Images/avatar.js | 37 -- commands/Images/batslap.js | 48 -- commands/Images/beautiful.js | 41 -- commands/Images/bed.js | 52 -- commands/Images/brazzers.js | 41 -- commands/Images/burn.js | 41 -- commands/Images/captcha.js | 45 -- commands/Images/challenger.js | 41 -- commands/Images/clyde.js | 47 -- commands/Images/crush.js | 41 -- commands/Images/dictator.js | 41 -- commands/Images/facepalm.js | 55 -- commands/Images/fire.js | 41 -- commands/Images/jail.js | 41 -- commands/Images/love.js | 48 -- commands/Images/magik.js | 41 -- commands/Images/mission.js | 41 -- commands/Images/phcomment.js | 58 -- commands/Images/ps4.js | 41 -- commands/Images/qrcode.js | 39 -- commands/Images/rip.js | 41 -- commands/Images/scary.js | 41 -- commands/Images/steamcard.js | 45 -- commands/Images/tobecontinued.js | 41 -- commands/Images/trash.js | 40 -- commands/Images/triggered.js | 41 -- commands/Images/wanted.js | 41 -- commands/Images/wasted.js | 41 -- commands/Images/youtube-comment.js | 50 -- commands/Mention.js | 35 ++ commands/Moderation/announcement.js | 99 --- commands/Moderation/ban.js | 112 ---- commands/Moderation/clear.js | 80 --- commands/Moderation/clearwarns.js | 35 -- commands/Moderation/giveaway.js | 127 ---- commands/Moderation/kick.js | 100 --- commands/Moderation/mute.js | 113 ---- commands/Moderation/poll.js | 109 ---- commands/Moderation/sanctions.js | 61 -- commands/Moderation/setwarns.js | 68 -- commands/Moderation/unban.js | 60 -- commands/Moderation/unmute.js | 47 -- commands/Moderation/warn.js | 144 ----- commands/Music/autoplay.js | 32 - commands/Music/back.js | 50 -- commands/Music/clip.js | 58 -- commands/Music/clips.js | 46 -- commands/Music/createplaylist.js | 46 -- commands/Music/filter.js | 41 -- commands/Music/filters.js | 48 -- commands/Music/jump.js | 53 -- commands/Music/loop.js | 40 -- commands/Music/lyrics.js | 64 -- commands/Music/np.js | 63 -- commands/Music/pause.js | 32 - commands/Music/play.js | 45 -- commands/Music/playlists.js | 96 --- commands/Music/playplaylist.js | 54 -- commands/Music/queue.js | 66 -- commands/Music/removeplaylist.js | 42 -- commands/Music/resume.js | 32 - commands/Music/seek.js | 35 -- commands/Music/skip.js | 52 -- commands/Music/stop.js | 48 -- commands/NSFW/nsfw.js | 78 --- commands/Owner/debug.js | 100 --- commands/Owner/eval.js | 43 -- commands/Owner/reload.js | 38 -- commands/Owner/say.js | 88 --- commands/Owner/servers-list.js | 124 ---- commands/Ping.js | 34 + commands/Repeat.js | 37 ++ config.sample.js | 12 +- dashboard/utils.js | 3 - events/CommandHandler.js | 58 ++ events/guildCreate.js | 28 +- events/guildDelete.js | 30 +- events/guildMemberAdd.js | 24 +- events/guildMemberRemove.js | 24 +- events/guildMemberUpdate.js | 22 +- events/messageCreate.js | 160 +---- events/messageUpdate.js | 10 - events/ready.js | 35 +- helpers/discordbots.org.js | 41 -- helpers/extenders.js | 23 +- index.js | 71 +-- languages/en-US/administration/slowmode.json | 8 - languages/language-meta.json | 19 +- languages/ru-RU/administration/slowmode.json | 8 - languages/ru-RU/misc.json | 3 +- languages/ru-RU/music/createplaylist.json | 8 - languages/ru-RU/music/playlists.json | 12 - languages/ru-RU/music/playplaylist.json | 5 - languages/ru-RU/music/removeplaylist.json | 8 - languages/uk-UA/administration/slowmode.json | 8 - languages/uk-UA/music/createplaylist.json | 8 - languages/uk-UA/music/playlists.json | 12 - languages/uk-UA/music/playplaylist.json | 5 - languages/uk-UA/music/removeplaylist.json | 8 - package-lock.json | 626 +++++++++++-------- package.json | 8 +- 176 files changed, 839 insertions(+), 9618 deletions(-) create mode 100644 base/BaseCommand.js create mode 100644 base/BaseEvent.js delete mode 100644 base/Command.js delete mode 100644 base/Log.js delete mode 100644 commands/Administration/addcommand.js delete mode 100644 commands/Administration/addemoji.js delete mode 100644 commands/Administration/automod.js delete mode 100644 commands/Administration/autorole.js delete mode 100644 commands/Administration/backup.js delete mode 100644 commands/Administration/configuration.js delete mode 100644 commands/Administration/delcommand.js delete mode 100644 commands/Administration/deletemod.js delete mode 100644 commands/Administration/goodbye.js delete mode 100644 commands/Administration/ignore.js delete mode 100644 commands/Administration/set.js delete mode 100644 commands/Administration/setbirthdays.js delete mode 100644 commands/Administration/setlang.js delete mode 100644 commands/Administration/setmodlogs.js delete mode 100644 commands/Administration/setprefix.js delete mode 100644 commands/Administration/setreports.js delete mode 100644 commands/Administration/setsuggests.js delete mode 100644 commands/Administration/slowmode.js delete mode 100644 commands/Administration/stealemoji.js delete mode 100644 commands/Administration/welcome.js delete mode 100644 commands/Economy/achievements.js delete mode 100644 commands/Economy/birthdate.js delete mode 100644 commands/Economy/deposit.js delete mode 100644 commands/Economy/divorce.js delete mode 100644 commands/Economy/findwords.js delete mode 100644 commands/Economy/horserace.js delete mode 100644 commands/Economy/leaderboard.js delete mode 100644 commands/Economy/marry.js delete mode 100644 commands/Economy/money.js delete mode 100644 commands/Economy/number.js delete mode 100644 commands/Economy/pay.js delete mode 100644 commands/Economy/profile.js delete mode 100644 commands/Economy/rep.js delete mode 100644 commands/Economy/rob.js delete mode 100644 commands/Economy/setbio.js delete mode 100644 commands/Economy/slots.js delete mode 100644 commands/Economy/tictactoe.js delete mode 100644 commands/Economy/transactions.js delete mode 100644 commands/Economy/withdraw.js delete mode 100644 commands/Economy/work.js delete mode 100644 commands/Fun/8ball.js delete mode 100644 commands/Fun/ascii.js delete mode 100644 commands/Fun/choice.js delete mode 100644 commands/Fun/flip.js delete mode 100644 commands/Fun/lmg.js delete mode 100644 commands/Fun/lovecalc.js delete mode 100644 commands/Fun/memes.js delete mode 100644 commands/General/activity.js delete mode 100644 commands/General/emoji.js delete mode 100644 commands/General/help.js delete mode 100644 commands/General/invite.js delete mode 100644 commands/General/invites.js delete mode 100644 commands/General/minecraft.js delete mode 100644 commands/General/permissions.js delete mode 100644 commands/General/ping.js delete mode 100644 commands/General/quote.js delete mode 100644 commands/General/remindme.js delete mode 100644 commands/General/report.js delete mode 100644 commands/General/serverinfo.js delete mode 100644 commands/General/setafk.js delete mode 100644 commands/General/shorturl.js delete mode 100644 commands/General/staff.js delete mode 100644 commands/General/stats.js delete mode 100644 commands/General/suggest.js delete mode 100644 commands/General/translate.js delete mode 100644 commands/General/userinfo.js delete mode 100644 commands/General/whois.js delete mode 100644 commands/Images/approved.js delete mode 100644 commands/Images/avatar.js delete mode 100644 commands/Images/batslap.js delete mode 100644 commands/Images/beautiful.js delete mode 100644 commands/Images/bed.js delete mode 100644 commands/Images/brazzers.js delete mode 100644 commands/Images/burn.js delete mode 100644 commands/Images/captcha.js delete mode 100644 commands/Images/challenger.js delete mode 100644 commands/Images/clyde.js delete mode 100644 commands/Images/crush.js delete mode 100644 commands/Images/dictator.js delete mode 100644 commands/Images/facepalm.js delete mode 100644 commands/Images/fire.js delete mode 100644 commands/Images/jail.js delete mode 100644 commands/Images/love.js delete mode 100644 commands/Images/magik.js delete mode 100644 commands/Images/mission.js delete mode 100644 commands/Images/phcomment.js delete mode 100644 commands/Images/ps4.js delete mode 100644 commands/Images/qrcode.js delete mode 100644 commands/Images/rip.js delete mode 100644 commands/Images/scary.js delete mode 100644 commands/Images/steamcard.js delete mode 100644 commands/Images/tobecontinued.js delete mode 100644 commands/Images/trash.js delete mode 100644 commands/Images/triggered.js delete mode 100644 commands/Images/wanted.js delete mode 100644 commands/Images/wasted.js delete mode 100644 commands/Images/youtube-comment.js create mode 100644 commands/Mention.js delete mode 100644 commands/Moderation/announcement.js delete mode 100644 commands/Moderation/ban.js delete mode 100644 commands/Moderation/clear.js delete mode 100644 commands/Moderation/clearwarns.js delete mode 100644 commands/Moderation/giveaway.js delete mode 100644 commands/Moderation/kick.js delete mode 100644 commands/Moderation/mute.js delete mode 100644 commands/Moderation/poll.js delete mode 100644 commands/Moderation/sanctions.js delete mode 100644 commands/Moderation/setwarns.js delete mode 100644 commands/Moderation/unban.js delete mode 100644 commands/Moderation/unmute.js delete mode 100644 commands/Moderation/warn.js delete mode 100644 commands/Music/autoplay.js delete mode 100644 commands/Music/back.js delete mode 100644 commands/Music/clip.js delete mode 100644 commands/Music/clips.js delete mode 100644 commands/Music/createplaylist.js delete mode 100644 commands/Music/filter.js delete mode 100644 commands/Music/filters.js delete mode 100644 commands/Music/jump.js delete mode 100644 commands/Music/loop.js delete mode 100644 commands/Music/lyrics.js delete mode 100644 commands/Music/np.js delete mode 100644 commands/Music/pause.js delete mode 100644 commands/Music/play.js delete mode 100644 commands/Music/playlists.js delete mode 100644 commands/Music/playplaylist.js delete mode 100644 commands/Music/queue.js delete mode 100644 commands/Music/removeplaylist.js delete mode 100644 commands/Music/resume.js delete mode 100644 commands/Music/seek.js delete mode 100644 commands/Music/skip.js delete mode 100644 commands/Music/stop.js delete mode 100644 commands/NSFW/nsfw.js delete mode 100644 commands/Owner/debug.js delete mode 100644 commands/Owner/eval.js delete mode 100644 commands/Owner/reload.js delete mode 100644 commands/Owner/say.js delete mode 100644 commands/Owner/servers-list.js create mode 100644 commands/Ping.js create mode 100644 commands/Repeat.js create mode 100644 events/CommandHandler.js delete mode 100644 events/messageUpdate.js delete mode 100644 helpers/discordbots.org.js delete mode 100644 languages/en-US/administration/slowmode.json delete mode 100644 languages/ru-RU/administration/slowmode.json delete mode 100644 languages/ru-RU/music/createplaylist.json delete mode 100644 languages/ru-RU/music/playlists.json delete mode 100644 languages/ru-RU/music/playplaylist.json delete mode 100644 languages/ru-RU/music/removeplaylist.json delete mode 100644 languages/uk-UA/administration/slowmode.json delete mode 100644 languages/uk-UA/music/createplaylist.json delete mode 100644 languages/uk-UA/music/playlists.json delete mode 100644 languages/uk-UA/music/playplaylist.json delete mode 100644 languages/uk-UA/music/removeplaylist.json diff --git a/base/BaseCommand.js b/base/BaseCommand.js new file mode 100644 index 00000000..45de8430 --- /dev/null +++ b/base/BaseCommand.js @@ -0,0 +1,18 @@ +class BaseCommand { + constructor(options) { + /** + * @type {import("@discordjs/builders").SlashCommandBuilder | import("discord.js").ApplicationCommandData} + */ + this.command = options.command; + /** + * @type {Array} + */ + this.aliases = options.aliases; + /** + * @type {Boolean} + */ + this.guildOnly = options.guildOnly || true; + } +} + +module.exports = BaseCommand; \ No newline at end of file diff --git a/base/BaseEvent.js b/base/BaseEvent.js new file mode 100644 index 00000000..ae92c541 --- /dev/null +++ b/base/BaseEvent.js @@ -0,0 +1,14 @@ +class BaseEvent { + constructor(options) { + /** + * @type {String} + */ + this.name = options.name; + /** + * @type {Boolean} + */ + this.once = options.once; + } +} + +module.exports = BaseEvent; \ No newline at end of file diff --git a/base/Command.js b/base/Command.js deleted file mode 100644 index fa9e4426..00000000 --- a/base/Command.js +++ /dev/null @@ -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 }; - } -}; \ No newline at end of file diff --git a/base/Guild.js b/base/Guild.js index 88c4b90f..b335be5d 100644 --- a/base/Guild.js +++ b/base/Guild.js @@ -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 })); \ No newline at end of file diff --git a/base/JaBa.js b/base/JaBa.js index b297f10a..1b4b349e 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -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); diff --git a/base/Log.js b/base/Log.js deleted file mode 100644 index 1fbadb6a..00000000 --- a/base/Log.js +++ /dev/null @@ -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 - }} -})); \ No newline at end of file diff --git a/base/User.js b/base/User.js index dd309ee8..d7cf0758 100644 --- a/base/User.js +++ b/base/User.js @@ -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"); diff --git a/commands/Administration/addcommand.js b/commands/Administration/addcommand.js deleted file mode 100644 index 3a1b2856..00000000 --- a/commands/Administration/addcommand.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/addemoji.js b/commands/Administration/addemoji.js deleted file mode 100644 index e16706a7..00000000 --- a/commands/Administration/addemoji.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/automod.js b/commands/Administration/automod.js deleted file mode 100644 index c19365bd..00000000 --- a/commands/Administration/automod.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/autorole.js b/commands/Administration/autorole.js deleted file mode 100644 index 234d4d42..00000000 --- a/commands/Administration/autorole.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/backup.js b/commands/Administration/backup.js deleted file mode 100644 index 0861f4da..00000000 --- a/commands/Administration/backup.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/configuration.js b/commands/Administration/configuration.js deleted file mode 100644 index e6d75ef2..00000000 --- a/commands/Administration/configuration.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/delcommand.js b/commands/Administration/delcommand.js deleted file mode 100644 index 183a3427..00000000 --- a/commands/Administration/delcommand.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/deletemod.js b/commands/Administration/deletemod.js deleted file mode 100644 index ce4c9500..00000000 --- a/commands/Administration/deletemod.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/goodbye.js b/commands/Administration/goodbye.js deleted file mode 100644 index 8a2c1573..00000000 --- a/commands/Administration/goodbye.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/ignore.js b/commands/Administration/ignore.js deleted file mode 100644 index 23070a0d..00000000 --- a/commands/Administration/ignore.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/set.js b/commands/Administration/set.js deleted file mode 100644 index 013784b5..00000000 --- a/commands/Administration/set.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/setbirthdays.js b/commands/Administration/setbirthdays.js deleted file mode 100644 index 660d9091..00000000 --- a/commands/Administration/setbirthdays.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/setlang.js b/commands/Administration/setlang.js deleted file mode 100644 index 9c092c77..00000000 --- a/commands/Administration/setlang.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/setmodlogs.js b/commands/Administration/setmodlogs.js deleted file mode 100644 index 6a5cc145..00000000 --- a/commands/Administration/setmodlogs.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/setprefix.js b/commands/Administration/setprefix.js deleted file mode 100644 index a680f126..00000000 --- a/commands/Administration/setprefix.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/setreports.js b/commands/Administration/setreports.js deleted file mode 100644 index 7e73f550..00000000 --- a/commands/Administration/setreports.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/setsuggests.js b/commands/Administration/setsuggests.js deleted file mode 100644 index 5bdf3664..00000000 --- a/commands/Administration/setsuggests.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/slowmode.js b/commands/Administration/slowmode.js deleted file mode 100644 index df3a5094..00000000 --- a/commands/Administration/slowmode.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/stealemoji.js b/commands/Administration/stealemoji.js deleted file mode 100644 index 7c7d3709..00000000 --- a/commands/Administration/stealemoji.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Administration/welcome.js b/commands/Administration/welcome.js deleted file mode 100644 index 2e2bd7ad..00000000 --- a/commands/Administration/welcome.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/achievements.js b/commands/Economy/achievements.js deleted file mode 100644 index ea8c6180..00000000 --- a/commands/Economy/achievements.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/birthdate.js b/commands/Economy/birthdate.js deleted file mode 100644 index 85e400a5..00000000 --- a/commands/Economy/birthdate.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/deposit.js b/commands/Economy/deposit.js deleted file mode 100644 index 3cdd2547..00000000 --- a/commands/Economy/deposit.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/divorce.js b/commands/Economy/divorce.js deleted file mode 100644 index 84aabcf4..00000000 --- a/commands/Economy/divorce.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/findwords.js b/commands/Economy/findwords.js deleted file mode 100644 index 3770f792..00000000 --- a/commands/Economy/findwords.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/horserace.js b/commands/Economy/horserace.js deleted file mode 100644 index 650db328..00000000 --- a/commands/Economy/horserace.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/leaderboard.js b/commands/Economy/leaderboard.js deleted file mode 100644 index 984e5c46..00000000 --- a/commands/Economy/leaderboard.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/marry.js b/commands/Economy/marry.js deleted file mode 100644 index 2ad02c54..00000000 --- a/commands/Economy/marry.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/money.js b/commands/Economy/money.js deleted file mode 100644 index d173f229..00000000 --- a/commands/Economy/money.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/number.js b/commands/Economy/number.js deleted file mode 100644 index d070ef4c..00000000 --- a/commands/Economy/number.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/pay.js b/commands/Economy/pay.js deleted file mode 100644 index 0afd9c9c..00000000 --- a/commands/Economy/pay.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js deleted file mode 100644 index d7c9685e..00000000 --- a/commands/Economy/profile.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/rep.js b/commands/Economy/rep.js deleted file mode 100644 index ec625427..00000000 --- a/commands/Economy/rep.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/rob.js b/commands/Economy/rob.js deleted file mode 100644 index ea682ba1..00000000 --- a/commands/Economy/rob.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/setbio.js b/commands/Economy/setbio.js deleted file mode 100644 index d3e8998e..00000000 --- a/commands/Economy/setbio.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/slots.js b/commands/Economy/slots.js deleted file mode 100644 index 31fe1e4c..00000000 --- a/commands/Economy/slots.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/tictactoe.js b/commands/Economy/tictactoe.js deleted file mode 100644 index e011cdd9..00000000 --- a/commands/Economy/tictactoe.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/transactions.js b/commands/Economy/transactions.js deleted file mode 100644 index 646ccd6c..00000000 --- a/commands/Economy/transactions.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/withdraw.js b/commands/Economy/withdraw.js deleted file mode 100644 index f19dc6ad..00000000 --- a/commands/Economy/withdraw.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Economy/work.js b/commands/Economy/work.js deleted file mode 100644 index 7127855e..00000000 --- a/commands/Economy/work.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Fun/8ball.js b/commands/Fun/8ball.js deleted file mode 100644 index e0ab1bc7..00000000 --- a/commands/Fun/8ball.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Fun/ascii.js b/commands/Fun/ascii.js deleted file mode 100644 index ae70522b..00000000 --- a/commands/Fun/ascii.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Fun/choice.js b/commands/Fun/choice.js deleted file mode 100644 index d81ff687..00000000 --- a/commands/Fun/choice.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Fun/flip.js b/commands/Fun/flip.js deleted file mode 100644 index 09944fe1..00000000 --- a/commands/Fun/flip.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Fun/lmg.js b/commands/Fun/lmg.js deleted file mode 100644 index 0742216b..00000000 --- a/commands/Fun/lmg.js +++ /dev/null @@ -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: `` - }); - message.delete().catch(() => {}); - } -} - -module.exports = Lmg; \ No newline at end of file diff --git a/commands/Fun/lovecalc.js b/commands/Fun/lovecalc.js deleted file mode 100644 index 102f4a9d..00000000 --- a/commands/Fun/lovecalc.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Fun/memes.js b/commands/Fun/memes.js deleted file mode 100644 index 5026f94c..00000000 --- a/commands/Fun/memes.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/activity.js b/commands/General/activity.js deleted file mode 100644 index aa8d852f..00000000 --- a/commands/General/activity.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/emoji.js b/commands/General/emoji.js deleted file mode 100644 index bfbfd5bf..00000000 --- a/commands/General/emoji.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/help.js b/commands/General/help.js deleted file mode 100644 index 882c3d08..00000000 --- a/commands/General/help.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/invite.js b/commands/General/invite.js deleted file mode 100644 index 04b1910c..00000000 --- a/commands/General/invite.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/invites.js b/commands/General/invites.js deleted file mode 100644 index 64621010..00000000 --- a/commands/General/invites.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/minecraft.js b/commands/General/minecraft.js deleted file mode 100644 index 22679cf7..00000000 --- a/commands/General/minecraft.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/permissions.js b/commands/General/permissions.js deleted file mode 100644 index de3c1ef0..00000000 --- a/commands/General/permissions.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/ping.js b/commands/General/ping.js deleted file mode 100644 index 1d8238d9..00000000 --- a/commands/General/ping.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/quote.js b/commands/General/quote.js deleted file mode 100644 index f464a03f..00000000 --- a/commands/General/quote.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/remindme.js b/commands/General/remindme.js deleted file mode 100644 index eb5861b6..00000000 --- a/commands/General/remindme.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/report.js b/commands/General/report.js deleted file mode 100644 index 288d0901..00000000 --- a/commands/General/report.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/serverinfo.js b/commands/General/serverinfo.js deleted file mode 100644 index 77925b44..00000000 --- a/commands/General/serverinfo.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/setafk.js b/commands/General/setafk.js deleted file mode 100644 index 2d54f2b4..00000000 --- a/commands/General/setafk.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/shorturl.js b/commands/General/shorturl.js deleted file mode 100644 index d353f77a..00000000 --- a/commands/General/shorturl.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/staff.js b/commands/General/staff.js deleted file mode 100644 index e05204ae..00000000 --- a/commands/General/staff.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/stats.js b/commands/General/stats.js deleted file mode 100644 index 5ff799e6..00000000 --- a/commands/General/stats.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/suggest.js b/commands/General/suggest.js deleted file mode 100644 index 12631f24..00000000 --- a/commands/General/suggest.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/translate.js b/commands/General/translate.js deleted file mode 100644 index b5bb2219..00000000 --- a/commands/General/translate.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/userinfo.js b/commands/General/userinfo.js deleted file mode 100644 index f8ba012d..00000000 --- a/commands/General/userinfo.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/General/whois.js b/commands/General/whois.js deleted file mode 100644 index 93c741c4..00000000 --- a/commands/General/whois.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/approved.js b/commands/Images/approved.js deleted file mode 100644 index 9f9eb5bd..00000000 --- a/commands/Images/approved.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/avatar.js b/commands/Images/avatar.js deleted file mode 100644 index f875f72a..00000000 --- a/commands/Images/avatar.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/batslap.js b/commands/Images/batslap.js deleted file mode 100644 index 991d2ab1..00000000 --- a/commands/Images/batslap.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/beautiful.js b/commands/Images/beautiful.js deleted file mode 100644 index b0aae472..00000000 --- a/commands/Images/beautiful.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/bed.js b/commands/Images/bed.js deleted file mode 100644 index a8ade40c..00000000 --- a/commands/Images/bed.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/brazzers.js b/commands/Images/brazzers.js deleted file mode 100644 index c57d6be0..00000000 --- a/commands/Images/brazzers.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/burn.js b/commands/Images/burn.js deleted file mode 100644 index 2e160e1d..00000000 --- a/commands/Images/burn.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/captcha.js b/commands/Images/captcha.js deleted file mode 100644 index 5cb4d6fb..00000000 --- a/commands/Images/captcha.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/challenger.js b/commands/Images/challenger.js deleted file mode 100644 index f4dfd693..00000000 --- a/commands/Images/challenger.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/clyde.js b/commands/Images/clyde.js deleted file mode 100644 index ddaf1d58..00000000 --- a/commands/Images/clyde.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/crush.js b/commands/Images/crush.js deleted file mode 100644 index c89e5c25..00000000 --- a/commands/Images/crush.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/dictator.js b/commands/Images/dictator.js deleted file mode 100644 index 2ccbc6e5..00000000 --- a/commands/Images/dictator.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/facepalm.js b/commands/Images/facepalm.js deleted file mode 100644 index d08e8575..00000000 --- a/commands/Images/facepalm.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/fire.js b/commands/Images/fire.js deleted file mode 100644 index d7f2851b..00000000 --- a/commands/Images/fire.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/jail.js b/commands/Images/jail.js deleted file mode 100644 index b8b50c07..00000000 --- a/commands/Images/jail.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/love.js b/commands/Images/love.js deleted file mode 100644 index 63cad35f..00000000 --- a/commands/Images/love.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/magik.js b/commands/Images/magik.js deleted file mode 100644 index edf3499a..00000000 --- a/commands/Images/magik.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/mission.js b/commands/Images/mission.js deleted file mode 100644 index 13088b0b..00000000 --- a/commands/Images/mission.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/phcomment.js b/commands/Images/phcomment.js deleted file mode 100644 index 42dd77bd..00000000 --- a/commands/Images/phcomment.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/ps4.js b/commands/Images/ps4.js deleted file mode 100644 index 42641627..00000000 --- a/commands/Images/ps4.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/qrcode.js b/commands/Images/qrcode.js deleted file mode 100644 index 5ccfab3c..00000000 --- a/commands/Images/qrcode.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/rip.js b/commands/Images/rip.js deleted file mode 100644 index b6645d71..00000000 --- a/commands/Images/rip.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/scary.js b/commands/Images/scary.js deleted file mode 100644 index 80afea39..00000000 --- a/commands/Images/scary.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/steamcard.js b/commands/Images/steamcard.js deleted file mode 100644 index 6f47aa38..00000000 --- a/commands/Images/steamcard.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/tobecontinued.js b/commands/Images/tobecontinued.js deleted file mode 100644 index 5f9e3afa..00000000 --- a/commands/Images/tobecontinued.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/trash.js b/commands/Images/trash.js deleted file mode 100644 index c417beb6..00000000 --- a/commands/Images/trash.js +++ /dev/null @@ -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; \ No newline at end of file diff --git a/commands/Images/triggered.js b/commands/Images/triggered.js deleted file mode 100644 index 43366e15..00000000 --- a/commands/Images/triggered.js +++ /dev/null @@ -1,41 +0,0 @@ -const Command = require("../../base/Command"); - -class Triggered extends Command { - constructor(client) { - super(client, { - name: "triggered", - 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("triggered", { - url: user.displayAvatarURL({ - format: "png", - size: 512 - }) - }); - m.delete(); - - message.reply({ - files: [{ - name: "triggered.gif", - attachment: buffer - }] - }); - } -} - -module.exports = Triggered; \ No newline at end of file diff --git a/commands/Images/wanted.js b/commands/Images/wanted.js deleted file mode 100644 index 85df9457..00000000 --- a/commands/Images/wanted.js +++ /dev/null @@ -1,41 +0,0 @@ -const Command = require("../../base/Command"); - -class Wanted extends Command { - constructor(client) { - super(client, { - name: "wanted", - 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("wanted", { - url: user.displayAvatarURL({ - format: "png", - size: 512 - }) - }); - m.delete(); - - message.reply({ - files: [{ - name: "wanted.png", - attachment: buffer - }] - }); - } -} - -module.exports = Wanted; \ No newline at end of file diff --git a/commands/Images/wasted.js b/commands/Images/wasted.js deleted file mode 100644 index 6e9bf472..00000000 --- a/commands/Images/wasted.js +++ /dev/null @@ -1,41 +0,0 @@ -const Command = require("../../base/Command"); - -class Wasted extends Command { - constructor(client) { - super(client, { - name: "wasted", - 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("wasted", { - url: user.displayAvatarURL({ - format: "png", - size: 512 - }) - }); - m.delete(); - - message.reply({ - files: [{ - name: "wasted.png", - attachment: buffer - }] - }); - } -} - -module.exports = Wasted; \ No newline at end of file diff --git a/commands/Images/youtube-comment.js b/commands/Images/youtube-comment.js deleted file mode 100644 index dafe2c7e..00000000 --- a/commands/Images/youtube-comment.js +++ /dev/null @@ -1,50 +0,0 @@ -const Command = require("../../base/Command"), - canvacord = require("canvacord"); - -class Ytcomment extends Command { - constructor(client) { - super(client, { - name: "ytcomment", - 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"); // same text as phcomment - - const m = await message.sendT("misc:PLEASE_WAIT", null, { - prefixEmoji: "loading" - }); - const image = await canvacord.Canvas.youtube({ - username: user.username, - avatar: user.displayAvatarURL({ - format: "png" - }), - content: text - }); - m.delete(); - - message.reply({ - files: [{ - name: "ytcomment.png", - attachment: image - }] - }); - } -} - -module.exports = Ytcomment; \ No newline at end of file diff --git a/commands/Mention.js b/commands/Mention.js new file mode 100644 index 00000000..4ea58a6e --- /dev/null +++ b/commands/Mention.js @@ -0,0 +1,35 @@ +const BaseCommand = require("../base/BaseCommand"); + +class Mention extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor() { + super({ + command: { + name: "mention", + type: 2 // Type 2 is MESSAGE COMMAND. + }, + aliases: ["m"], // Application command aliases. + guildOnly: true // Determines whether your command is only guild. + }); + } + /** + * + * @param {import("../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../base/JaBa")} client + * @param {import("discord.js").ContextMenuInteraction} interaction + */ + async execute(client, interaction) { + const target = interaction.member.guild.members.cache.get(interaction.targetId); + return interaction.reply({ content: target.toString(), ephemeral: false, fetchReply: true }).then(m => setTimeout(() => m.delete(), 5000)); + } +} +module.exports = Mention; \ No newline at end of file diff --git a/commands/Moderation/announcement.js b/commands/Moderation/announcement.js deleted file mode 100644 index e6a604bc..00000000 --- a/commands/Moderation/announcement.js +++ /dev/null @@ -1,99 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Announcement extends Command { - constructor(client) { - super(client, { - name: "announcement", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["ann"], - memberPermissions: ["MENTION_EVERYONE"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const text = args.join(" "); - if (!text) return message.error("moderation/announcement:MISSING_TEXT"); - if (text.length > 1030) return message.error("moderation/announcement:TOO_LONG"); - - let mention = null; - const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); - - const filter = m => m.author.id === message.author.id; - const collector = new Discord.MessageCollector(message.channel, { - filter, - time: 240000 - }); - - collector.on("collect", async (tmsg) => { - if (tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) { - tmsg.delete(); - msg.delete(); - collector.stop(true); - - if (message.deletable) message.delete(); - } - - if (tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) { - tmsg.delete(); - msg.delete(); - const tmsg1 = await message.channel.send(message.translate("moderation/announcement:MENTION_TYPE_PROMPT")); - - const filter = m => m.author.id === message.author.id; - const c = new Discord.MessageCollector(message.channel, { - filter, - time: 60000 - }); - c.on("collect", (m) => { - if (m.content.toLowerCase() === "here") { - mention = "@here"; - tmsg1.delete(); - m.delete(); - collector.stop(true); - c.stop(true); - } else if (m.content.toLowerCase() === "everyone") { - mention = "@everyone"; - tmsg1.delete(); - m.delete(); - collector.stop(true); - c.stop(true); - } - }); - - c.on("end", (collected, reason) => { - if (reason === "time") return message.error("misc:TIMES_UP"); - }); - - if (message.deletable) message.delete(); - } - }); - - collector.on("end", (collected, reason) => { - if (reason === "time") return message.error("misc:TIMES_UP"); - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("moderation/announcement:TITLE") - }) - .setColor(data.config.embed.color) - .setFooter({ - text: message.author.tag - }) - .setTimestamp() - .setDescription(text); - - message.channel.send({ - content: mention, - embeds: [embed] - }); - }); - } -} - -module.exports = Announcement; \ No newline at end of file diff --git a/commands/Moderation/ban.js b/commands/Moderation/ban.js deleted file mode 100644 index 16090e9c..00000000 --- a/commands/Moderation/ban.js +++ /dev/null @@ -1,112 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Ban extends Command { - constructor(client) { - super(client, { - name: "ban", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["b"], - memberPermissions: ["BAN_MEMBERS"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const user = await this.client.resolveUser(args[0]); - if (!user) return message.error("moderation/ban:MISSING_MEMBER"); - - const memberData = message.guild.members.cache.get(user.id) ? await this.client.findOrCreateMember({ - id: user.id, - guildID: message.guild.id - }) : null; - - if (user.id === message.author.id) return message.error("moderation/ban:YOURSELF"); - - // If the user is already banned - const banned = await message.guild.bans.fetch(); - if (banned.some((m) => m.user.id === user.id)) return message.error("moderation/ban:ALREADY_BANNED", { - username: user.tag - }); - - // Gets the ban reason - let reason = args.slice(1).join(" "); - if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED"); - - const member = await message.guild.members.fetch(user.id).catch(() => {}); - if (member) { - const memberPosition = member.roles.highest.position; - const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); - if (!member.bannable) return message.error("moderation/ban:MISSING_PERM"); - } - - await user.send(message.translate("moderation/ban:BANNED_DM", { - username: user.tag, - server: message.guild.name, - moderator: message.author.tag, - reason - })).catch(() => {}); - - // Ban the user - message.guild.members.ban(user, { - reason - }).then(() => { - // Send a success message in the current channel - message.reply({ - content: message.translate("moderation/ban:BANNED", { - username: user.tag, - server: message.guild.name, - moderator: message.author.tag, - reason - }) - }); - - const caseInfo = { - channel: message.channel.id, - moderator: message.author.id, - date: Date.now(), - type: "ban", - case: data.guild.casesCount, - reason - }; - - if (memberData) { - memberData.sanctions.push(caseInfo); - memberData.save(); - } - - data.guild.casesCount++; - data.guild.save(); - - if (data.guild.plugins.modlogs) { - const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); - if (!channel) return; - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("moderation/ban:CASE", { - count: data.guild.casesCount - }) - }) - .addField(message.translate("common:USER"), `\`${user.tag}\` (${user.toString()})`, true) - .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true) - .addField(message.translate("common:REASON"), reason, true) - .setColor("#e02316"); - channel.send({ - embeds: [embed] - }); - } - - }).catch((err) => { - console.log(err); - return message.error("moderation/ban:MISSING_PERM"); - }); - } -} - -module.exports = Ban; \ No newline at end of file diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js deleted file mode 100644 index e4b1c27d..00000000 --- a/commands/Moderation/clear.js +++ /dev/null @@ -1,80 +0,0 @@ -const Command = require("../../base/Command"); - -class Clear extends Command { - constructor(client) { - super(client, { - name: "clear", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["cl", "purge"], - memberPermissions: ["MANAGE_MESSAGES"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_MESSAGES"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args) { - if (args[0] === "all") { - message.channel.send(message.translate("moderation/clear:ALL_CONFIRM")); - - const filter = m => m.author.id === message.author.id && m.content === "confirm"; - const collector = message.channel.createMessageCollector({ - filter, - time: 120000 // 2 minutes - }); - - collector.on("collect", async message => { - const position = message.channel.position; - const newChannel = await message.channel.clone(); - await message.channel.delete(); - newChannel.setPosition(position); - return newChannel.send({ - content: message.translate("moderation/clear:CHANNEL_CLEARED") - }); - }); - - collector.on("end", (_, reason) => { - if (reason === "time") return message.error("misc:TIMES_UP"); - }); - } else { - const amount = args[0]; - if (!amount || isNaN(amount) || parseInt(amount) < 1) return message.error("moderation/clear:MISSING_AMOUNT"); - - await message.delete(); - - const user = message.mentions.users.first(); - - let messages = await message.channel.messages.fetch({ - limit: amount - }); - if (user) messages = messages.filter((m) => m.author.id === user.id); - if (messages.length > amount) messages.length = parseInt(amount, 10); - - messages = messages.filter((m) => !m.pinned); - - message.channel.bulkDelete(messages, true); - - let toDelete = null; - - if (user) { - toDelete = await message.channel.send(message.translate("moderation/clear:CLEARED_MEMBER", { - amount: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:MESSAGES:1"), message.translate("misc:NOUNS:MESSAGES:2"), message.translate("misc:NOUNS:MESSAGES:5"))}`, - username: user.tag - })); - } else { - toDelete = await message.channel.send(message.translate("moderation/clear:CLEARED", { - amount: `${amount} ${message.getNoun(amount, message.translate("misc:NOUNS:MESSAGES:1"), message.translate("misc:NOUNS:MESSAGES:2"), message.translate("misc:NOUNS:MESSAGES:5"))}` - })); - } - - setTimeout(function () { - toDelete.delete(); - }, 2000); - } - } -} - -module.exports = Clear; \ No newline at end of file diff --git a/commands/Moderation/clearwarns.js b/commands/Moderation/clearwarns.js deleted file mode 100644 index 5303012f..00000000 --- a/commands/Moderation/clearwarns.js +++ /dev/null @@ -1,35 +0,0 @@ -const Command = require("../../base/Command"); - -class Clearwarns extends Command { - constructor(client) { - super(client, { - name: "clearwarns", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["clearw", "clw"], - memberPermissions: ["MANAGE_MESSAGES"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args) { - const member = await this.client.resolveMember(args[0], message.guild); - if (!member) return message.error("moderation/clearwarns:MISSING_MEMBER"); - - const memberData = await this.client.findOrCreateMember({ - id: member.id, - guildID: message.guild.id - }); - memberData.sanctions = []; - memberData.save(); - message.success("moderation/clearwarns:SUCCESS", { - username: member.user.tag - }); - } -} - -module.exports = Clearwarns; \ No newline at end of file diff --git a/commands/Moderation/giveaway.js b/commands/Moderation/giveaway.js deleted file mode 100644 index e90878f7..00000000 --- a/commands/Moderation/giveaway.js +++ /dev/null @@ -1,127 +0,0 @@ -const Command = require("../../base/Command"), - ms = require("ms"); - -class Giveaway extends Command { - constructor(client) { - super(client, { - name: "giveaway", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["gaway"], - memberPermissions: ["MENTION_EVERYONE"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 2000 - }); - } - - async run(message, args, data) { - const status = args[0]; - if (!status) return message.error("moderation/giveaway:MISSING_STATUS"); - - if (status === "create") { - const currentGiveaways = this.client.giveawaysManager.giveaways.filter((g) => g.guildId === message.guild.id && !g.ended).length; - if (currentGiveaways > 3) return message.error("moderation/giveaway:MAX_COUNT"); - - const time = args[1]; - if (!time) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix }); - if (isNaN(ms(time))) return message.error("misc:INVALID_TIME"); - if (ms(time) > ms("15d")) return message.error("moderation/giveaway:MAX_DURATION"); - - const winnersCount = args[2]; - if (!winnersCount) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix }); - if (isNaN(winnersCount) || winnersCount > 10 || winnersCount < 1) return message.error("misc:INVALID_NUMBER_RANGE", { min: 1, max: 10 }); - - const drop = (args[3] === "true"); - let prize = args.slice(3).join(" "); - - if (drop) prize = args.slice(4).join(" "); - else prize = args.slice(3).join(" "); - - if (!prize) return message.error("moderation/giveaway:INVALID_CREATE", { prefix: data.guild.prefix }); - - this.client.giveawaysManager.start(message.channel, { - duration: ms(time), - winnerCount: parseInt(winnersCount, 10), - prize: prize, - hostedBy: message.author, - isDrop: drop, - messages: { - giveaway: message.translate("moderation/giveaway:TITLE"), - giveawayEnded: message.translate("moderation/giveaway:ENDED"), - timeRemaining: message.translate("moderation/giveaway:TIME_REMAINING"), - inviteToParticipate: message.translate("moderation/giveaway:INVITE_PARTICIPATE"), - winMessage: message.translate("moderation/giveaway:WIN_MESSAGE"), - drawing: message.translate("moderation/giveaway:DRAWING"), - dropMessage: message.translate("moderation/giveaway:DROP"), - embedFooter: message.translate("moderation/giveaway:FOOTER"), - noWinner: message.translate("moderation/giveaway:NO_WINNER"), - winners: message.translate("moderation/giveaway:WINNERS"), - endedAt: message.translate("moderation/giveaway:END_AT"), - hostedBy: message.translate("moderation/giveaway:HOSTEDBY"), - units: { - seconds: message.translate("time:SECONDS", { - amount: "" - }).trim(), - minutes: message.translate("time:MINUTES", { - amount: "" - }).trim(), - hours: message.translate("time:HOURS", { - amount: "" - }).trim(), - days: message.translate("time:DAYS", { - amount: "" - }).trim() - } - } - }).then(() => { - message.success("moderation/giveaway:GIVEAWAY_CREATED"); - }); - } else if (status === "reroll") { - const messageID = args[1]; - if (!messageID) return message.error("moderation/giveaway:MISSING_ID"); - - this.client.giveawaysManager.reroll(messageID, { - messages: { - congrat: message.translate("moderation/giveaway:REROLL_CONGRAT"), - error: message.translate("moderation/giveaway:REROLL_ERROR") - } - }).then(() => { - return message.success("moderation/giveaway:GIVEAWAY_REROLLED"); - }).catch(() => { - return message.error("moderation/giveaway:NOT_FOUND_ENDED", { - messageID - }); - }); - } else if (status === "delete") { - const messageID = args[1]; - if (!messageID) return message.error("moderation/giveaway:MISSING_ID"); - - this.client.giveawaysManager.delete(messageID).then(() => { - return message.success("moderation/giveaway:GIVEAWAY_DELETED"); - }).catch(() => { - return message.error("moderation/giveaway:NOT_FOUND", { - messageID - }); - }); - } else if (status === "end") { - const messageID = args[1]; - if (!messageID) return message.error("moderation/giveaway:MISSING_ID"); - - try { - this.client.giveawaysManager.end(messageID); - return message.success("moderation/giveaway:GIVEAWAY_ENDED"); - } catch (e) { - return message.error("moderation/giveaway:NOT_FOUND", { - messageID - }); - } - } else { - return message.error("moderation/giveaway:MISSING_STATUS"); - } - } -} - -module.exports = Giveaway; \ No newline at end of file diff --git a/commands/Moderation/kick.js b/commands/Moderation/kick.js deleted file mode 100644 index c2fbee21..00000000 --- a/commands/Moderation/kick.js +++ /dev/null @@ -1,100 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Kick extends Command { - constructor(client) { - super(client, { - name: "kick", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["k"], - memberPermissions: ["KICK_MEMBERS"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "KICK_MEMBERS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const member = await this.client.resolveMember(args[0], message.guild); - if (!member) return message.error("moderation/kick:MISSING_MEMBER"); - - if (member.id === message.author.id) return message.error("moderation/kick:YOURSELF"); - - const memberData = await this.client.findOrCreateMember({ - id: member.id, - guildID: message.guild.id - }); - - // Gets the kcik reason - let reason = args.slice(1).join(" "); - if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED"); - - const memberPosition = member.roles.highest.position; - const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); - if (!member.kickable) return message.error("moderation/kick:MISSING_PERM"); - - await member.send({ - content: message.translate("moderation/kick:KICKED_DM", { - username: member.user.tag, - server: message.guild.name, - moderator: message.author.tag, - reason - }) - }); - - // Kick the user - member.kick(reason).then(() => { - // Send a success message in the current channel - message.reply({ - content: message.translate("moderation/kick:KICKED", { - username: member.user.tag, - server: message.guild.name, - moderator: message.author.tag, - reason - }) - }); - - data.guild.casesCount++; - data.guild.save(); - - const caseInfo = { - channel: message.channel.id, - moderator: message.author.id, - date: Date.now(), - type: "kick", - case: data.guild.casesCount, - reason, - }; - - memberData.sanctions.push(caseInfo); - memberData.save(); - - if (data.guild.plugins.modlogs) { - const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); - if (!channel) return; - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("moderation/kick:CASE", { - count: data.guild.casesCount - }) - }) - .addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) - .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true) - .addField(message.translate("common:REASON"), reason, true) - .setColor("#e88709"); - channel.send({ - embeds: [embed] - }); - } - - }).catch(() => { - return message.error("moderation/kick:MISSING_PERM"); - }); - } -} - -module.exports = Kick; \ No newline at end of file diff --git a/commands/Moderation/mute.js b/commands/Moderation/mute.js deleted file mode 100644 index b952fbb2..00000000 --- a/commands/Moderation/mute.js +++ /dev/null @@ -1,113 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"), - ms = require("ms"); - -class Mute extends Command { - constructor(client) { - super(client, { - name: "mute", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["m"], - memberPermissions: ["MANAGE_MESSAGES"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_CHANNELS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const member = await this.client.resolveMember(args[0], message.guild); - if (!member) return message.error("moderation/mute:MISSING_MEMBER"); - if (member.id === message.author.id) return message.error("moderation/mute:YOURSELF"); - - const memberPosition = member.roles.highest.position; - const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); - - const memberData = await this.client.findOrCreateMember({ - id: member.id, - guildID: message.guild.id - }); - - const time = args[1]; - if (!time || isNaN(ms(time))) return message.error("misc:INVALID_TIME"); - let reason = args.slice(2).join(" "); - if (!reason) reason = message.translate("misc:NO_REASON_PROVIDED"); - - message.guild.channels.cache.forEach((channel) => { - channel.permissionOverwrites.edit(member.id, { - SEND_MESSAGES: false, - ADD_REACTIONS: false, - CONNECT: false - }).catch(() => {}); - }); - - member.send({ - content: message.translate("moderation/mute:MUTED_DM", { - username: member.user.username, - server: message.guild.name, - moderator: message.author.tag, - time, - reason - }) - }); - - message.success("moderation/mute:MUTED", { - username: member.user.tag, - server: message.guild.name, - moderator: message.author.tag, - time, - reason - }); - - data.guild.casesCount++; - - const caseInfo = { - channel: message.channel.id, - moderator: message.author.id, - date: Date.now(), - type: "mute", - case: data.guild.casesCount, - reason, - time - }; - - memberData.mute.muted = true; - memberData.mute.endDate = Date.now() + ms(time); - memberData.mute.case = data.guild.casesCount; - memberData.sanctions.push(caseInfo); - - memberData.markModified("sanctions"); - memberData.markModified("mute"); - - await memberData.save(); - await data.guild.save(); - - this.client.databaseCache.mutedUsers.set(`${member.id}${message.guild.id}`, memberData); - - if (data.guild.plugins.modlogs) { - const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); - if (!channel) return; - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("moderation/mute:CASE", { - count: data.guild.casesCount - }) - }) - .addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true) - .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`, true) - .addField(message.translate("common:REASON"), reason, true) - .addField(message.translate("common:DURATION"), time, true) - .addField(message.translate("common:EXPIRY"), message.printDate(new Date(Date.now() + ms(time))), true) - .setColor("#f44271"); - channel.send({ - embeds: [embed] - }); - } - } -} - -module.exports = Mute; \ No newline at end of file diff --git a/commands/Moderation/poll.js b/commands/Moderation/poll.js deleted file mode 100644 index 070c607e..00000000 --- a/commands/Moderation/poll.js +++ /dev/null @@ -1,109 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Poll extends Command { - constructor(client) { - super(client, { - name: "poll", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["po"], - memberPermissions: ["MANAGE_MESSAGES"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const question = args.join(" "); - if (!question) return message.error("moderation/poll:MISSING_QUESTION"); - - let mention = null; - const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); - - const filter = m => m.author.id === message.author.id; - const collector = new Discord.MessageCollector(message.channel, { - filter, - time: 240000 - }); - - collector.on("collect", async (tmsg) => { - if (tmsg.content.toLowerCase() === message.translate("common:NO").toLowerCase()) { - tmsg.delete(); - msg.delete(); - collector.stop(true); - - message.delete(); - } - - if (tmsg.content.toLowerCase() === message.translate("common:YES").toLowerCase()) { - tmsg.delete(); - msg.delete(); - const tmsg1 = await message.channel.send(message.translate("moderation/announcement:MENTION_TYPE_PROMPT")); - - const filter = m => m.author.id === message.author.id; - const c = new Discord.MessageCollector(message.channel, { - filter, - time: 60000 - }); - - c.on("collect", (m) => { - if (m.content.toLowerCase() === "here") { - mention = "@here"; - tmsg1.delete(); - m.delete(); - collector.stop(true); - c.stop(true); - } else if (m.content.toLowerCase() === "everyone") { - mention = "@everyone"; - tmsg1.delete(); - m.delete(); - collector.stop(true); - c.stop(true); - } - }); - - c.on("end", (collected, reason) => { - if (reason === "time") return message.error("misc:TIMES_UP"); - }); - - message.delete(); - } - }); - - collector.on("end", (collected, reason) => { - if (reason === "time") return message.error("misc:TIMES_UP"); - - const success = this.client.customEmojis.success.split(":")[1]; - const error = this.client.customEmojis.error.split(":")[1]; - - const emojis = [ - this.client.emojis.cache.find(e => e.name === success), - this.client.emojis.cache.find(e => e.name === error) - ]; - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("moderation/poll:TITLE") - }) - .setColor(data.config.embed.color) - .addField(question, message.translate("moderation/poll:REACT", { - success: emojis[0].toString(), - error: emojis[1].toString() - })); - - message.channel.send({ - content: mention, - embeds: [embed] - }).then(async (m) => { - await m.react(emojis[0]); - await m.react(emojis[1]); - }); - }); - } -} - -module.exports = Poll; \ No newline at end of file diff --git a/commands/Moderation/sanctions.js b/commands/Moderation/sanctions.js deleted file mode 100644 index 794267f3..00000000 --- a/commands/Moderation/sanctions.js +++ /dev/null @@ -1,61 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Warns extends Command { - constructor(client) { - super(client, { - name: "warns", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["ws"], - memberPermissions: ["MANAGE_MESSAGES"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const user = await this.client.resolveUser(args[0]); - if (!user) return message.error("moderation/warns:MISSING_MEMBER"); - - const memberData = await this.client.findOrCreateMember({ - id: user.id, - guildID: message.guild.id - }); - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: user.tag, - iconURL: user.displayAvatarURL({ - size: 512, - dynamic: true, - format: "png" - }) - }) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - - if (memberData.sanctions.length < 1) { - embed.setDescription(message.translate("moderation/warns:NO_SANCTION", { - username: user.tag - })); - return message.reply({ - embeds: [embed] - }); - } else { - memberData.sanctions.forEach((s) => { - embed.addField(s.type + " | #" + s.case, `${message.translate("common:MODERATOR")}: <@${s.moderator}>\n${message.translate("common:REASON")}: ${s.reason}`, true); - }); - } - message.reply({ - embeds: [embed] - }); - } -} - -module.exports = Warns; \ No newline at end of file diff --git a/commands/Moderation/setwarns.js b/commands/Moderation/setwarns.js deleted file mode 100644 index 8aebfdee..00000000 --- a/commands/Moderation/setwarns.js +++ /dev/null @@ -1,68 +0,0 @@ -const Command = require("../../base/Command"); - -class Setwarns extends Command { - constructor(client) { - super(client, { - name: "setwarns", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["setw"], - memberPermissions: ["MANAGE_GUILD"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS", "KICK_MEMBERS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const sanction = args[0]; - if (!sanction || (sanction !== "kick" && sanction !== "ban")) return message.error("moderation/setwarns:MISSING_TYPE"); - - const number = args[1]; - - if (number === "reset") { - if (sanction === "kick") { - data.guild.plugins.warnsSanctions.kick = false; - data.guild.markModified("plugins.warnsSanctions"); - data.guild.save(); - return message.success("moderation/setwarns:SUCCESS_KICK_RESET", { - prefix: data.guild.prefix, - count: `${number} ${message.getNoun(number, message.translate("misc:NOUNS:WARNS:1"), message.translate("misc:NOUNS:WARNS:2"), message.translate("misc:NOUNS:WARNS:5"))}` - }); - } else if (sanction === "ban") { - data.guild.plugins.warnsSanctions.ban = false; - data.guild.markModified("plugins.warnsSanctions"); - data.guild.save(); - return message.success("moderation/setwarns:SUCCESS_BAN_RESET", { - prefix: data.guild.prefix, - count: `${number} ${message.getNoun(number, message.translate("misc:NOUNS:WARNS:1"), message.translate("misc:NOUNS:WARNS:2"), message.translate("misc:NOUNS:WARNS:5"))}` - }); - } - } - - if (!number || isNaN(number)) return message.error("misc:INVALID_NUMBER"); - if (number < 1 || number > 10) return message.error("misc:INVALID_NUMBER_RANGE", 1, 10); - - if (sanction === "kick") { - data.guild.plugins.warnsSanctions.kick = number; - data.guild.markModified("plugins.warnsSanctions"); - data.guild.save(); - return message.success("moderation/setwarns:SUCCESS_KICK", { - prefix: data.guild.prefix, - count: `${number} ${message.getNoun(number, message.translate("misc:NOUNS:WARNS:1"), message.translate("misc:NOUNS:WARNS:2"), message.translate("misc:NOUNS:WARNS:5"))}` - }); - } else if (sanction === "ban") { - data.guild.plugins.warnsSanctions.ban = number; - data.guild.markModified("plugins.warnsSanctions"); - data.guild.save(); - return message.success("moderation/setwarns:SUCCESS_BAN", { - prefix: data.guild.prefix, - count: `${number} ${message.getNoun(number, message.translate("misc:NOUNS:WARNS:1"), message.translate("misc:NOUNS:WARNS:2"), message.translate("misc:NOUNS:WARNS:5"))}` - }); - } - } -} - -module.exports = Setwarns; \ No newline at end of file diff --git a/commands/Moderation/unban.js b/commands/Moderation/unban.js deleted file mode 100644 index ea0468be..00000000 --- a/commands/Moderation/unban.js +++ /dev/null @@ -1,60 +0,0 @@ -const Command = require("../../base/Command"); - -class Unban extends Command { - constructor(client) { - super(client, { - name: "unban", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["ub"], - memberPermissions: ["BAN_MEMBERS"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "BAN_MEMBERS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args) { - let user = null; - - if (!args[0]) return message.error("moderation/unban:MISSING_ID"); - - // Check if the arg is an ID or a username - const isId = !isNaN(args[0]); - - if (isId) { - // Try to find a user with that ID - await this.client.users.fetch(args[0]).then((u) => { - // if a user was found - user = u; - }).catch(() => {}); - } else if (!isId) { - const arr = args[0].split("#"); - if (arr.length < 2) { - return message.error("misc:NO_USER_FOUND_ID", { - id: args[0] - }); - } - user = this.client.users.filter((u) => u.username === arr[0]).find((u) => u.discriminator === arr[1]); - } - - if (!user) return message.error("misc:NO_USER_FOUND_ID", { id: args[0] }); - - // check if the user is banned - const banned = await message.guild.bans.fetch(); - if (!banned.some((e) => e.user.id === user.id)) return message.success("moderation/unban:NOT_BANNED", { username: user.tag }); - - // Unban user - message.guild.members.unban(user).catch(() => {}); - - // Send a success message in the current channel - message.success("moderation/unban:UNBANNED", { - username: user.tag, - server: message.guild.name - }); - } -} - -module.exports = Unban; \ No newline at end of file diff --git a/commands/Moderation/unmute.js b/commands/Moderation/unmute.js deleted file mode 100644 index 6a8fb313..00000000 --- a/commands/Moderation/unmute.js +++ /dev/null @@ -1,47 +0,0 @@ -const Command = require("../../base/Command"); - -class Unmute extends Command { - constructor(client) { - super(client, { - name: "unmute", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["um"], - memberPermissions: ["MANAGE_MESSAGES"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "MANAGE_CHANNELS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args) { - const member = await this.client.resolveMember(args[0], message.guild); - if (!member) return message.success("moderation/unmute:MISSING_MEMBER"); - - const memberPosition = member.roles.highest.position; - const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); - - const memberData = await this.client.findOrCreateMember({ - id: member.id, - guildID: message.guild.id - }); - - if (memberData.mute.muted) { - memberData.mute.endDate = Date.now(); - memberData.markModified("mute"); - memberData.save(); - message.success("moderation/unmute:SUCCESS", { - username: member.user.tag - }); - } else { - message.error("moderation/unmute:NOT_MUTED", { - username: member.user.tag - }); - } - } -} - -module.exports = Unmute; \ No newline at end of file diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js deleted file mode 100644 index 698978fc..00000000 --- a/commands/Moderation/warn.js +++ /dev/null @@ -1,144 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Warn extends Command { - constructor(client) { - super(client, { - name: "warn", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["w"], - memberPermissions: ["MANAGE_MESSAGES"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const member = await this.client.resolveMember(args[0], message.guild); - if (!member) return message.error("moderation/warn:MISSING_MEMBER"); - if (member.user.bot) return message.error("misc:BOT_USER"); - - const memberData = await this.client.findOrCreateMember({ - id: member.id, - guildID: message.guild.id - }); - - if (member.id === message.author.id) return message.error("moderation/warn:YOURSELF"); - - const memberPosition = member.roles.highest.position; - const moderationPosition = message.member.roles.highest.position; - if (message.member.ownerId !== message.author.id && !(moderationPosition > memberPosition)) return message.error("moderation/ban:SUPERIOR"); - - const reason = args.slice(1).join(" "); - if (!reason) return message.error("moderation/warn:MISSING_REASON"); - - // Gets current member sanctions - const sanctions = memberData.sanctions.filter((s) => s.type === "warn").length; - const banCount = data.guild.plugins.warnsSanctions.ban; - const kickCount = data.guild.plugins.warnsSanctions.kick; - - data.guild.casesCount++; - data.guild.save(); - - const caseInfo = { - channel: message.channel.id, - moderator: message.author.id, - date: Date.now(), - type: "warn", - case: data.guild.casesCount, - reason - }; - - const embed = new Discord.MessageEmbed() - .addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`) - .addField(message.translate("common:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`) - .addField(message.translate("common:REASON"), reason, true); - - if (banCount) { - if (sanctions >= banCount) { - member.send({ - content: message.translate("moderation/ban:BANNED_DM", { - username: member.user, - moderator: message.author.tag, - server: message.guild.name, - reason - }) - }); - caseInfo.type = "ban"; - embed.setAuthor({ - name: message.translate("moderation/ban:CASE", { - count: data.guild.casesCount - }) - }) - .setColor("#e02316"); - message.guild.members.ban(member).catch(() => {}); - message.success("moderation/setwarns:AUTO_BAN", { - username: member.user.tag, - count: banCount - }); - } - } - - if (kickCount) { - if (sanctions >= kickCount) { - member.send({ - content: message.translate("moderation/kick:KICKED_DM", { - username: member.user, - moderator: message.author.tag, - server: message.guild.name, - reason - }) - }); - caseInfo.type = "kick"; - embed.setAuthor({ - name: message.translate("moderation/kick:CASE", { - count: data.guild.casesCount - }) - }) - .setColor("#e88709"); - member.kick().catch(() => {}); - message.success("moderation/setwarns:AUTO_KICK", { - username: member.user.tag, - count: kickCount - }); - } - } - - member.send({ - content: message.translate("moderation/warn:WARNED_DM", { - username: member.user.tag, - server: message.guild.name, - moderator: message.author.tag, - reason - }) - }); - caseInfo.type = "warn"; - embed.setAuthor({ - name: message.translate("moderation/warn:CASE", { - caseNumber: data.guild.casesCount - }) - }) - .setColor("#8c14e2"); - message.success("moderation/warn:WARNED", { - username: member.user.tag, - reason - }); - - memberData.sanctions.push(caseInfo); - memberData.save(); - - if (data.guild.plugins.modlogs) { - const channel = message.guild.channels.cache.get(data.guild.plugins.modlogs); - if (!channel) return; - channel.send({ - embeds: [embed] - }); - } - } -} - -module.exports = Warn; \ No newline at end of file diff --git a/commands/Music/autoplay.js b/commands/Music/autoplay.js deleted file mode 100644 index 2372c601..00000000 --- a/commands/Music/autoplay.js +++ /dev/null @@ -1,32 +0,0 @@ -const Command = require("../../base/Command"); - -class AutoPlay extends Command { - constructor(client) { - super(client, { - name: "autoplay", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["autop"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const autoplay = queue.toggleAutoplay(); - - message.success(`music/autoplay:SUCCESS_${autoplay ? "ENABLED" : "DISABLED"}`); - } -} - -module.exports = AutoPlay; \ No newline at end of file diff --git a/commands/Music/back.js b/commands/Music/back.js deleted file mode 100644 index e5fac879..00000000 --- a/commands/Music/back.js +++ /dev/null @@ -1,50 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Back extends Command { - constructor(client) { - super(client, { - name: "back", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["previous"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - if (!queue.previousSongs[0]) return message.error("music/back:NO_PREV_SONG"); - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("music/back:DESCRIPTION") - }) - .setThumbnail(queue.tracks[0].thumbnail) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - - const m = await message.reply({ - embeds: [embed] - }); - - this.client.player.previous(message); - embed.setDescription(message.translate("music/back:SUCCESS")); - m.edit({ - embeds: [embed] - }); - } -} - -module.exports = Back; \ No newline at end of file diff --git a/commands/Music/clip.js b/commands/Music/clip.js deleted file mode 100644 index de287a0e..00000000 --- a/commands/Music/clip.js +++ /dev/null @@ -1,58 +0,0 @@ -const Command = require("../../base/Command"), - fs = require("fs"), - { joinVoiceChannel, createAudioResource, createAudioPlayer, getVoiceConnection, AudioPlayerStatus } = require("@discordjs/voice"); - -class Clip extends Command { - constructor(client) { - super(client, { - name: "clip", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 2000 - }); - } - - async run(message, args) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - const clip = args[0]; - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (getVoiceConnection(message.guild.id)) return message.error("music/clip:ACTIVE_CLIP"); - if (queue) return message.error("music/clip:ACTIVE_QUEUE"); - if (!clip) return message.error("music/clip:NO_ARG"); - if (!fs.existsSync(`./clips/${clip}.mp3`)) return message.error("music/clip:NO_FILE", { file: clip }); - - try { - const connection = joinVoiceChannel({ - channelId: voice.id, - guildId: message.guild.id, - adapterCreator: message.guild.voiceAdapterCreator - }); - - const resource = createAudioResource(fs.createReadStream(`./clips/${clip}.mp3`)); - const player = createAudioPlayer() - .on("error", err => { - connection.destroy(); - console.error(err.message); - }); - - player.play(resource); - connection.subscribe(player); - - player.on(AudioPlayerStatus.Idle, () => { - connection.destroy(); - }); - } catch (error) { - console.error(error); - } - } -} - -module.exports = Clip; \ No newline at end of file diff --git a/commands/Music/clips.js b/commands/Music/clips.js deleted file mode 100644 index e687a05a..00000000 --- a/commands/Music/clips.js +++ /dev/null @@ -1,46 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"), - fs = require("fs"); - -class Clips extends Command { - constructor(client) { - super(client, { - name: "clips", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 2000 - }); - } - - async run(message, args, data) { - fs.readdir("./clips", function (err, files) { - if (err) return console.log("Unable to read directory: " + err); - - const clips = []; - - files.forEach(function (file) { - clips.push(file.substring(0, file.length - 4)); - }); - - const embed = new Discord.MessageEmbed() - .setTitle(message.translate("music/clips:EMBED_TITLE")) - .setDescription(clips.join("\n")) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }) - .setTimestamp(); - message.reply({ - embeds: [embed] - }); - }); - } -} - -module.exports = Clips; \ No newline at end of file diff --git a/commands/Music/createplaylist.js b/commands/Music/createplaylist.js deleted file mode 100644 index 9c8aa811..00000000 --- a/commands/Music/createplaylist.js +++ /dev/null @@ -1,46 +0,0 @@ -const Command = require("../../base/Command"); - -class CreatePlaylist extends Command { - constructor(client) { - super(client, { - name: "createplaylist", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["cpl", "createpl"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - if (!args) return message.error("music/createplaylist:NO_NAME"); - args = args.join(" ").split(" | "); - - const name = args[0]; - const songs = args[1].split(" "); - if (!name) return message.error("music/createplaylist:NO_NAME"); - if (!songs) return message.error("music/createplaylist:NO_SONGS"); - - const playlist = await this.client.player.createCustomPlaylist(songs, { - member: message.member, - properties: { - name - }, - parallel: true - }); - - data.userData.playlists.push(playlist); - data.userData.markModified("playlists"); - data.userData.save(); - - message.success("music/createplaylist:CREATED", { - name - }); - } -} - -module.exports = CreatePlaylist; \ No newline at end of file diff --git a/commands/Music/filter.js b/commands/Music/filter.js deleted file mode 100644 index d26cea14..00000000 --- a/commands/Music/filter.js +++ /dev/null @@ -1,41 +0,0 @@ -const Command = require("../../base/Command"); - -class Filter extends Command { - constructor(client) { - super(client, { - name: "filter", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["f"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const filter = args[0]; - if (!filter) return message.error("music/filter:MISSING_FILTER", { prefix: data.guild.prefix }); - - if (filter === "off" && queue.filters.length) { - queue.setFilter(false); - message.success("music/filter:REMOVING_FILTER"); - } else if (Object.keys(this.client.player.filters).includes(args[0])) { - queue.setFilter(args[0]); - message.success("music/filter:CHANGING_FILTER"); - } else if (args[0]) return message.error("music/filter:UNKNOWN_FILTER", { - prefix: data.guild.prefix - }); - } -} - -module.exports = Filter; \ No newline at end of file diff --git a/commands/Music/filters.js b/commands/Music/filters.js deleted file mode 100644 index e880d8ab..00000000 --- a/commands/Music/filters.js +++ /dev/null @@ -1,48 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Filters extends Command { - constructor(client) { - super(client, { - name: "filters", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["fs"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const filtersStatuses = [ [], [] ]; - - Object.keys(this.client.player.filters).forEach((filterName) => { - const array = filtersStatuses[0].length > filtersStatuses[1].length ? filtersStatuses[1] : filtersStatuses[0]; - array.push(`${filterName}: ${(queue.filters[filterName] ? this.client.customEmojis.success : this.client.customEmojis.error)}`); - }); - - const list = new Discord.MessageEmbed() - .setDescription(message.translate("music/filters:CONTENT", { - prefix: data.guild.prefix - })) - .addField(message.translate("music/filters:TITLE"), filtersStatuses[0].join("\n"), true) - .addField("** **", filtersStatuses[1].join("\n"), true) - .setColor(data.config.embed.color); - - message.reply({ - embeds: [list] - }); - } -} - -module.exports = Filters; \ No newline at end of file diff --git a/commands/Music/jump.js b/commands/Music/jump.js deleted file mode 100644 index 0006e4fa..00000000 --- a/commands/Music/jump.js +++ /dev/null @@ -1,53 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Jump extends Command { - constructor(client) { - super(client, { - name: "jump", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["j"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const queue = this.client.player.getQueue(message); - const voice = message.member.voice.channel; - const number = parseInt(args[0]); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - if (number < 0) return message.error("music/jump:NO_PREV_SONG", { prefix: data.guild.prefix }); - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("music/jump:SUCCESS") - }) - .setThumbnail(queue.songs[number].thumbnail) - .setFooter({ - text: data.config.embed.footer - }) - .setColor(data.config.embed.color); - - const m = await message.reply({ - embeds: [embed] - }); - - this.client.player.jump(message, number); - embed.setDescription(message.translate("music/play:NOW_PLAYING", { - songName: queue.songs[number].name - })); - m.edit({ - embeds: [embed] - }); - } -} - -module.exports = Jump; \ No newline at end of file diff --git a/commands/Music/loop.js b/commands/Music/loop.js deleted file mode 100644 index 05a19d7a..00000000 --- a/commands/Music/loop.js +++ /dev/null @@ -1,40 +0,0 @@ -const Command = require("../../base/Command"); - -class Loop extends Command { - constructor(client) { - super(client, { - name: "loop", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["repeat", "l"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const type = args[0]; - let mode = null; - if (type === "queue" || type === "all") { - mode = this.client.player.setRepeatMode(message, 2); - } else if (type === "song" || type === "single") { - mode = this.client.player.setRepeatMode(message, 1); - } else { - mode = this.client.player.setRepeatMode(message, 0); - } - - message.success(`music/loop:${mode ? mode === 2 ? "QUEUE" : "SONG" : "DISABLED"}`); - } -} - -module.exports = Loop; \ No newline at end of file diff --git a/commands/Music/lyrics.js b/commands/Music/lyrics.js deleted file mode 100644 index 523ff892..00000000 --- a/commands/Music/lyrics.js +++ /dev/null @@ -1,64 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"), - lyricsParse = require("lyrics-finder"); - -class Lyrics extends Command { - constructor(client) { - super(client, { - name: "lyrics", - dirname: __dirname, - enabled: true, - guildOnly: false, - aliases: ["ly"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const [songName, artistName] = args.join(" ").split("|"); - if (!songName) return message.error("music/lyrics:MISSING_SONG_NAME"); - - const embed = new Discord.MessageEmbed() - .setAuthor(message.translate("music/lyrics:LYRICS_OF", { - songName - })) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - - try { - const songNameFormated = songName - .toLowerCase() - .replace(/\(lyrics|lyric|official music video|audio|official|official video|official video hd|clip officiel|clip|extended|hq\)/g, "") - .split(" ").join("%20"); - - let lyrics = await lyricsParse(songNameFormated, artistName) || "НС Π½Π°ΠΉΠ΄Π΅Π½ΠΎ!"; - - if (lyrics.length > 2040) { - lyrics = lyrics.substr(0, 2000) + message.translate("music/lyrics:AND_MORE") + "\n[" + message.translate("music/lyrics:CLICK_HERE") + "]" + `(https://www.musixmatch.com/search/${songName.replace(" ", "+")})`; - } else if (!lyrics.length) { - return message.error("music/lyrics:NO_LYRICS_FOUND", { - songName - }); - } - - embed.setDescription(lyrics); - message.reply({ - embeds: [embed] - }); - - } catch (e) { - console.log(e); - message.error("music/lyrics:NO_LYRICS_FOUND", { - songName - }); - } - } -} - -module.exports = Lyrics; \ No newline at end of file diff --git a/commands/Music/np.js b/commands/Music/np.js deleted file mode 100644 index 08a5d85a..00000000 --- a/commands/Music/np.js +++ /dev/null @@ -1,63 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Np extends Command { - constructor(client) { - super(client, { - name: "np", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["nowplaying"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const track = queue.songs[0]; - - const status = queue => - `${message.translate("music/np:FILTERS")}: \`${ - queue.filters.join(", ") || message.translate("music/np:DISABLED") - }\` | ${message.translate("music/np:REPEAT")}: \`${ - queue.repeatMode - ? queue.repeatMode === 2 ? message.translate("music/np:QUEUE") : message.translate("music/np:SONG") - : message.translate("music/np:DISABLED") - }\` | ${message.translate("music/np:AUTOPLAY")}: \`${ - queue.autoplay - ? message.translate("music/np:ENABLED") - : message.translate("music/np:DISABLED") - }\``; - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("music/queue:TITLE") - }) - .setThumbnail(track.thumbnail) - .addField(message.translate("music/np:T_TITLE"), `[${track.name}](${track.url})`) - .addField(message.translate("music/np:T_CHANNEL"), track.uploader.name ? track.uploader.name : "ΠžΡ‚ΡΡƒΡ‚ΡΡ‚Π²ΡƒΠ΅Ρ‚") - .addField(message.translate("music/np:T_DURATION"), `${queue.formattedCurrentTime} / ${track.duration > 1 ? track.formattedDuration : message.translate("music/play:LIVE")}`) - .addField(message.translate("music/np:T_CONF"), status(queue)) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }) - .setTimestamp(); - - message.reply({ - embeds: [embed] - }); - } -} - -module.exports = Np; \ No newline at end of file diff --git a/commands/Music/pause.js b/commands/Music/pause.js deleted file mode 100644 index efa90801..00000000 --- a/commands/Music/pause.js +++ /dev/null @@ -1,32 +0,0 @@ -const Command = require("../../base/Command"); - -class Pause extends Command { - constructor(client) { - super(client, { - name: "pause", - dirname: __dirname, - enabled: false, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music:play:NOT_PLAYING"); - - await this.client.player.pause(message); - - message.sendT("music/pause:SUCCESS"); - } -} - -module.exports = Pause; \ No newline at end of file diff --git a/commands/Music/play.js b/commands/Music/play.js deleted file mode 100644 index 8ae57349..00000000 --- a/commands/Music/play.js +++ /dev/null @@ -1,45 +0,0 @@ -const Command = require("../../base/Command"), - { Permissions } = require("discord.js"); - -class Play extends Command { - constructor(client) { - super(client, { - name: "play", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["p"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args) { - const voice = message.member.voice.channel; - const name = args.join(" "); - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!name) return message.error("music/play:MISSING_SONG_NAME"); - - // Check my permissions - const perms = voice.permissionsFor(this.client.user); - if (!perms.has(Permissions.FLAGS.CONNECT) || !perms.has(Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT"); - - try { - this.client.player.play(message.member.voice.channel, args.join(" "), { - member: message.member, - textChannel: message.channel, - message - }); - } catch (e) { - message.error("music/play:ERR_OCCURRED", { - error: e - }); - console.error(e); - } - } -} - -module.exports = Play; \ No newline at end of file diff --git a/commands/Music/playlists.js b/commands/Music/playlists.js deleted file mode 100644 index 0b349bec..00000000 --- a/commands/Music/playlists.js +++ /dev/null @@ -1,96 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Playlists extends Command { - constructor(client) { - super(client, { - name: "playlists", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["pls"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const playlists = data.userData.playlists; - - if (args[0]) { - const name = args.join(" "); - let playlist; - - for (const pl of playlists) { - if (!pl.name === name) return message.error("music/removeplaylist:NOT_FOUND", { - name - }); - - playlist = pl; - } - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("music/playlists:EMBED_TITLE2", { - name - }), - iconURL: message.author.displayAvatarURL({ - size: 512, - dynamic: true, - format: "png" - }) - }) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }) - .addField(message.translate("music/playlists:NAME"), playlist.name, true) - .addField(message.translate("music/playlists:COUNT"), playlist.songs.length.toString(), true); - - const songs = []; - for (const song of playlist.songs) { - songs.push(`[${song.name}](${song.url})`); - } - - embed.addField(message.translate("music/playlists:SONGS"), songs.join("\n")); - - return message.reply({ - embeds: [embed] - }); - } - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("music/playlists:EMBED_TITLE"), - iconURL: message.author.displayAvatarURL({ - size: 512, - dynamic: true, - format: "png" - }) - }) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - - const pls = []; - playlists.forEach((pl) => { - pls.push(`${message.translate("music/playlists:NAME")}: ${pl.name}\n${message.translate("music/playlists:COUNT")}: ${pl.songs.length}\n`); - }); - - if (playlists.length < 1) { - embed.setDescription(message.translate("music/playlists:NO_PLAYLISTS")); - } else { - embed.addField(message.translate("music/playlists:PLAYLISTS"), pls.join("\n"), true); - } - - message.reply({ - embeds: [embed] - }); - } -} - -module.exports = Playlists; \ No newline at end of file diff --git a/commands/Music/playplaylist.js b/commands/Music/playplaylist.js deleted file mode 100644 index 49673bb1..00000000 --- a/commands/Music/playplaylist.js +++ /dev/null @@ -1,54 +0,0 @@ -const Command = require("../../base/Command"), - DisTube = require("distube"), - { Permissions } = require("discord.js"); - -class PlayPlaylists extends Command { - constructor(client) { - super(client, { - name: "playplaylist", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["ppl"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const name = args.join(" "); - let playlist; - for (const pl of data.userData.playlists) { - if (!pl.name === name) return message.error("music/removeplaylist:NOT_FOUND", { - name - }); - - playlist = new DisTube.Playlist(pl); - } - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - - // Check my permissions - const perms = voice.permissionsFor(this.client.user); - if (!perms.has(Permissions.FLAGS.CONNECT) || !perms.has(Permissions.FLAGS.SPEAK)) return message.error("music/play:VOICE_CHANNEL_CONNECT"); - - try { - this.client.player.play(message.member.voice.channel, playlist, { - member: message.member, - textChannel: message.channel, - message - }); - } catch (e) { - message.error("music/play:ERR_OCCURRED", { - error: e - }); - console.error(e); - } - } -} - -module.exports = PlayPlaylists; \ No newline at end of file diff --git a/commands/Music/queue.js b/commands/Music/queue.js deleted file mode 100644 index 972f0768..00000000 --- a/commands/Music/queue.js +++ /dev/null @@ -1,66 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"), - Pagination = require("discord-paginationembed"); - -class Queue extends Command { - constructor(client) { - super(client, { - name: "queue", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["q"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - if (queue.songs.length === 1) { - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("music/queue:TITLE"), - iconURL: message.guild.iconURL({ - dynamic: true - }) - }) - .addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*${message.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`) - .setColor(data.config.embed.color); - return message.reply({ - embeds: [embed] - }); - } - - const FieldsEmbed = new Pagination.FieldsEmbed(); - - FieldsEmbed.embed - .setColor(data.config.embed.color) - .setAuthor({ - name: message.translate("music/queue:TITLE"), - iconURL: message.guild.iconURL({ - dynamic: true - }) - }) - .addField(message.translate("music/np:CURRENTLY_PLAYING"), `[${queue.songs[0].name}](${queue.songs[0].url})\n*${message.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`); - FieldsEmbed - .setArray(queue.songs[1] ? queue.songs.slice(1, queue.songs.length) : []) - .setAuthorizedUsers([message.author.id]) - .setChannel(message.channel) - .setElementsPerPage(5) - .setDeleteOnTimeout(true) - .setPageIndicator(true) - .formatField(message.translate("music/queue:TITLE"), (track) => `**${queue.songs.indexOf(track)}**. [${track.name}](${track.url})\n*${message.translate("music/queue:ADDED")} ${track.member}*\n`) - .build(); - } -} - -module.exports = Queue; \ No newline at end of file diff --git a/commands/Music/removeplaylist.js b/commands/Music/removeplaylist.js deleted file mode 100644 index a0a7268a..00000000 --- a/commands/Music/removeplaylist.js +++ /dev/null @@ -1,42 +0,0 @@ -const Command = require("../../base/Command"); - -class RemovePlaylist extends Command { - constructor(client) { - super(client, { - name: "removeplaylist", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["rpl", "removepl"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const name = args.join(" "); - if (!name) return message.error("music/createplaylist:NO_NAME"); - - const playlists = data.userData.playlists; - for (const playlist of playlists) { - if (!playlist.name === name) return message.error("music/removeplaylist:NOT_FOUND", { - name - }); - - const index = playlists.indexOf(playlist); - playlists.splice(index, 1); - - data.userData.markModified("playlists"); - data.userData.save(); - - message.success("music/removeplaylist:REMOVED", { - name - }); - } - } -} - -module.exports = RemovePlaylist; \ No newline at end of file diff --git a/commands/Music/resume.js b/commands/Music/resume.js deleted file mode 100644 index b056d6eb..00000000 --- a/commands/Music/resume.js +++ /dev/null @@ -1,32 +0,0 @@ -const Command = require("../../base/Command"); - -class Resume extends Command { - constructor(client) { - super(client, { - name: "resume", - dirname: __dirname, - enabled: false, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music:play:NOT_PLAYING"); - - await this.client.player.resume(message); - - message.sendT("music/resume:SUCCESS"); - } -} - -module.exports = Resume; \ No newline at end of file diff --git a/commands/Music/seek.js b/commands/Music/seek.js deleted file mode 100644 index 5501b67f..00000000 --- a/commands/Music/seek.js +++ /dev/null @@ -1,35 +0,0 @@ -const Command = require("../../base/Command"); -const ms = require("ms"); - -class Seek extends Command { - constructor(client) { - super(client, { - name: "seek", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - const time = ms(args[0]) / 1000; - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - if (isNaN(time)) return message.error("music/seek:INVALID_TIME"); - - await this.client.player.seek(message, time); - - message.sendT("music/seek:SUCCESS"); - } -} - -module.exports = Seek; \ No newline at end of file diff --git a/commands/Music/skip.js b/commands/Music/skip.js deleted file mode 100644 index ff403bc5..00000000 --- a/commands/Music/skip.js +++ /dev/null @@ -1,52 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Skip extends Command { - constructor(client) { - super(client, { - name: "skip", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["s"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - if (!queue.songs[1]) return message.error("music/skip:NO_NEXT_SONG"); - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("music/skip:SUCCESS") - }) - .setThumbnail(queue.songs[1].thumbnail) - .setFooter({ - text: data.config.embed.footer - }) - .setColor(data.config.embed.color); - - const m = await message.reply({ - embeds: [embed] - }); - - this.client.player.skip(message); - embed.setDescription(message.translate("music/play:NOW_PLAYING", { - songName: queue.songs[1].name - })); - m.edit({ - embeds: [embed] - }); - } -} - -module.exports = Skip; \ No newline at end of file diff --git a/commands/Music/stop.js b/commands/Music/stop.js deleted file mode 100644 index 6607bf89..00000000 --- a/commands/Music/stop.js +++ /dev/null @@ -1,48 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class Stop extends Command { - constructor(client) { - super(client, { - name: "stop", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["leave", "st"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 3000 - }); - } - - async run(message, args, data) { - const voice = message.member.voice.channel; - const queue = await this.client.player.getQueue(message); - - if (!voice) return message.error("music/play:NO_VOICE_CHANNEL"); - if (!queue) return message.error("music/play:NOT_PLAYING"); - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("music/stop:DESCRIPTION") - }) - .setFooter({ - text: data.config.embed.footer - }) - .setColor(data.config.embed.color); - - const m = await message.reply({ - embeds: [embed] - }); - - this.client.player.stop(message); - embed.setDescription(message.translate("music/stop:SUCCESS")); - m.edit({ - embeds: [embed] - }); - } -} - -module.exports = Stop; \ No newline at end of file diff --git a/commands/NSFW/nsfw.js b/commands/NSFW/nsfw.js deleted file mode 100644 index 3dd2500a..00000000 --- a/commands/NSFW/nsfw.js +++ /dev/null @@ -1,78 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"), - fetch = require("node-fetch"); - -class NSFW extends Command { - constructor(client) { - super(client, { - name: "nsfw", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["n"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS", "ATTACH_FILES"], - nsfw: true, - ownerOnly: false, - cooldown: 2000 - }); - } - - async run(message, args, data) { - const tag = args[0]; - const subs = ["ecchi", "lewdanimegirls", "hentai", "hentaifemdom", "animearmpits", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"]; - - if (tag === "list") { - const embed = new Discord.MessageEmbed() - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }) - .setTitle(message.translate("nsfw/nsfw:EMBED_TITLE")) - .setDescription(subs.join("\n")) - .setTimestamp(); - - message.reply({ - embeds: [embed] - }); - } else if (!tag) { - const m = await message.sendT("nsfw/nsfw:SEARCHING_RANDOM"); - - const res = await fetch("https://meme-api.herokuapp.com/gimme/hentai").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("nsfw/nsfw: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("nsfw/nsfw:NOT_FOUND"); - } -} - -module.exports = NSFW; \ No newline at end of file diff --git a/commands/Owner/debug.js b/commands/Owner/debug.js deleted file mode 100644 index 29a594f8..00000000 --- a/commands/Owner/debug.js +++ /dev/null @@ -1,100 +0,0 @@ -const Command = require("../../base/Command"); - -class Debug extends Command { - constructor(client) { - super(client, { - name: "debug", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["deb"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES"], - nsfw: false, - ownerOnly: true, - cooldown: 3000 - }); - } - - async run(message, args) { - const action = args[0]; - if (!action || !["set", "add"].includes(action)) return message.error("owner/debug:NO_ACTION"); - - const status = args[1]; - if (!status || !["level", "xp", "credits", "bank", "rep"].includes(status)) return message.error("owner/debug:NO_STATUS"); - - const member = await this.client.resolveMember(args[2], message.guild); - if (!member) return message.error("owner/debug:INVALID_MEMBER"); - if (member.user.bot) return message.error("owner/debug:BOT_USER"); - - const number = args[3]; - if (!number || isNaN(number)) return message.error("owner/debug:INVALID_AMOUNT"); - const amount = Math.ceil(parseInt(number, 10)); - - const memberData = await this.client.findOrCreateMember({ - id: member.id, - guildID: message.guild.id - }); - - const userData = await this.client.findOrCreateUser({ - id: member.id, - }); - - let newValue = 0; - - if (action === "set") { - newValue = parseInt(amount, 10); - - if (status === "level") { - memberData.level = newValue; - memberData.save(); - } else if (status === "xp") { - memberData.exp = newValue; - memberData.save(); - } else if (status === "rep") { - userData.rep = newValue; - userData.save(); - } else if (status === "credits") { - memberData.money = newValue; - memberData.save(); - } else if (status === "bank") { - memberData.bankSold = newValue; - memberData.save(); - } - - message.success("owner/debug:SUCCESS_" + status.toUpperCase(), { - username: member.user.tag, - amount - }); - } else if (action === "add") { - if (status === "level") { - newValue = memberData.level + parseInt(amount, 10); - memberData.level = newValue; - memberData.save(); - } else if (status === "xp") { - newValue = memberData.exp + parseInt(amount, 10); - memberData.exp = newValue; - memberData.save(); - } else if (status === "rep") { - newValue = userData.rep + parseInt(amount, 10); - userData.rep = newValue; - userData.save(); - } else if (status === "credits") { - newValue = memberData.money + parseInt(amount, 10); - memberData.money = newValue; - memberData.save(); - } else if (status === "bank") { - newValue = memberData.bankSold + parseInt(amount, 10); - memberData.bankSold = newValue; - memberData.save(); - } - - message.success("owner/debug:SUCCESS_" + status.toUpperCase(), { - username: member.user.tag, - amount: newValue - }); - } - } -} - -module.exports = Debug; \ No newline at end of file diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js deleted file mode 100644 index ceb54199..00000000 --- a/commands/Owner/eval.js +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable no-unused-vars */ -const Command = require("../../base/Command"); - -class Eval extends Command { - constructor(client) { - super(client, { - name: "eval", - dirname: __dirname, - enabled: true, - guildOnly: false, - aliases: ["ev"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: true, - cooldown: 2000 - }); - } - - async run(message, args, data) { - const content = message.content.split(" ").slice(1).join(" "); - const result = new Promise((resolve) => resolve(eval(content))); - - return result.then((output) => { - if (typeof output != "string") output = require("util").inspect(output, { - depth: 0 - }); - if (output.includes(this.client.token)) output = output.replace(this.client.token, "T0K3N"); - message.reply({ - content: "```js\n" + output + "```" - }); - }).catch((err) => { - console.error(err); - err = err.toString(); - if (err.includes(this.client.token)) err = err.replace(this.client.token, "T0K3N"); - message.reply({ - content: "```js\n" + err + "```" - }); - }); - } -} - -module.exports = Eval; \ No newline at end of file diff --git a/commands/Owner/reload.js b/commands/Owner/reload.js deleted file mode 100644 index d1ccebcc..00000000 --- a/commands/Owner/reload.js +++ /dev/null @@ -1,38 +0,0 @@ -const Command = require("../../base/Command"), - i18next = require("i18next"), - autoUpdateDocs = require("../../helpers/autoUpdateDocs"); - -class Reload extends Command { - constructor(client) { - super(client, { - name: "reload", - dirname: __dirname, - enabled: true, - guildOnly: false, - aliases: ["rel"], - memberPermissions: [], - botPermissions: [], - nsfw: false, - ownerOnly: true, - cooldown: 2000 - }); - } - - async run(message, args) { - const command = args[0]; - const cmd = this.client.commands.get(command) || this.client.commands.get(this.client.aliases.get(command)); - if (!cmd) return message.error("owner/reload:NOT_FOUND", { search: command }); - - await this.client.unloadCommand(cmd.conf.location, cmd.help.name); - await this.client.loadCommand(cmd.conf.location, cmd.help.name); - - i18next.reloadResources(["ru-RU", "uk-UA"]); - autoUpdateDocs.update(this.client); - - message.success("owner/reload:SUCCESS", { - command: cmd.help.name - }); - } -} - -module.exports = Reload; \ No newline at end of file diff --git a/commands/Owner/say.js b/commands/Owner/say.js deleted file mode 100644 index 2b43f819..00000000 --- a/commands/Owner/say.js +++ /dev/null @@ -1,88 +0,0 @@ -const Command = require("../../base/Command"); - -class Say extends Command { - constructor(client) { - super(client, { - name: "say", - dirname: __dirname, - enabled: true, - guildOnly: false, - aliases: [], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES"], - nsfw: false, - ownerOnly: true, - cooldown: 2000 - }); - } - - async run(message, args) { - if (!args[0]) { - if (message.deletable) return message.delete(); - } - - // Arguments split - const split = "++"; - args = args.join(" ").split(split); - for (let i = 0; i < args.length; i++) args[i] = args[i].trim(); - - let attachment = null; - let sayChannel = null; - if (message.attachments.size > 0) attachment = message.attachments.first(); - - if (!args[1] && !args[2]) { - if (message.deletable) message.delete(); - sayChannel = message.channel; - sayChannel.sendTyping(); - - setTimeout(function () { - if (attachment) sayChannel.send({ - content: args[0], - files: [{ - name: attachment.name, - attachment: attachment.url - }] - }); - else sayChannel.send({ - content: args[0] - }); - }, 2000); - } else if (args[1] && !args[2]) { - if (message.deletable) message.delete(); - sayChannel = message.guild.channels.cache.find(channel => channel.name.includes(args[1]) || channel.id === args[1]); - sayChannel.sendTyping(); - - setTimeout(function () { - if (attachment) sayChannel.send({ - content: args[0], - files: [{ - name: attachment.name, - attachment: attachment.url - }] - }); - else sayChannel.send({ - content: args[0] - }); - }, 2000); - } else if (args[2]) { - if (message.deletable) message.delete(); - sayChannel = this.client.guilds.cache.find(guild => guild.name.includes(args[2]) || guild.id === args[2]).channels.cache.find(channel => channel.name.includes(args[1]) || channel.id === args[1]); - sayChannel.sendTyping(); - - setTimeout(function () { - if (attachment) sayChannel.send({ - content: args[0], - files: [{ - name: attachment.name, - attachment: attachment.url - }] - }); - else sayChannel.send({ - content: args[0] - }); - }, 2000); - } - } -} - -module.exports = Say; \ No newline at end of file diff --git a/commands/Owner/servers-list.js b/commands/Owner/servers-list.js deleted file mode 100644 index ded1680c..00000000 --- a/commands/Owner/servers-list.js +++ /dev/null @@ -1,124 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -class ServersList extends Command { - constructor(client) { - super(client, { - name: "servers-list", - dirname: __dirname, - enabled: true, - guildOnly: false, - aliases: ["slist"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: true, - cooldown: 3000 - }); - } - - async run(message, args, data) { - let i0 = 0, - i1 = 10, - page = 1; - - let description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` + - this.client.guilds.cache - .sort((a, b) => b.memberCount - a.memberCount) - .map((r) => r) - .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.getNoun(r.memberCount, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}`) - .slice(0, 10) - .join("\n"); - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.author.tag, - iconURL: message.author.displayAvatarURL({ - size: 512, - dynamic: true, - format: "png" - }) - }) - .setColor(data.config.embed.color) - .setFooter({ - text: this.client.user.username - }) - .setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.ceil(this.client.guilds.cache.size / 10)}`) - .setDescription(description); - - const msg = await message.reply({ - embeds: [embed] - }); - - if (message.deletable) message.delete(); - - if (message.channel.type !== "DM") { - await msg.react("β¬…"); - await msg.react("➑"); - await msg.react("❌"); - - const filter = (reaction, user) => user.id === message.author.id; - const collector = msg.createReactionCollector({ - filter, - time: 30000 - }); - - collector.on("collect", async (reaction) => { - if (reaction._emoji.name === "β¬…") { - i0 = i0 - 10; - i1 = i1 - 10; - page = page - 1; - - if (i0 < 0) return msg.delete(); - if (!i0 || !i1) return msg.delete(); - - description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` + - this.client.guilds.cache - .sort((a, b) => b.memberCount - a.memberCount) - .map((r) => r) - .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.getNoun(r.memberCount, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}`) - .slice(i0, i1) - .join("\n"); - - embed - .setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.round(this.client.guilds.cache.size / 10)}`) - .setDescription(description); - - msg.edit({ - embeds: [embed] - }); - } - - if (reaction._emoji.name === "➑") { - i0 = i0 + 10; - i1 = i1 + 10; - page = page + 1; - - if (i1 > this.client.guilds.cache.size + 10) return msg.delete(); - if (!i0 || !i1) return msg.delete(); - - description = `${message.translate("common:SERVERS")}: ${this.client.guilds.cache.size}\n\n` + - this.client.guilds.cache - .sort((a, b) => b.memberCount - a.memberCount) - .map((r) => r) - .map((r, i) => `**${i + 1}** - ${r.name} | ${r.memberCount} ${message.getNoun(r.memberCount, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}`) - .slice(i0, i1) - .join("\n"); - - embed.setTitle(`${message.translate("common:PAGE")}: ${page}/${Math.round(this.client.guilds.cache.size / 10)}`) - .setDescription(description); - - msg.edit({ - embeds: [embed] - }); - } - - if (reaction._emoji.name === "❌") return msg.delete(); - - await reaction.users.remove(message.author.id); - }); - } - } -} - -module.exports = ServersList; \ No newline at end of file diff --git a/commands/Ping.js b/commands/Ping.js new file mode 100644 index 00000000..313929cf --- /dev/null +++ b/commands/Ping.js @@ -0,0 +1,34 @@ +const { SlashCommandBuilder } = require("@discordjs/builders"); +const BaseCommand = require("../base/BaseCommand"); + +class Ping extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor() { + super({ + command: new SlashCommandBuilder() + .setName("ping") + .setDescription("Ping command."), // This option is included in type 1. You can configure this option directly with the SlashCommandBuilder feature. + aliases: ["p"], // Application command aliases. + guildOnly: true // Determines whether your command is only guild. + }); + } + /** + * + * @param {import("../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../base/JaBa")} client + * @param {import("discord.js").CommandInteraction} interaction + */ + async execute(client, interaction) { + return interaction.reply({ content: "Pong!", ephemeral: true }); + } +} +module.exports = Ping; \ No newline at end of file diff --git a/commands/Repeat.js b/commands/Repeat.js new file mode 100644 index 00000000..f34472b0 --- /dev/null +++ b/commands/Repeat.js @@ -0,0 +1,37 @@ +const { TextChannel } = require("discord.js"); +const BaseCommand = require("../base/BaseCommand"); + +class Repeat extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor() { + super({ + command: { + name: "repeat", // Application command name. + type: 3 // Type 3 is USER COMMAND. + }, + aliases: ["r"], // Application command aliases. + guildOnly: true // Determines whether your command is only guild. + }); + } + /** + * + * @param {import("../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../base/JaBa")} client + * @param {import("discord.js").ContextMenuInteraction} interaction + */ + async execute(client, interaction) { + const targetChannel = interaction.member.guild.channels.cache.get(interaction.channelId); + const targetMessage = await targetChannel.messages.fetch(interaction.targetId); + return interaction.reply({ content: targetMessage.content, ephemeral: false, fetchReply: true }).then(m => setTimeout(() => m.delete(), 5000)); + } +} +module.exports = Repeat; \ No newline at end of file diff --git a/config.sample.js b/config.sample.js index a377c703..c7e70c7f 100644 --- a/config.sample.js +++ b/config.sample.js @@ -1,8 +1,11 @@ module.exports = { /* The token of your Discord Bot */ token: "XXXXXXXXXXX", + /* ID of Bot's user */ + user: "XXXXXXXXXXX", /* For the support server */ support: { + enabled: false, // Set to false for production id: "XXXXXXXXXXX", // The ID of the support server logs: "XXXXXXXXXXX", // And the ID of the logs channel of your server (new servers for example) }, @@ -17,7 +20,6 @@ module.exports = { failureURL: "https://dashboard.example.com" // url on which users will be redirected if they click the cancel button (discord authentication) }, mongoDB: "mongodb://localhost:27017/discordbot", // The URl of the mongodb database - prefix: "*", // The default prefix for the bot /* For the embeds (embeded messages) */ embed: { color: "#0091fc", // The default color for the embeds @@ -28,18 +30,10 @@ module.exports = { id: "XXXXXXXXXXX", // The ID of the bot's owner name: "@XXXXXXXXXXX#1234" // And the name of the bot's owner }, - /* DBL votes webhook (optional) */ - votes: { - port: 5000, // The port for the server - password: "XXXXXXXXXXX", // The webhook auth that you have defined on discordbots.org - channel: "XXXXXXXXXXX" // The ID of the channel that in you want the votes logs - }, /* The API keys that are required for certain commands */ apiKeys: { // BLAGUE.XYZ: https://blague.xyz/ blagueXYZ: "XXXXXXXXXXX", - // DBL: https://discordbots.org/api/docs#mybots - dbl: "XXXXXXXXXXX", // AMETHYSTE: https://api.amethyste.moe amethyste: "XXXXXXXXXXX" }, diff --git a/dashboard/utils.js b/dashboard/utils.js index c531b84b..12a75c73 100644 --- a/dashboard/utils.js +++ b/dashboard/utils.js @@ -28,14 +28,11 @@ async function fetchUser(userData, client, query) { const userDb = await client.findOrCreateUser({ id: user.id }, true); - // const guildData = await client.guilds.fetch(userData.displayedGuilds[0].id); - // const userPresence = guildData.members.cache.get(user.id).presence; const userInfos = { ...user.toJSON(), ...userDb, ...userData - // ...userPresence }; return userInfos; diff --git a/events/CommandHandler.js b/events/CommandHandler.js new file mode 100644 index 00000000..ab43668d --- /dev/null +++ b/events/CommandHandler.js @@ -0,0 +1,58 @@ +const BaseEvent = require("../base/BaseEvent"); + +class CommandHandler extends BaseEvent { + constructor() { + super({ + name: "interactionCreate", + once: false + }); + } + + /** + * + * @param {import("../base/JaBa")} client + * @param {import("discord.js").Interaction} interaction + */ + async execute(client, interaction) { + if (interaction.type !== "APPLICATION_COMMAND" && !interaction.isCommand()) return; + const command = client.commands.get(interaction.commandName); + const data = []; + + const userData = await client.findOrCreateUser({ + id: interaction.member.id + }); + data.userData = userData; + + if (command.guildOnly && !interaction.inGuild()) return; + + if (interaction.inGuild()) { + const guildData = await client.findOrCreateGuild({ + id: interaction.guildId + }); + data.guildData = guildData; + + const memberData = await client.findOrCreateMember({ + id: interaction.member.id, + guildID: interaction.guildId + }); + data.memberData = memberData; + } + + if (!userData.achievements.firstCommand.achieved) { + userData.achievements.firstCommand.progress.now = 1; + userData.achievements.firstCommand.achieved = true; + userData.markModified("achievements.firstCommand"); + await userData.save(); + await interaction.channel.send({ + files: [{ + name: "achievement_unlocked2.png", + attachment: "./assets/img/achievements/achievement_unlocked2.png" + }] + }); + } + + return command.execute(client, interaction, data); + } +} + +module.exports = CommandHandler; \ No newline at end of file diff --git a/events/guildCreate.js b/events/guildCreate.js index 00b6bce1..e6466a1e 100644 --- a/events/guildCreate.js +++ b/events/guildCreate.js @@ -1,11 +1,19 @@ -const Discord = require("discord.js"); +const { MessageEmbed } = require("discord.js"), + BaseEvent = require("../base/BaseEvent"); -module.exports = class { - constructor(client) { - this.client = client; +class GuildCreate extends BaseEvent { + constructor() { + super({ + name: "guildCreate", + once: false + }); } - async run(guild) { + /** + * + * @param {import("discord.js").Guild} guild + */ + async execute(guild) { const messageOptions = {}; const userData = await this.client.findOrCreateUser({ @@ -23,11 +31,11 @@ module.exports = class { await userData.save(); } - const thanksEmbed = new Discord.MessageEmbed() + const thanksEmbed = new MessageEmbed() .setAuthor({ name: "Бпасибо Ρ‡Ρ‚ΠΎ Π΄ΠΎΠ±Π°Π²ΠΈΠ»ΠΈ мСня Π½Π° свой сСрвСр!" }) - .setDescription(`Для настроСк ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ \`${this.client.config.prefix}help\` ΠΈ посмотритС Π½Π° административныС ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹!\nΠ§Ρ‚ΠΎΠ±Ρ‹ ΠΈΠ·ΠΌΠ΅Π½ΠΈΡ‚ΡŒ язык ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ \`${this.client.config.prefix}setlang [язык]\`.`) + .setDescription("Π§Ρ‚ΠΎΠ±Ρ‹ ΠΏΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ список ΠΊΠΎΠΌΠ°Π½Π΄ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΡƒΠΉΡƒΡ‚Π΅ `/help` ΠΈ посмотритС Π½Π° административныС ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹!.") .setColor(this.client.config.embed.color) .setFooter({ text: this.client.config.embed.footer @@ -41,7 +49,7 @@ module.exports = class { const users = guild.members.cache.filter((m) => !m.user.bot).size; const bots = guild.members.cache.filter((m) => m.user.bot).size; - const embed = new Discord.MessageEmbed() + const embed = new MessageEmbed() .setAuthor({ name: guild.name, iconURL: guild.iconURL({ @@ -54,4 +62,6 @@ module.exports = class { embeds: [embed] }); } -}; \ No newline at end of file +} + +module.exports = GuildCreate; \ No newline at end of file diff --git a/events/guildDelete.js b/events/guildDelete.js index 63997e60..809bb25b 100644 --- a/events/guildDelete.js +++ b/events/guildDelete.js @@ -1,15 +1,19 @@ -const Discord = require("discord.js"); +const { MessageEmbed } = require("discord.js"), + BaseEvent = require("../base/BaseEvent"); -module.exports = class { - constructor(client) { - this.client = client; +class GuildDelete extends BaseEvent { + constructor() { + super({ + name: "guildDelete", + once: false + }); } - - async run(guild) { - const users = guild.members.cache.filter((m) => !m.user.bot).size; - const bots = guild.members.cache.filter((m) => m.user.bot).size; - - const embed = new Discord.MessageEmbed() + /** + * + * @param {import("discord.js").Guild} guild + */ + async execute(guild) { + const embed = new MessageEmbed() .setAuthor({ name: guild.name, iconURL: guild.iconURL({ @@ -17,9 +21,11 @@ module.exports = class { }) }) .setColor("#B22222") - .setDescription(`Π’Ρ‹ΡˆΠ΅Π» с сСрвСра **${guild.name}**. На Π½Ρ‘ΠΌ **${users}** ${this.client.getNoun(users, this.client.translate("misc:NOUNS:USERS:1"), this.client.translate("misc:NOUNS:USERS:2"), this.client.translate("misc:NOUNS:USERS:5"))} (ΠΈΠ· Π½ΠΈΡ… **${bots}** ${this.client.getNoun(bots, this.client.translate("misc:NOUNS:BOTS:1"), this.client.translate("misc:NOUNS:BOTS:2"), this.client.translate("misc:NOUNS:BOTS:5"))})`); + .setDescription(`Π’Ρ‹ΡˆΠ΅Π» с сСрвСра **${guild.name}**.`); this.client.channels.cache.get(this.client.config.support.logs).send({ embeds: [embed] }); } -}; \ No newline at end of file +} + +module.exports = GuildDelete; \ No newline at end of file diff --git a/events/guildMemberAdd.js b/events/guildMemberAdd.js index 914e11c6..4349bebc 100644 --- a/events/guildMemberAdd.js +++ b/events/guildMemberAdd.js @@ -1,5 +1,6 @@ const Canvas = require("canvas"), - Discord = require("discord.js"), + BaseEvent = require("../base/BaseEvent"), + { MessageAttachment } = require("discord.js"), { resolve } = require("path"); // Register assets fonts @@ -15,12 +16,19 @@ const applyText = (canvas, text, defaultFontSize, width, font) => { return ctx.font; }; -module.exports = class { - constructor(client) { - this.client = client; +class GuildMemberAdd extends BaseEvent { + constructor() { + super({ + name: "guildMemberAdd", + once: false + }); } - async run(member) { + /** + * + * @param {import("discord.js").GuildMember} member + */ + async execute(member) { if (member.guild && member.guild.id === "568120814776614924") return; await member.guild.members.fetch(); @@ -131,7 +139,7 @@ module.exports = class { })); ctx.drawImage(avatar, 45, 90, 270, 270); - const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "welcome-image.png"); + const attachment = new MessageAttachment(canvas.toBuffer(), "welcome-image.png"); channel.send({ content: message, files: [attachment] @@ -144,4 +152,6 @@ module.exports = class { } } } -}; \ No newline at end of file +} + +module.exports = GuildMemberAdd; \ No newline at end of file diff --git a/events/guildMemberRemove.js b/events/guildMemberRemove.js index a740747f..60760f10 100644 --- a/events/guildMemberRemove.js +++ b/events/guildMemberRemove.js @@ -1,5 +1,6 @@ const Canvas = require("canvas"), - Discord = require("discord.js"), + BaseEvent = require("../base/BaseEvent"), + { MessageAttachment } = require("discord.js"), { resolve } = require("path"); // Register assets fonts @@ -15,12 +16,19 @@ const applyText = (canvas, text, defaultFontSize, width, font) => { return ctx.font; }; -module.exports = class { - constructor(client) { - this.client = client; +class GuildMemberRemove extends BaseEvent { + constructor() { + super({ + name: "guildMemberRemove", + once: false + }); } - async run(member) { + /** + * + * @param {import("discord.js").GuildMember} member + */ + async execute(member) { if (member.guild && member.guild.id === "568120814776614924") return; await member.guild.members.fetch(); @@ -114,7 +122,7 @@ module.exports = class { })); ctx.drawImage(avatar, 45, 90, 270, 270); - const attachment = new Discord.MessageAttachment(canvas.toBuffer(), "goodbye-image.png"); + const attachment = new MessageAttachment(canvas.toBuffer(), "goodbye-image.png"); channel.send({ content: message, files: [attachment] @@ -127,4 +135,6 @@ module.exports = class { } } } -}; \ No newline at end of file +} + +module.exports = GuildMemberRemove; \ No newline at end of file diff --git a/events/guildMemberUpdate.js b/events/guildMemberUpdate.js index 509051dc..54699b86 100644 --- a/events/guildMemberUpdate.js +++ b/events/guildMemberUpdate.js @@ -1,9 +1,19 @@ -module.exports = class { - constructor(client) { - this.client = client; +const BaseEvent = require("../base/BaseEvent"); + +class GuildMemberUpdate extends BaseEvent { + constructor() { + super({ + name: "guildMemberRemove", + once: false + }); } - async run(oldMember, newMember) { + /** + * + * @param {import("discord.js").GuildMember} oldMember + * @param {import("discord.js").GuildMember} newMember + */ + async execute(oldMember, newMember) { if (oldMember.guild && oldMember.guild.id === "568120814776614924") return; if (oldMember.guild.id !== this.client.config.support.id) return; @@ -25,4 +35,6 @@ module.exports = class { }); } } -}; \ No newline at end of file +} + +module.exports = GuildMemberUpdate; \ No newline at end of file diff --git a/events/messageCreate.js b/events/messageCreate.js index c01a06e8..91b70020 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -1,26 +1,32 @@ const { Permissions } = require("discord.js"), xpCooldown = {}, - cmdCooldown = {}; + BaseEvent = require("../base/BaseEvent"); -module.exports = class { - constructor(client) { - this.client = client; +class MessageCreate extends BaseEvent { + constructor() { + super({ + name: "messageCreate", + once: false + }); } - async run(message) { + /** + * + * @param {import("../base/JaBa")} client + * @param {import("discord.js").Message} message + */ + async execute(client, message) { if (message.guild && message.guild.id === "568120814776614924") return; if (message.content.includes("no bitches")) message.reply({ files: [{ name: "b.png", attachment: "./assets/img/b.png" }] }); if (message.content.includes("bitches") && !message.content.includes("no bitches")) message.reply({ files: [{ name: "nob.png", attachment: "./assets/img/nob.png" }] }); const data = {}; + data.config = client.config; if (message.author.bot) return; if (message.guild && !message.member) await message.guild.members.fetch(message.author.id); - const client = this.client; - data.config = client.config; - if (message.guild) { const guild = await client.findOrCreateGuild({ id: message.guild.id @@ -28,10 +34,7 @@ module.exports = class { message.guild.data = data.guild = guild; } - if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) { - if (message.guild) return message.sendT("misc:HELLO_SERVER", { username: message.author.username, prefix: data.guild.prefix }); - else return message.sendT("misc:HELLO_DM"); - } + if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) return message.sendT("misc:HELLO_SERVER", { username: message.author.username }); if (message.guild) { const memberData = await client.findOrCreateMember({ @@ -49,31 +52,6 @@ module.exports = class { if (message.guild) { await updateXp(client, message, data); - if (!message.channel.permissionsFor(message.member).has(Permissions.FLAGS.MANAGE_MESSAGES) && !message.editedAt) { - const channelSlowmode = data.guild.slowmode.channels.find((ch) => ch.id === message.channel.id); - if (channelSlowmode) { - const uSlowmode = data.guild.slowmode.users.find((d) => d.id === (message.author.id + message.channel.id)); - if (uSlowmode) { - if (uSlowmode.time > Date.now()) { - message.delete(); - return message.author.send(message.translate("administration/slowmode:PLEASE_WAIT", { - time: message.convertTime(uSlowmode.time, "to", true), - channel: message.channel.toString() - })); - } else { - uSlowmode.time = channelSlowmode.time + Date.now(); - } - } else { - data.guild.slowmode.users.push({ - id: message.author.id + message.channel.id, - time: channelSlowmode.time + Date.now() - }); - } - data.guild.markModified("slowmode.users"); - await data.guild.save(); - } - } - if (data.guild.plugins.automod.enabled && !data.guild.plugins.automod.ignored.includes(message.channel.id)) { if (/(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(message.content)) { if (!message.channel.permissionsFor(message.member).has(Permissions.FLAGS.MANAGE_MESSAGES)) { @@ -102,109 +80,9 @@ module.exports = class { if (userData.afk) message.error("general/setafk:IS_AFK", { user: u.tag, reason: userData.afk }); }); } - - const prefix = client.functions.getPrefix(message, data); - if (!prefix) return; - - const args = message.content.slice((typeof prefix === "string" ? prefix.length : 0)).trim().split(/ +/g); - const command = args.shift().toLowerCase(); - const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command)); - - const customCommand = message.guild ? data.guild.customCommands.find((c) => c.name === command) : null; - const customCommandAnswer = customCommand ? customCommand.answer : ""; - - if (!cmd && !customCommandAnswer && message.guild) return; - else if (!cmd && !customCommandAnswer && !message.guild) return message.sendT("misc:HELLO_DM"); - - if (message.guild && data.guild.ignoredChannels.includes(message.channel.id) && !message.member.permissions.has(Permissions.FLAGS.MANAGE_MESSAGES)) { - message.delete(); - return message.author.send(message.translate("misc:RESTRICTED_CHANNEL", { - channel: message.channel.toString() - })); - } - - if (customCommandAnswer) return message.channel.send({ content: customCommandAnswer.replace("{user}", message.author).replace("{guild}", message.guild) }); - if (cmd.conf.guildOnly && !message.guild) return message.error("misc:GUILD_ONLY"); - - if (message.guild) { - let neededPermissions = []; - if (!cmd.conf.botPermissions.includes("EMBED_LINKS")) cmd.conf.botPermissions.push("EMBED_LINKS"); - - cmd.conf.botPermissions.forEach((perm) => { - if (!message.channel.permissionsFor(message.guild.me).has(perm)) neededPermissions.push(perm); - }); - - if (neededPermissions.length > 0) return message.error("misc:MISSING_BOT_PERMS", { list: neededPermissions.map((p) => `\`${p}\``).join(", ") }); - - neededPermissions = []; - cmd.conf.memberPermissions.forEach((perm) => { - if (!message.channel.permissionsFor(message.member).has(perm)) neededPermissions.push(perm); - }); - - if (neededPermissions.length > 0) return message.error("misc:MISSING_MEMBER_PERMS", { list: neededPermissions.map((p) => `\`${message.translate(`misc:PERMISSIONS:${p}`)}\``).join(", ") }); - if (!message.channel.permissionsFor(message.member).has(Permissions.FLAGS.MENTION_EVERYONE) && (message.content.includes("@everyone") || message.content.includes("@here"))) return message.error("misc:EVERYONE_MENTION"); - if (!message.channel.nsfw && cmd.conf.nsfw) return message.error("misc:NSFW_COMMAND"); - } - - if (!cmd.conf.enabled) return message.error("misc:COMMAND_DISABLED"); - if (cmd.conf.ownerOnly && message.author.id !== client.config.owner.id) return message.error("misc:OWNER_ONLY"); - - let uCooldown = cmdCooldown[message.author.id]; - if (!uCooldown) { - cmdCooldown[message.author.id] = {}; - uCooldown = cmdCooldown[message.author.id]; - } - - const time = uCooldown[cmd.help.name] || 0; - if (time && (time > Date.now())) { - const seconds = Math.ceil((time - Date.now()) / 1000); - return message.error("misc:COOLDOWNED", { seconds: `${seconds} ${client.getNoun(seconds, message.translate("misc:NOUNS:SECONDS:1"), message.translate("misc:NOUNS:SECONDS:2"), message.translate("misc:NOUNS:SECONDS:5"))}` }); - } - - cmdCooldown[message.author.id][cmd.help.name] = Date.now() + cmd.conf.cooldown; - - client.logger.log(`${message.author.username} (${message.author.id}) ran command ${cmd.help.name} ${message.guild ? `on ${message.guild.name}` : "in DM"}`, "cmd"); - - const log = new this.client.logs({ - commandName: cmd.help.name, - author: { - username: message.author.username, - discriminator: message.author.discriminator, - id: message.author.id - }, - guild: { - name: message.guild ? message.guild.name : "dm", - id: message.guild ? message.guild.id : "dm" - } - }); - log.save(); - - if (!data.userData.achievements.firstCommand.achieved) { - data.userData.achievements.firstCommand.progress.now = 1; - data.userData.achievements.firstCommand.achieved = true; - data.userData.markModified("achievements.firstCommand"); - await data.userData.save(); - await message.reply({ - files: [{ - name: "achievement_unlocked2.png", - attachment: "./assets/img/achievements/achievement_unlocked2.png" - }] - }); - } - - try { - cmd.run(message, args, data); - if (cmd.help.category === "Moderation" && data.guild.autoDeleteModCommands) { - setTimeout(() => { - if (message.deletable) message.delete(); - }, 3000); - } - } catch (e) { - console.error(e); - return message.error("misc:ERR_OCCURRED"); - } + return; } -}; +} async function updateXp(client, msg, data) { const points = parseInt(data.memberData.exp); @@ -225,4 +103,6 @@ async function updateXp(client, msg, data) { data.memberData.exp = parseInt(newXp, 10); await data.memberData.save(); -} \ No newline at end of file +} + +module.exports = MessageCreate; \ No newline at end of file diff --git a/events/messageUpdate.js b/events/messageUpdate.js deleted file mode 100644 index 4c876a82..00000000 --- a/events/messageUpdate.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = class { - constructor(client) { - this.client = client; - } - - async run(oldMessage, newMessage) { - if (!newMessage.editedAt) return; - this.client.emit("messageCreate", newMessage); - } -}; \ No newline at end of file diff --git a/events/ready.js b/events/ready.js index 60a71937..4a23594e 100644 --- a/events/ready.js +++ b/events/ready.js @@ -1,18 +1,25 @@ -const { Permissions } = require("discord.js"); +const BaseEvent = require("../base/BaseEvent"), + { Permissions } = require("discord.js"); -module.exports = class { - constructor(client) { - this.client = client; +class Ready extends BaseEvent { + constructor() { + super({ + name: "ready", + once: false + }); } - - async run() { - const client = this.client; + /** + * + * @param {import("../base/JaBa")} client + */ + async execute(client) { + const commands = [...new Map(client.commands.map(v => [v.constructor.name, v])).values()]; let hiddenGuild = await client.guilds.fetch("568120814776614924"); let tUsers = client.users.cache.size - hiddenGuild.memberCount; let tServers = client.guilds.cache.size - 1; // Logs some informations using logger - client.logger.log(`Loading a total of ${client.commands.size} command(s).`, "log"); + client.logger.log(`Loaded a total of ${commands.length} command(s).`, "log"); client.logger.log(`${client.user.tag}, ready to serve ${tUsers} users in ${tServers} servers.`, "ready"); client.logger.log(`Invite Link: ${client.generateInvite({ scopes: ["bot", "applications.commands"] , permissions: [Permissions.FLAGS.ADMINISTRATOR] })}`, "ready"); @@ -24,10 +31,6 @@ module.exports = class { const birthdays = require("../helpers/birthdays"); birthdays.init(client); - // DiscordBots.org STATS - const discordbotsorg = require("../helpers/discordbots.org"); - discordbotsorg.init(client); - // Unmute users const checkUnmutes = require("../helpers/checkUnmutes"); checkUnmutes.init(client); @@ -47,7 +50,7 @@ module.exports = class { const version = require("../package.json").version; const status = [ { name: "help", type: "LISTENING" }, - { name: `${client.commands.size} ${client.getNoun(client.commands.size, client.translate("misc:NOUNS:COMMANDS:1"), client.translate("misc:NOUNS:COMMANDS:2"), client.translate("misc:NOUNS:COMMANDS:5"))}`, type: "LISTENING"}, + { name: `${commands.length} ${client.getNoun(commands.length, client.translate("misc:NOUNS:COMMANDS:1"), client.translate("misc:NOUNS:COMMANDS:2"), client.translate("misc:NOUNS:COMMANDS:5"))}`, type: "LISTENING"}, { name: `${tServers} ${client.getNoun(tServers, client.translate("misc:NOUNS:SERVER:1"), client.translate("misc:NOUNS:SERVER:2"), client.translate("misc:NOUNS:SERVER:5"))}`, type: "WATCHING" }, { name: `${tUsers} ${client.getNoun(tUsers, client.translate("misc:NOUNS:USERS:1"), client.translate("misc:NOUNS:USERS:2"), client.translate("misc:NOUNS:USERS:5"))}`, type: "WATCHING" } ]; @@ -65,6 +68,8 @@ module.exports = class { if (status[parseInt(i + 1, 10)]) i++; else i = 0; - }, 20000); // Every 20 seconds + }, 10 * 1000); // Every 10 seconds } -}; \ No newline at end of file +} + +module.exports = Ready; \ No newline at end of file diff --git a/helpers/discordbots.org.js b/helpers/discordbots.org.js deleted file mode 100644 index 3f7f7ae9..00000000 --- a/helpers/discordbots.org.js +++ /dev/null @@ -1,41 +0,0 @@ -const DBL = require("dblapi.js"); - -/* THIS POSTS STATS TO DISCORDBOTS.ORG */ -module.exports = { - /** - * Starts to post stats to DBL - * @param {object} client The Discord Client instance - */ - init(client) { - if (client.config.apiKeys.dbl && client.config.apiKeys.dbl !== "") { - const stats = new DBL(client.config.apiKeys.dbl, client); - setInterval(function () { - stats.postStats(client.guilds.cache.size); - }, 10 * 60000); // every 10 minutes - const dbl = new DBL(client.config.apiKeys.dbl, { - webhookPort: client.config.votes.port, - webhookAuth: client.config.votes.password - }); - dbl.webhook.on("vote", async (vote) => { - const dUser = await client.users.fetch(vote.user); - const member = await client.findOrCreateMember({ - id: vote.user, - guildID: client.config.support.id - }); - member.money = member.money + 50; - member.save(); - dUser.send(client.translate("misc:VOTE_DM", { - user: dUser.tag - })).catch(() => {}); - const logsChannel = client.channels.cache.get(client.config.votes.channel); - - if (logsChannel) logsChannel.send({ - content: client.translate("misc:VOTE_LOGS", { - userid: dUser.id, - usertag: dUser.tag - }) - }); - }); - } - } -}; \ No newline at end of file diff --git a/helpers/extenders.js b/helpers/extenders.js index 91e6b540..46c372bf 100644 --- a/helpers/extenders.js +++ b/helpers/extenders.js @@ -1,8 +1,7 @@ -const { Guild, Message, MessageEmbed } = require("discord.js"); -const config = require("../config"); +const { Guild, Message } = require("discord.js"); Guild.prototype.translate = function (key, args) { - const language = this.client.translations.get(this.data.language); + const language = this.client.translations.get(this.guild ? this.guild.data.language : "ru-RU"); if (!language) throw "Message: Invalid language set in data."; return language(key, args); @@ -50,22 +49,4 @@ Message.prototype.convertTime = function (time, type, noPrefix) { Message.prototype.getNoun = function (number, one, two, five) { return this.client.getNoun(number, one, two, five); -}; - -MessageEmbed.prototype.errorColor = function () { - this.setColor("#FF0000"); - - return this; -}; - -MessageEmbed.prototype.successColor = function () { - this.setColor("#32CD32"); - - return this; -}; - -MessageEmbed.prototype.defaultColor = function () { - this.setColor(config.color); - - return this; }; \ No newline at end of file diff --git a/index.js b/index.js index ed1eb7e5..f5aadc0c 100644 --- a/index.js +++ b/index.js @@ -1,74 +1,21 @@ require("./helpers/extenders"); -const util = require("util"), - fs = require("fs"), - readdir = util.promisify(fs.readdir), - mongoose = require("mongoose"), - { Intents } = require("discord.js"); +const { Intents } = require("discord.js"), + JaBa = require("./base/JaBa"); -// Load JaBa class -const JaBa = require("./base/JaBa"); const client = new JaBa({ - intents: [ - Intents.FLAGS.GUILDS, - Intents.FLAGS.GUILD_MEMBERS, - Intents.FLAGS.GUILD_BANS, - Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS, - Intents.FLAGS.GUILD_INVITES, - Intents.FLAGS.GUILD_VOICE_STATES, - Intents.FLAGS.GUILD_PRESENCES, - Intents.FLAGS.GUILD_MESSAGES, - Intents.FLAGS.GUILD_MESSAGE_REACTIONS, - Intents.FLAGS.GUILD_MESSAGE_TYPING, - Intents.FLAGS.DIRECT_MESSAGES, - ], - partials: ["CHANNEL"] + intents: Object.keys(Intents.FLAGS), + allowedMentions: { parse: ["everyone", "roles", "users"] } }); -const init = async () => { - const directories = await readdir("./commands/"); - client.logger.log(`Loading a total of ${directories.length} categories.`, "log"); - directories.forEach(async (dir) => { - const commands = await readdir(`./commands/${dir}/`); - commands.filter((cmd) => cmd.split(".").pop() === "js").forEach((cmd) => { - const response = client.loadCommand(`./commands/${dir}`, cmd); - if (response) client.logger.log(response, "error"); - }); - }); - - const evtFiles = await readdir("./events/"); - client.logger.log(`Loading a total of ${evtFiles.length} events.`, "log"); - evtFiles.forEach((file) => { - const eventName = file.split(".")[0]; - client.logger.log(`Loading Event: ${eventName}`); - const event = new(require(`./events/${file}`))(client); - client.on(eventName, (...args) => event.run(...args)); - delete require.cache[require.resolve(`./events/${file}`)]; - }); - - client.login(client.config.token); - - mongoose.connect(client.config.mongoDB, { - useNewUrlParser: true, - useUnifiedTopology: true - }).then(() => { - client.logger.log("Connected to the Mongodb database.", "log"); - }).catch((err) => { - client.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error"); - }); - - const languages = require("./helpers/languages"); - client.translations = await languages(); - - const autoUpdateDocs = require("./helpers/autoUpdateDocs"); - autoUpdateDocs.update(client); -}; - -init(); +(async () => { + await client.loadEvents("../events"); + await client.loadCommands("../commands", client.config.support.enabled ? client.config.support.id : ""); + await client.init(); +})(); client.on("disconnect", () => client.logger.log("Bot is disconnecting...", "warn")) .on("reconnecting", () => client.logger.log("Bot reconnecting...", "log")) .on("error", (e) => client.logger.log(e, "error")) .on("warn", (info) => client.logger.log(info, "warn")); - process.on("unhandledRejection", (err) => console.error(err)); \ No newline at end of file diff --git a/languages/en-US/administration/slowmode.json b/languages/en-US/administration/slowmode.json deleted file mode 100644 index 46723a8b..00000000 --- a/languages/en-US/administration/slowmode.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "DESCRIPTION": "Set a channel cooldown", - "USAGE": "{{prefix}}slowmode [#channel] (time)", - "EXAMPLES": "{{prefix}}slowmode #general 10m\n{{prefix}}slowmode #general", - "DISABLED": "**Slow-mode has just been disabled in {{channel}}!**\n\n:arrow_right_hook: *Send `{{prefix}}slowmode [#channel] (time)` to enable it again!*", - "ENABLED": "**A slow-mode of `{{time}}` has just been enabled in `{{channel}}`!**\n\n:arrow_right_hook: *Send `{{prefix}}slowmode {{channel}}` to disable it!*", - "PLEASE_WAIT": "Channel {{channel}} is in slowmode! Please wait {{time}} between each message!" -} \ No newline at end of file diff --git a/languages/language-meta.json b/languages/language-meta.json index 00f92daa..b61bcd66 100644 --- a/languages/language-meta.json +++ b/languages/language-meta.json @@ -4,27 +4,12 @@ "nativeName": "Русский", "moment": "ru", "defaultMomentFormat": "Do MMMM YYYY", - "default": true, - "aliases": [ - "Русский", - "ru", - "ru-ru", - "ru_ru", - "ru_RU" - ] + "default": true }, { "name": "uk-UA", "nativeName": "Π£ΠΊΡ€Π°Ρ—Π½ΡΡŒΠΊΠ°", "moment": "uk", - "defaultMomentFormat": "Do MMMM YYYY", - "default": false, - "aliases": [ - "Украинский", - "uk", - "uk-ua", - "uk_ua", - "uk_UA" - ] + "defaultMomentFormat": "Do MMMM YYYY" } ] \ No newline at end of file diff --git a/languages/ru-RU/administration/slowmode.json b/languages/ru-RU/administration/slowmode.json deleted file mode 100644 index c97e8942..00000000 --- a/languages/ru-RU/administration/slowmode.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "DESCRIPTION": "Π’ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ ΠΌΠ΅Π΄Π»Π΅Π½Π½Ρ‹ΠΉ Ρ€Π΅ΠΆΠΈΠΌ Π² ΠΊΠ°Π½Π°Π»Π΅", - "USAGE": "{{prefix}}slowmode [#ΠΊΠ°Π½Π°Π»] (врСмя)", - "EXAMPLES": "{{prefix}}slowmode #основной 10m\n{{prefix}}slowmode #основной", - "DISABLED": "**ΠœΠ΅Π΄Π»Π΅Π½Π½Ρ‹ΠΉ Ρ€Π΅ΠΆΠΈΠΌ Π±Ρ‹Π» Π²Ρ‹ΠΊΠ»ΡŽΡ‡Π΅Π½ Π² ΠΊΠ°Π½Π°Π»Π΅ {{channel}}!**\n\n:arrow_right_hook: *ΠžΡ‚ΠΏΡ€Π°Π²ΡŒΡ‚Π΅ `{{prefix}}slowmode [#ΠΊΠ°Π½Π°Π»] (врСмя)`, Ρ‡Ρ‚ΠΎΠ±Ρ‹ снова Π²ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ ΠΌΠ΅Π΄Π»Π΅Π½Π½Ρ‹ΠΉ Ρ€Π΅ΠΆΠΈΠΌ!*", - "ENABLED": "**ΠœΠ΅Π΄Π»Π΅Π½Π½Ρ‹ΠΉ Ρ€Π΅ΠΆΠΈΠΌ Π² `{{time}}` установлСн Π² ΠΊΠ°Π½Π°Π»Π΅ `{{channel}}`!**\n\n:arrow_right_hook: *ΠžΡ‚ΠΏΡ€Π°Π²ΡŒΡ‚Π΅ `{{prefix}}slowmode {{channel}}`, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΠΎΡ‚ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ!*", - "PLEASE_WAIT": "Π’ ΠΊΠ°Π½Π°Π»Π΅ {{channel}} Π²ΠΊΠ»ΡŽΡ‡Ρ‘Π½ ΠΌΠ΅Π΄Π»Π΅Π½Π½Ρ‹ΠΉ Ρ€Π΅ΠΆΠΈΠΌ! ΠŸΠΎΠ΄ΠΎΠΆΠ΄ΠΈΡ‚Π΅ {{time}} ΠΏΠ΅Ρ€Π΅Π΄ ΠΎΡ‚ΠΏΡ€Π°Π²ΠΊΠΎΠΉ ΡΠ»Π΅Π΄ΡƒΡŽΡ‰Π΅Π³ΠΎ сообщСния!" -} \ No newline at end of file diff --git a/languages/ru-RU/misc.json b/languages/ru-RU/misc.json index 209d395c..4a249aae 100644 --- a/languages/ru-RU/misc.json +++ b/languages/ru-RU/misc.json @@ -17,8 +17,7 @@ "NO_USER_FOUND_ID": "ΠŸΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Ρ с ID `{{id}}` Π½Π΅ сущСствуСт!", "VOTE_DM": "⬆️ ΠŸΡ€ΠΈΠ²Π΅Ρ‚, {{user}}, спасибо Π·Π° голос!\nВвоя Π½Π°Π³Ρ€Π°Π΄Π° - 50 ΠΊΡ€Π΅Π΄ΠΈΡ‚ΠΎΠ² (Π½Π° сСрвСрС ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠΈ)!", "VOTE_LOGS": "⬆️ **{{usertag}}** (`{{userid}}`) проголосовал Π·Π° **JaBa** ΠΈ ΠΏΠΎΠ»ΡƒΡ‡ΠΈΠ» **50** ΠΊΡ€Π΅Π΄ΠΈΡ‚ΠΎΠ², спасибо!\n", - "HELLO_SERVER": "ΠŸΡ€ΠΈΠ²Π΅Ρ‚, **{{username}}**, ΠΌΠΎΠΉ прСфикс Π½Π° Π΄Π°Π½Π½ΠΎΠΌ сСрвСрС - `{{prefix}}`. Π˜ΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ `{{prefix}}help`, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΠΏΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ список ΠΊΠΎΠΌΠ°Π½Π΄!", - "HELLO_DM": "ΠŸΡ€ΠΈΠ²Π΅Ρ‚, Ρ‚Π°ΠΊ ΠΊΠ°ΠΊ Π²Ρ‹ ΠΏΠΈΡˆΠΈΡ‚Π΅ Π² Π›Π‘, Π²Π°ΠΌ Π½Π΅ Π½ΡƒΠΆΠ½ΠΎ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ прСфикс.", + "HELLO_SERVER": "ΠŸΡ€ΠΈΠ²Π΅Ρ‚, **{{username}}**! ВсС ΠΌΠΎΠΈ ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹ доступны Ρ‡Π΅Ρ€Π΅Π· **/** Π˜ΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ `/help`, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΠΏΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ список ΠΊΠΎΠΌΠ°Π½Π΄!", "GUILD_ONLY": "Π”Π°Π½Π½ΡƒΡŽ ΠΊΠΎΠΌΠ°Π½Π΄Ρƒ ΠΌΠΎΠΆΠ½ΠΎ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Π½Π° сСрвСрС!", "MISSING_BOT_PERMS": "МнС Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΡ‹ ΡΠ»Π΅Π΄ΡƒΡŽΡ‰ΠΈΠ΅ ΠΏΡ€Π°Π²Π° для выполнСния Π΄Π°Π½Π½ΠΎΠΉ ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹: {{list}}", "MISSING_MEMBER_PERMS": "Π’Π°ΠΌ Π½Π΅ΠΎΠ±Ρ…ΠΎΠ΄ΠΈΠΌΡ‹ ΡΠ»Π΅Π΄ΡƒΡŽΡ‰ΠΈΠ΅ ΠΏΡ€Π°Π²Π° для выполнСния Π΄Π°Π½Π½ΠΎΠΉ ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹: {{list}}", diff --git a/languages/ru-RU/music/createplaylist.json b/languages/ru-RU/music/createplaylist.json deleted file mode 100644 index 2b8d3595..00000000 --- a/languages/ru-RU/music/createplaylist.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "DESCRIPTION": "Π‘ΠΎΠ·Π΄Π°Ρ‚ΡŒ плСйлист", - "USAGE": "{{prefix}}createplaylist [Π½Π°Π·Π²Π°Π½ΠΈΠ΅] | [ссылки Π½Π° Ρ‚Ρ€Π΅ΠΊΠΈ/трансляции]", - "EXAMPLES": "{{prefix}}createplaylist Мой ΠΊΡ€ΡƒΡ‚ΠΎΠΉ плСйлист | https://www.youtube.com/watch?v=dQw4w9WgXcQ https://www.youtube.com/watch?v=MEg-oqI9qmw", - "NO_NAME": "Π£ΠΊΠ°ΠΆΠΈΡ‚Π΅ Π½Π°Π·Π²Π°Π½ΠΈΠ΅ плСйлиста!", - "NO_SONGS": "Π£ΠΊΠ°ΠΆΠΈΡ‚Π΅ ссылки(Ρƒ) Π½Π° Ρ‚Ρ€Π΅ΠΊΠΈ/трансляции!", - "CREATED": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚ `{{name}}` сохранён!" -} \ No newline at end of file diff --git a/languages/ru-RU/music/playlists.json b/languages/ru-RU/music/playlists.json deleted file mode 100644 index 8f12b606..00000000 --- a/languages/ru-RU/music/playlists.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "DESCRIPTION": "ΠŸΠΎΡΠΌΠΎΡ‚Ρ€Π΅Ρ‚ΡŒ список Π²Π°ΡˆΠΈΡ… плСйлистов", - "USAGE": "{{prefix}}playlists (Π½Π°Π·Π²Π°Π½ΠΈΠ΅)", - "EXAMPLES": "{{prefix}}playlists\n{{prefix}}playlists Мой ΠΊΡ€ΡƒΡ‚ΠΎΠΉ плСйлист", - "EMBED_TITLE": "Бписок плСйлистов", - "EMBED_TITLE2": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚ \"{{name}}\"", - "NO_PLAYLISTS": "Π£ вас Π½Π΅Ρ‚ плСйлистов!", - "PLAYLISTS": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚Ρ‹", - "NAME": "НазваниС", - "COUNT": "ΠšΠΎΠ»ΠΈΡ‡Π΅ΡΡ‚Π²ΠΎ Ρ‚Ρ€Π΅ΠΊΠΎΠ²", - "SONGS": "Π’Ρ€Π΅ΠΊΠΈ Π² плСйлистС" -} \ No newline at end of file diff --git a/languages/ru-RU/music/playplaylist.json b/languages/ru-RU/music/playplaylist.json deleted file mode 100644 index 2d62ae0d..00000000 --- a/languages/ru-RU/music/playplaylist.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "DESCRIPTION": "ВоспроизвСсти плСйлист", - "USAGE": "{{prefix}}playplaylist [Π½Π°Π·Π²Π°Π½ΠΈΠ΅]", - "EXAMPLES": "{{prefix}}playplaylist Мой ΠΊΡ€ΡƒΡ‚ΠΎΠΉ плСйлист" -} \ No newline at end of file diff --git a/languages/ru-RU/music/removeplaylist.json b/languages/ru-RU/music/removeplaylist.json deleted file mode 100644 index 244a39c1..00000000 --- a/languages/ru-RU/music/removeplaylist.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "DESCRIPTION": "Π£Π΄Π°Π»ΠΈΡ‚ΡŒ плСйлист", - "USAGE": "{{prefix}}removeplaylist [Π½Π°Π·Π²Π°Π½ΠΈΠ΅]", - "EXAMPLES": "{{prefix}}removeplaylist Мой ΠΊΡ€ΡƒΡ‚ΠΎΠΉ плСйлист", - "NO_NAME": "Π£ΠΊΠ°ΠΆΠΈΡ‚Π΅ Π½Π°Π·Π²Π°Π½ΠΈΠ΅ плСйлиста!", - "REMOVED": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚ `{{name}}` ΡƒΠ΄Π°Π»Ρ‘Π½!", - "NOT_FOUND": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚ `{{name}}` Π½Π΅ Π½Π°ΠΉΠ΄Π΅Π½!" -} \ No newline at end of file diff --git a/languages/uk-UA/administration/slowmode.json b/languages/uk-UA/administration/slowmode.json deleted file mode 100644 index a1541abe..00000000 --- a/languages/uk-UA/administration/slowmode.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "DESCRIPTION": "Π£Π²Ρ–ΠΌΠΊΠ½ΡƒΡ‚ΠΈ ΠΏΠΎΠ²Ρ–Π»ΡŒΠ½ΠΈΠΉ Ρ€Π΅ΠΆΠΈΠΌ Ρƒ ΠΊΠ°Π½Π°Π»Ρ–", - "USAGE": "{{prefix}}slowmode [#ΠΊΠ°Π½Π°Π»] (час)", - "EXAMPLES": "{{prefix}}slowmode #основний 10m\n{{prefix}}slowmode #основний", - "DISABLED": "**ΠŸΠΎΠ²Ρ–Π»ΡŒΠ½ΠΈΠΉ Ρ€Π΅ΠΆΠΈΠΌ Π±ΡƒΠ² Π²ΠΈΠΌΠΊΠ½Π΅Π½ΠΈΠΉ Ρƒ {{channel}}!**\n\n:arrow_right_hook: *Надіслати `{{prefix}}slowmode [#ΠΊΠ°Π½Π°Π»] (час)`, Ρ‰ΠΎΠ± Π·Π½ΠΎΠ²Ρƒ Π²Π²Ρ–ΠΌΠΊΠ½ΡƒΡ‚ΠΈ ΠΏΠΎΠ²Ρ–Π»ΡŒΠ½ΠΈΠΉ Ρ€Π΅ΠΆΠΈΠΌ!*", - "ENABLED": "**ΠŸΠΎΠ²Ρ–Π»ΡŒΠ½ΠΈΠΉ Ρ€Π΅ΠΆΠΈΠΌ Π² `{{time}}` встановлСний Ρƒ ΠΊΠ°Π½Π°Π»Ρ– `{{channel}}`!**\n\n:arrow_right_hook: *ΠΠ°Π΄Ρ–ΡˆΠ»Ρ–Ρ‚ΡŒ `{{prefix}}slowmode {{channel} }`, Ρ‰ΠΎΠ± Π²ΠΈΠΌΠΊΠ½ΡƒΡ‚ΠΈ!*", - "PLEASE_WAIT": "Π£ {{channel}} ΡƒΠ²Ρ–ΠΌΠΊΠ½Π΅Π½ΠΎ ΠΏΠΎΠ²Ρ–Π»ΡŒΠ½ΠΈΠΉ Ρ€Π΅ΠΆΠΈΠΌ! Π—Π°Ρ‡Π΅ΠΊΠ°ΠΉΡ‚Π΅ {{time}} ΠΏΠ΅Ρ€Π΅Π΄ надсиланням наступного повідомлСння!" -} \ No newline at end of file diff --git a/languages/uk-UA/music/createplaylist.json b/languages/uk-UA/music/createplaylist.json deleted file mode 100644 index aa597752..00000000 --- a/languages/uk-UA/music/createplaylist.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "DESCRIPTION": "Π‘Ρ‚Π²ΠΎΡ€ΠΈΡ‚ΠΈ плСйлист", - "USAGE": "{{prefix}}createplaylist [Π½Π°Π·Π²Π°] | [посилання Π½Π° Ρ‚Ρ€Π΅ΠΊΠΈ/трансляції]", - "EXAMPLES": "{{prefix}}createplaylist ΠœΡ–ΠΉ ΠΊΡ€ΡƒΡ‚ΠΈΠΉ плСйлист | https://www.youtube.com/watch?v=dQw4w9WgXcQ https://www.youtube.com/watch?v=MEg-oqI9qmw", - "NO_NAME": "Π’ΠΊΠ°ΠΆΡ–Ρ‚ΡŒ Π½Π°Π·Π²Ρƒ плСйлиста!", - "NO_SONGS": "Π’ΠΊΠ°ΠΆΡ–Ρ‚ΡŒ посилання Π½Π° Ρ‚Ρ€Π΅ΠΊΠΈ/трансляції!", - "CREATED": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚ `{{name}}` Π·Π±Π΅Ρ€Π΅ΠΆΠ΅Π½ΠΈΠΉ!" -} \ No newline at end of file diff --git a/languages/uk-UA/music/playlists.json b/languages/uk-UA/music/playlists.json deleted file mode 100644 index 3f86fb20..00000000 --- a/languages/uk-UA/music/playlists.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "DESCRIPTION": "ΠŸΠΎΠ΄ΠΈΠ²ΠΈΡ‚ΠΈΡΡ список Π²Π°ΡˆΠΈΡ… плСйлистів", - "USAGE": "{{prefix}}playlists (Π½Π°Π·Π²Π°)", - "EXAMPLES": "{{prefix}}playlists\n{{prefix}}playlists ΠœΡ–ΠΉ ΠΊΡ€ΡƒΡ‚ΠΈΠΉ плСйлист", - "EMBED_TITLE": "Бписок плСйлистів", - "EMBED_TITLE2": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚ \"{{name}}\"", - "NO_PLAYLISTS": "Π£ вас Π½Π΅ΠΌΠ°Ρ” плСйлистів!", - "PLAYLISTS": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚ΠΈ", - "NAME": "Назва", - "COUNT": "ΠšΡ–Π»ΡŒΠΊΡ–ΡΡ‚ΡŒ Ρ‚Ρ€Π΅ΠΊΡ–Π²", - "SONGS": "Π’Ρ€Π΅ΠΊΠΈ Π² плСйлисті" -} \ No newline at end of file diff --git a/languages/uk-UA/music/playplaylist.json b/languages/uk-UA/music/playplaylist.json deleted file mode 100644 index 0442201c..00000000 --- a/languages/uk-UA/music/playplaylist.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "DESCRIPTION": "Π’Ρ–Π΄Ρ‚Π²ΠΎΡ€ΠΈΡ‚ΠΈ плСйлист", - "USAGE": "{{prefix}}playplaylist [Π½Π°Π·Π²Π°]", - "EXAMPLES": "{{prefix}}playplaylist ΠœΡ–ΠΉ ΠΊΡ€ΡƒΡ‚ΠΈΠΉ плСйлист" -} \ No newline at end of file diff --git a/languages/uk-UA/music/removeplaylist.json b/languages/uk-UA/music/removeplaylist.json deleted file mode 100644 index d10fabbb..00000000 --- a/languages/uk-UA/music/removeplaylist.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "DESCRIPTION": "Π’ΠΈΠ΄Π°Π»ΠΈΡ‚ΠΈ плСйлист", - "USAGE": "{{prefix}}removeplaylist [Π½Π°Π·Π²Π°]", - "EXAMPLES": "{{prefix}}removeplaylist ΠœΡ–ΠΉ ΠΊΡ€ΡƒΡ‚ΠΈΠΉ плСйлист", - "NO_NAME": "Π’ΠΊΠ°ΠΆΡ–Ρ‚ΡŒ Π½Π°Π·Π²Ρƒ плСйлиста!", - "REMOVED": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚ `{{name}}` Π²ΠΈΠ΄Π°Π»Π΅Π½ΠΈΠΉ!", - "NOT_FOUND": "ΠŸΠ»Π΅ΠΉΠ»ΠΈΡΡ‚ `{{name}}` Π½Π΅ Π·Π½Π°ΠΉΠ΄Π΅Π½ΠΎ!" -} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 8629d2a7..beeda0de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,17 @@ { "name": "jaba", - "version": "4.0", + "version": "TEST", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "jaba", - "version": "4.0", + "version": "TEST", "license": "ISC", "dependencies": { + "@discordjs/builders": "^1.0.0", "@discordjs/opus": "^0.7.0", + "@discordjs/rest": "^1.0.0", "@discordjs/voice": "^0.10.0", "@distube/soundcloud": "^1.2.1", "@distube/spotify": "^1.3.2", @@ -25,11 +27,12 @@ "colors-generator": "^0.3.4", "cron": "^1.7.2", "dblapi.js": "^2.3.0", + "discord-api-types": "^0.36.3", "discord-backup": "^3.2.1", "discord-giveaways": "github:Androz2091/discord-giveaways#develop", "discord-paginationembed": "github:gazmull/discord-paginationembed#v3", "discord-together": "^1.3.3", - "discord.js": "^13.8.0", + "discord.js": "^13.8.1", "distube": "^3.3.4", "ejs": "^3.1.3", "express": "^4.17.1", @@ -41,7 +44,6 @@ "i18next-node-fs-backend": "^2.1.3", "js-string-cleaner": "^1.0.3", "libsodium-wrappers": "^0.7.9", - "lyrics-finder": "^21.7.0", "markdown-table": "2.0.0", "mathjs": "^9.0.0", "md5": "^2.2.1", @@ -196,13 +198,12 @@ } }, "node_modules/@discordjs/builders": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.14.0.tgz", - "integrity": "sha512-+fqLIqa9wN3R+kvlld8sgG0nt04BAZxdCDP4t2qZ9TJsquLWA+xMtT8Waibb3d4li4AQS+IOfjiHAznv/dhHgQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.0.0.tgz", + "integrity": "sha512-8y91ZfpOHubiGJu5tVyGI9tQCEyHZDTeqUWVcJd0dq7B96xIf84S0L4fwmD1k9zTe1eqEFSk0gc7BpY+FKn7Ww==", "dependencies": { - "@sapphire/shapeshift": "^3.1.0", - "@sindresorhus/is": "^4.6.0", - "discord-api-types": "^0.33.3", + "@sapphire/shapeshift": "^3.5.1", + "discord-api-types": "^0.36.2", "fast-deep-equal": "^3.1.3", "ts-mixer": "^6.0.1", "tslib": "^2.4.0" @@ -251,6 +252,31 @@ "node": ">=12.0.0" } }, + "node_modules/@discordjs/rest": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.0.0.tgz", + "integrity": "sha512-uDAvnE0P2a8axMdD4C51EGjvCRQ2HZk2Yxf6vHWZgIqG87D8DGKMPwmquIxrrB07MjV+rwci2ObU+mGhGP+bJg==", + "dependencies": { + "@discordjs/collection": "^1.0.0", + "@sapphire/async-queue": "^1.3.2", + "@sapphire/snowflake": "^3.2.2", + "discord-api-types": "^0.36.2", + "file-type": "^17.1.2", + "tslib": "^2.4.0", + "undici": "^5.7.0" + }, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/@discordjs/rest/node_modules/@discordjs/collection": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.0.0.tgz", + "integrity": "sha512-nAxDQYE5dNAzEGQ7HU20sujDsG5vLowUKCEqZkKUIlrXERZFTt/60zKUj/g4+AVCGeq+pXC5hivMaNtiC+PY5Q==", + "engines": { + "node": ">=16.9.0" + } + }, "node_modules/@discordjs/voice": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.10.0.tgz", @@ -267,6 +293,11 @@ "node": ">=16.9.0" } }, + "node_modules/@discordjs/voice/node_modules/discord-api-types": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.5.tgz", + "integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg==" + }, "node_modules/@distube/soundcloud": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@distube/soundcloud/-/soundcloud-1.2.1.tgz", @@ -436,20 +467,33 @@ } }, "node_modules/@sapphire/async-queue": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.1.tgz", - "integrity": "sha512-FFTlPOWZX1kDj9xCAsRzH5xEJfawg1lNoYAA+ecOWJMHOfiZYb1uXOI3ne9U4UILSEPwfE68p3T9wUHwIQfR0g==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.2.tgz", + "integrity": "sha512-rUpMLATsoAMnlN3gecAcr9Ecnw1vG7zi5Xr+IX22YzRzi1k9PF9vKzoT8RuEJbiIszjcimu3rveqUnvwDopz8g==", "engines": { "node": ">=v14.0.0", "npm": ">=7.0.0" } }, "node_modules/@sapphire/shapeshift": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.1.0.tgz", - "integrity": "sha512-PkxFXd3QJ1qAPS05Dy2UkVGYPm/asF1Ugt2Xyzmv4DHzO3+G7l+873C4XFFcJ9M5Je+eCMC7SSifgPTSur5QuA==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.5.1.tgz", + "integrity": "sha512-7JFsW5IglyOIUQI1eE0g6h06D/Far6HqpcowRScgCiLSqTf3hhkPWCWotVTtVycnDCMYIwPeaw6IEPBomKC8pA==", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "lodash.uniqwith": "^4.5.0" + }, "engines": { - "node": ">=v15.0.0", + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/@sapphire/snowflake": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.2.2.tgz", + "integrity": "sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ==", + "engines": { + "node": ">=v14.0.0", "npm": ">=7.0.0" } }, @@ -513,6 +557,11 @@ "node": ">=10" } }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, "node_modules/@types/bson": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.5.tgz", @@ -1413,9 +1462,9 @@ } }, "node_modules/discord-api-types": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.4.tgz", - "integrity": "sha512-Y6RMvXsHKiBgQhm/q5MgRieXc4Tzh5p/JuDyqreI48lmy+AQfO+g9Xhz0tuGBaN1FtsrLT7mD+lbFONPo5vdwA==" + "version": "0.36.3", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", + "integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==" }, "node_modules/discord-backup": { "version": "3.2.1", @@ -1459,9 +1508,10 @@ } }, "node_modules/discord.js": { - "version": "13.8.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.8.0.tgz", - "integrity": "sha512-EPAA/2VLycYN5wSzavqa4iJ6qj3UtQFtHw5TH/60Fj29ymfEsCQVn//o1mTpwDxzwb+rPIrWhkxKIGGnjfv0Iw==", + "version": "13.8.1", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.8.1.tgz", + "integrity": "sha512-jOsD+4tEZWWx0RHVyH+FBcqoTrsL+d5Mm5p+ULQOdU0qSaxhLNkWYig+yDHNZoND7nlkXX3qi+BW+gO5erWylg==", + "deprecated": "no longer supported", "dependencies": { "@discordjs/builders": "^0.14.0", "@discordjs/collection": "^0.7.0", @@ -1478,6 +1528,28 @@ "npm": ">=7.0.0" } }, + "node_modules/discord.js/node_modules/@discordjs/builders": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.14.0.tgz", + "integrity": "sha512-+fqLIqa9wN3R+kvlld8sgG0nt04BAZxdCDP4t2qZ9TJsquLWA+xMtT8Waibb3d4li4AQS+IOfjiHAznv/dhHgQ==", + "deprecated": "no longer supported", + "dependencies": { + "@sapphire/shapeshift": "^3.1.0", + "@sindresorhus/is": "^4.6.0", + "discord-api-types": "^0.33.3", + "fast-deep-equal": "^3.1.3", + "ts-mixer": "^6.0.1", + "tslib": "^2.4.0" + }, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/discord.js/node_modules/discord-api-types": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.5.tgz", + "integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg==" + }, "node_modules/distube": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/distube/-/distube-3.3.4.tgz", @@ -1606,6 +1678,8 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "optional": true, + "peer": true, "dependencies": { "iconv-lite": "^0.6.2" } @@ -1614,6 +1688,8 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "optional": true, + "peer": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -2061,6 +2137,22 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/file-type": { + "version": "17.1.3", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.3.tgz", + "integrity": "sha512-MFVSozBIhvnx2dkxlf+010Xqn6+ojlMUT9LXQiPNoOijgRtXNMghWdGK0u2o1RoCqzHoVsw65IL8ZBcQ4MhIrw==", + "dependencies": { + "readable-web-to-node-stream": "^3.0.2", + "strtok3": "^7.0.0-alpha.7", + "token-types": "^5.0.0-alpha.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, "node_modules/filelist": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz", @@ -2493,117 +2585,11 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "bin": { - "he": "bin/he" - } - }, "node_modules/himalaya": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/himalaya/-/himalaya-1.1.0.tgz", "integrity": "sha512-LLase1dHCRMel68/HZTFft0N0wti0epHr3nNY7ynpLbyZpmrKMQ8YIpiOV77TM97cNpC8Wb2n6f66IRggwdWPw==" }, - "node_modules/html-to-text": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-5.1.1.tgz", - "integrity": "sha512-Bci6bD/JIfZSvG4s0gW/9mMKwBRoe/1RWLxUME/d6WUSZCdY7T60bssf/jFf7EYXRyqU4P5xdClVqiYU0/ypdA==", - "dependencies": { - "he": "^1.2.0", - "htmlparser2": "^3.10.1", - "lodash": "^4.17.11", - "minimist": "^1.2.0" - }, - "bin": { - "html-to-text": "bin/cli.js" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/html-to-text/node_modules/dom-serializer": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", - "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", - "dependencies": { - "domelementtype": "^2.0.1", - "entities": "^2.0.0" - } - }, - "node_modules/html-to-text/node_modules/dom-serializer/node_modules/domelementtype": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", - "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ] - }, - "node_modules/html-to-text/node_modules/dom-serializer/node_modules/entities": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==", - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/html-to-text/node_modules/domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" - }, - "node_modules/html-to-text/node_modules/domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "dependencies": { - "domelementtype": "1" - } - }, - "node_modules/html-to-text/node_modules/domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "dependencies": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "node_modules/html-to-text/node_modules/entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" - }, - "node_modules/html-to-text/node_modules/htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "dependencies": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - } - }, - "node_modules/html-to-text/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/htmlparser2": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", @@ -2728,6 +2714,25 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -3036,11 +3041,6 @@ "libsodium": "^0.7.0" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, "node_modules/lodash.deburr": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz", @@ -3057,6 +3057,11 @@ "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", "dev": true }, + "node_modules/lodash.uniqwith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", + "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==" + }, "node_modules/long": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/long/-/long-5.2.0.tgz", @@ -3081,19 +3086,6 @@ "node": ">=10" } }, - "node_modules/lyrics-finder": { - "version": "21.7.0", - "resolved": "https://registry.npmjs.org/lyrics-finder/-/lyrics-finder-21.7.0.tgz", - "integrity": "sha512-AMaJ+MdbdemYOWM1Kxd/vzn23OD66/fdemaJWN9dU0qsxK6d09rODSphygAvaGka6mgfHaFlHN+ETHv/d60ftw==", - "dependencies": { - "encoding": "^0.1.13", - "html-to-text": "^5.1.1", - "node-fetch": "^2.6.0" - }, - "bin": { - "lyrics-finder": "src/bin.js" - } - }, "node_modules/m3u8stream": { "version": "0.8.6", "resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.8.6.tgz", @@ -3751,6 +3743,18 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, + "node_modules/peek-readable": { + "version": "5.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0-alpha.5.tgz", + "integrity": "sha512-pJohF/tDwV3ntnT5+EkUo4E700q/j/OCDuPxtM+5/kFGjyOai/sK4/We4Cy1MB2OiTQliWU5DxPvYIKQAdPqAA==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -3907,6 +3911,34 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "dependencies": { + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/readable-web-to-node-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/regenerator-runtime": { "version": "0.13.9", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", @@ -4377,6 +4409,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strtok3": { + "version": "7.0.0-alpha.8", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0-alpha.8.tgz", + "integrity": "sha512-u+k19v+rTxBjGYxncRQjGvZYwYvEd0uP3D+uHKe/s4WB1eXS5ZwpZsTlBu5xSS4zEd89mTXECXg6WW3FSeV8cA==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^5.0.0-alpha.5" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/superagent": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", @@ -4525,6 +4573,22 @@ "node": ">=0.6" } }, + "node_modules/token-types": { + "version": "5.0.0-alpha.2", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.0-alpha.2.tgz", + "integrity": "sha512-EsG9UxAW4M6VATrEEjhPFTKEUi1OiJqTUMIZOGBN49fGxYjZB36k0p7to3HZSmWRoHm1QfZgrg3e02fpqAt5fQ==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -4882,13 +4946,12 @@ } }, "@discordjs/builders": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.14.0.tgz", - "integrity": "sha512-+fqLIqa9wN3R+kvlld8sgG0nt04BAZxdCDP4t2qZ9TJsquLWA+xMtT8Waibb3d4li4AQS+IOfjiHAznv/dhHgQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.0.0.tgz", + "integrity": "sha512-8y91ZfpOHubiGJu5tVyGI9tQCEyHZDTeqUWVcJd0dq7B96xIf84S0L4fwmD1k9zTe1eqEFSk0gc7BpY+FKn7Ww==", "requires": { - "@sapphire/shapeshift": "^3.1.0", - "@sindresorhus/is": "^4.6.0", - "discord-api-types": "^0.33.3", + "@sapphire/shapeshift": "^3.5.1", + "discord-api-types": "^0.36.2", "fast-deep-equal": "^3.1.3", "ts-mixer": "^6.0.1", "tslib": "^2.4.0" @@ -4924,6 +4987,27 @@ "node-addon-api": "^4.2.0" } }, + "@discordjs/rest": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-1.0.0.tgz", + "integrity": "sha512-uDAvnE0P2a8axMdD4C51EGjvCRQ2HZk2Yxf6vHWZgIqG87D8DGKMPwmquIxrrB07MjV+rwci2ObU+mGhGP+bJg==", + "requires": { + "@discordjs/collection": "^1.0.0", + "@sapphire/async-queue": "^1.3.2", + "@sapphire/snowflake": "^3.2.2", + "discord-api-types": "^0.36.2", + "file-type": "^17.1.2", + "tslib": "^2.4.0", + "undici": "^5.7.0" + }, + "dependencies": { + "@discordjs/collection": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.0.0.tgz", + "integrity": "sha512-nAxDQYE5dNAzEGQ7HU20sujDsG5vLowUKCEqZkKUIlrXERZFTt/60zKUj/g4+AVCGeq+pXC5hivMaNtiC+PY5Q==" + } + } + }, "@discordjs/voice": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.10.0.tgz", @@ -4935,6 +5019,13 @@ "tiny-typed-emitter": "^2.1.0", "tslib": "^2.4.0", "ws": "^8.7.0" + }, + "dependencies": { + "discord-api-types": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.5.tgz", + "integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg==" + } } }, "@distube/soundcloud": { @@ -5066,14 +5157,23 @@ } }, "@sapphire/async-queue": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.1.tgz", - "integrity": "sha512-FFTlPOWZX1kDj9xCAsRzH5xEJfawg1lNoYAA+ecOWJMHOfiZYb1uXOI3ne9U4UILSEPwfE68p3T9wUHwIQfR0g==" + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.3.2.tgz", + "integrity": "sha512-rUpMLATsoAMnlN3gecAcr9Ecnw1vG7zi5Xr+IX22YzRzi1k9PF9vKzoT8RuEJbiIszjcimu3rveqUnvwDopz8g==" }, "@sapphire/shapeshift": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.1.0.tgz", - "integrity": "sha512-PkxFXd3QJ1qAPS05Dy2UkVGYPm/asF1Ugt2Xyzmv4DHzO3+G7l+873C4XFFcJ9M5Je+eCMC7SSifgPTSur5QuA==" + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.5.1.tgz", + "integrity": "sha512-7JFsW5IglyOIUQI1eE0g6h06D/Far6HqpcowRScgCiLSqTf3hhkPWCWotVTtVycnDCMYIwPeaw6IEPBomKC8pA==", + "requires": { + "fast-deep-equal": "^3.1.3", + "lodash.uniqwith": "^4.5.0" + } + }, + "@sapphire/snowflake": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.2.2.tgz", + "integrity": "sha512-ula2O0kpSZtX9rKXNeQMrHwNd7E4jPDJYUXmEGTFdMRfyfMw+FPyh04oKMjAiDuOi64bYgVkOV3MjK+loImFhQ==" }, "@sindresorhus/is": { "version": "4.6.0", @@ -5113,6 +5213,11 @@ "defer-to-connect": "^2.0.0" } }, + "@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, "@types/bson": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/bson/-/bson-4.0.5.tgz", @@ -5827,9 +5932,9 @@ "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" }, "discord-api-types": { - "version": "0.33.4", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.4.tgz", - "integrity": "sha512-Y6RMvXsHKiBgQhm/q5MgRieXc4Tzh5p/JuDyqreI48lmy+AQfO+g9Xhz0tuGBaN1FtsrLT7mD+lbFONPo5vdwA==" + "version": "0.36.3", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.36.3.tgz", + "integrity": "sha512-bz/NDyG0KBo/tY14vSkrwQ/n3HKPf87a0WFW/1M9+tXYK+vp5Z5EksawfCWo2zkAc6o7CClc0eff1Pjrqznlwg==" }, "discord-backup": { "version": "3.2.1", @@ -5863,9 +5968,9 @@ } }, "discord.js": { - "version": "13.8.0", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.8.0.tgz", - "integrity": "sha512-EPAA/2VLycYN5wSzavqa4iJ6qj3UtQFtHw5TH/60Fj29ymfEsCQVn//o1mTpwDxzwb+rPIrWhkxKIGGnjfv0Iw==", + "version": "13.8.1", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.8.1.tgz", + "integrity": "sha512-jOsD+4tEZWWx0RHVyH+FBcqoTrsL+d5Mm5p+ULQOdU0qSaxhLNkWYig+yDHNZoND7nlkXX3qi+BW+gO5erWylg==", "requires": { "@discordjs/builders": "^0.14.0", "@discordjs/collection": "^0.7.0", @@ -5876,6 +5981,26 @@ "form-data": "^4.0.0", "node-fetch": "^2.6.1", "ws": "^8.7.0" + }, + "dependencies": { + "@discordjs/builders": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.14.0.tgz", + "integrity": "sha512-+fqLIqa9wN3R+kvlld8sgG0nt04BAZxdCDP4t2qZ9TJsquLWA+xMtT8Waibb3d4li4AQS+IOfjiHAznv/dhHgQ==", + "requires": { + "@sapphire/shapeshift": "^3.1.0", + "@sindresorhus/is": "^4.6.0", + "discord-api-types": "^0.33.3", + "fast-deep-equal": "^3.1.3", + "ts-mixer": "^6.0.1", + "tslib": "^2.4.0" + } + }, + "discord-api-types": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.33.5.tgz", + "integrity": "sha512-dvO5M52v7m7Dy96+XUnzXNsQ/0npsYpU6dL205kAtEDueswoz3aU3bh1UMoK4cQmcGtB1YRyLKqp+DXi05lzFg==" + } } }, "distube": { @@ -5960,6 +6085,8 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "optional": true, + "peer": true, "requires": { "iconv-lite": "^0.6.2" }, @@ -5968,6 +6095,8 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "optional": true, + "peer": true, "requires": { "safer-buffer": ">= 2.1.2 < 3.0.0" } @@ -6327,6 +6456,16 @@ "flat-cache": "^3.0.4" } }, + "file-type": { + "version": "17.1.3", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-17.1.3.tgz", + "integrity": "sha512-MFVSozBIhvnx2dkxlf+010Xqn6+ojlMUT9LXQiPNoOijgRtXNMghWdGK0u2o1RoCqzHoVsw65IL8ZBcQ4MhIrw==", + "requires": { + "readable-web-to-node-stream": "^3.0.2", + "strtok3": "^7.0.0-alpha.7", + "token-types": "^5.0.0-alpha.2" + } + }, "filelist": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz", @@ -6660,100 +6799,11 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" - }, "himalaya": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/himalaya/-/himalaya-1.1.0.tgz", "integrity": "sha512-LLase1dHCRMel68/HZTFft0N0wti0epHr3nNY7ynpLbyZpmrKMQ8YIpiOV77TM97cNpC8Wb2n6f66IRggwdWPw==" }, - "html-to-text": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/html-to-text/-/html-to-text-5.1.1.tgz", - "integrity": "sha512-Bci6bD/JIfZSvG4s0gW/9mMKwBRoe/1RWLxUME/d6WUSZCdY7T60bssf/jFf7EYXRyqU4P5xdClVqiYU0/ypdA==", - "requires": { - "he": "^1.2.0", - "htmlparser2": "^3.10.1", - "lodash": "^4.17.11", - "minimist": "^1.2.0" - }, - "dependencies": { - "dom-serializer": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", - "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", - "requires": { - "domelementtype": "^2.0.1", - "entities": "^2.0.0" - }, - "dependencies": { - "domelementtype": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", - "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==" - }, - "entities": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", - "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" - } - } - }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" - }, - "domhandler": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", - "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" - }, - "htmlparser2": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", - "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", - "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, "htmlparser2": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", @@ -6856,6 +6906,11 @@ "safer-buffer": ">= 2.1.2 < 3" } }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -7100,11 +7155,6 @@ "libsodium": "^0.7.0" } }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, "lodash.deburr": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/lodash.deburr/-/lodash.deburr-4.1.0.tgz", @@ -7121,6 +7171,11 @@ "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", "dev": true }, + "lodash.uniqwith": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqwith/-/lodash.uniqwith-4.5.0.tgz", + "integrity": "sha512-7lYL8bLopMoy4CTICbxygAUq6CdRJ36vFc80DucPueUee+d5NBRxz3FdT9Pes/HEx5mPoT9jwnsEJWz1N7uq7Q==" + }, "long": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/long/-/long-5.2.0.tgz", @@ -7139,16 +7194,6 @@ "yallist": "^4.0.0" } }, - "lyrics-finder": { - "version": "21.7.0", - "resolved": "https://registry.npmjs.org/lyrics-finder/-/lyrics-finder-21.7.0.tgz", - "integrity": "sha512-AMaJ+MdbdemYOWM1Kxd/vzn23OD66/fdemaJWN9dU0qsxK6d09rODSphygAvaGka6mgfHaFlHN+ETHv/d60ftw==", - "requires": { - "encoding": "^0.1.13", - "html-to-text": "^5.1.1", - "node-fetch": "^2.6.0" - } - }, "m3u8stream": { "version": "0.8.6", "resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.8.6.tgz", @@ -7618,6 +7663,11 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" }, + "peek-readable": { + "version": "5.0.0-alpha.5", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-5.0.0-alpha.5.tgz", + "integrity": "sha512-pJohF/tDwV3ntnT5+EkUo4E700q/j/OCDuPxtM+5/kFGjyOai/sK4/We4Cy1MB2OiTQliWU5DxPvYIKQAdPqAA==" + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -7723,6 +7773,26 @@ } } }, + "readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "requires": { + "readable-stream": "^3.6.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, "regenerator-runtime": { "version": "0.13.9", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", @@ -8077,6 +8147,15 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, + "strtok3": { + "version": "7.0.0-alpha.8", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-7.0.0-alpha.8.tgz", + "integrity": "sha512-u+k19v+rTxBjGYxncRQjGvZYwYvEd0uP3D+uHKe/s4WB1eXS5ZwpZsTlBu5xSS4zEd89mTXECXg6WW3FSeV8cA==", + "requires": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^5.0.0-alpha.5" + } + }, "superagent": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/superagent/-/superagent-6.1.0.tgz", @@ -8197,6 +8276,15 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, + "token-types": { + "version": "5.0.0-alpha.2", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-5.0.0-alpha.2.tgz", + "integrity": "sha512-EsG9UxAW4M6VATrEEjhPFTKEUi1OiJqTUMIZOGBN49fGxYjZB36k0p7to3HZSmWRoHm1QfZgrg3e02fpqAt5fQ==", + "requires": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + } + }, "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", diff --git a/package.json b/package.json index ecb951d4..f7a0a038 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jaba", - "version": "4.0", + "version": "TEST", "description": "A very complete Discord bot (more than 100 commands) that uses the Discord.js", "main": "index.js", "private": true, @@ -12,7 +12,9 @@ "author": "Jonny_Bro", "license": "ISC", "dependencies": { + "@discordjs/builders": "^1.0.0", "@discordjs/opus": "^0.7.0", + "@discordjs/rest": "^1.0.0", "@discordjs/voice": "^0.10.0", "@distube/soundcloud": "^1.2.1", "@distube/spotify": "^1.3.2", @@ -28,11 +30,12 @@ "colors-generator": "^0.3.4", "cron": "^1.7.2", "dblapi.js": "^2.3.0", + "discord-api-types": "^0.36.3", "discord-backup": "^3.2.1", "discord-giveaways": "github:Androz2091/discord-giveaways#develop", "discord-paginationembed": "github:gazmull/discord-paginationembed#v3", "discord-together": "^1.3.3", - "discord.js": "^13.8.0", + "discord.js": "^13.8.1", "distube": "^3.3.4", "ejs": "^3.1.3", "express": "^4.17.1", @@ -44,7 +47,6 @@ "i18next-node-fs-backend": "^2.1.3", "js-string-cleaner": "^1.0.3", "libsodium-wrappers": "^0.7.9", - "lyrics-finder": "^21.7.0", "markdown-table": "2.0.0", "mathjs": "^9.0.0", "md5": "^2.2.1",