From 5f4c53b072a9e0a01e5f0d923540a80aaef4260b Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Thu, 4 Aug 2022 19:26:17 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BA=D0=B0=D1=82=D0=B5=D0=B3=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D1=8F=20General=20=D0=A3=D0=B4=D0=B0=D0=BB=D1=91=D0=BD?= =?UTF-8?q?=20=D0=BC=D1=83=D1=81=D0=BE=D1=80=20=D0=B8=20=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D1=83=D0=B6=D0=BD=D1=8B=D0=B5=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TO REWRITE/Administration/autorole.js | 3 +- TO REWRITE/Administration/configuration.js | 4 - TO REWRITE/Administration/goodbye.js | 3 +- TO REWRITE/Administration/setbirthdays.js | 3 +- TO REWRITE/Administration/setmodlogs.js | 3 +- TO REWRITE/Administration/setprefix.js | 33 ---- TO REWRITE/Administration/setreports.js | 3 +- TO REWRITE/Administration/setsuggests.js | 3 +- TO REWRITE/Administration/welcome.js | 3 +- TO REWRITE/General/avatar.js | 36 ----- TO REWRITE/General/emoji.js | 57 ------- TO REWRITE/General/minecraft.js | 105 ------------- TO REWRITE/General/remindme.js | 45 ------ TO REWRITE/General/report.js | 86 ---------- TO REWRITE/General/serverinfo.js | 101 ------------ TO REWRITE/General/setafk.js | 49 ------ TO REWRITE/General/shorturl.js | 42 ----- TO REWRITE/General/staff.js | 50 ------ TO REWRITE/General/stats.js | 90 ----------- TO REWRITE/General/suggest.js | 76 --------- TO REWRITE/General/userinfo.js | 147 ------------------ TO REWRITE/General/whois.js | 73 --------- base/Guild.js | 55 +++---- base/JaBa.js | 32 ++-- base/Member.js | 27 ++-- base/User.js | 26 ++-- commands/General/afk.js | 48 ++++++ commands/General/avatar.js | 49 ++++++ commands/General/emoji.js | 71 +++++++++ commands/General/minecraft.js | 102 ++++++++++++ commands/General/remindme.js | 61 ++++++++ commands/General/report.js | 99 ++++++++++++ commands/General/serverinfo.js | 106 +++++++++++++ commands/General/shorturl.js | 48 ++++++ commands/General/staff.js | 64 ++++++++ commands/General/stats.js | 104 +++++++++++++ commands/General/suggest.js | 88 +++++++++++ commands/General/userinfo.js | 120 ++++++++++++++ commands/General/whois.js | 73 +++++++++ commands/Music/queue.js | 4 +- commands/Owner/announcement.js | 7 +- commands/Owner/debug.js | 80 +++++----- commands/Owner/eval.js | 7 +- commands/Owner/reload.js | 7 +- commands/Owner/say.js | 12 +- dashboard/views/manager/guild.ejs | 8 +- events/MessageHandler.js | 4 +- helpers/resolvers.js | 100 ------------ languages/en-US/common.json | 3 - languages/ru-RU/administration/setprefix.json | 8 - .../ru-RU/administration/stealemoji.json | 1 - languages/ru-RU/common.json | 10 +- languages/ru-RU/dashboard.json | 4 +- .../ru-RU/general/{setafk.json => afk.json} | 7 +- languages/ru-RU/general/minecraft.json | 1 - languages/ru-RU/general/remindme.json | 2 +- languages/ru-RU/general/report.json | 2 - languages/ru-RU/general/serverinfo.json | 5 +- languages/ru-RU/general/shorturl.json | 2 +- languages/ru-RU/general/stats.json | 10 +- languages/ru-RU/general/userinfo.json | 8 +- languages/ru-RU/general/whois.json | 3 +- languages/ru-RU/misc.json | 15 -- languages/ru-RU/owner/say.json | 4 +- languages/uk-UA/administration/setprefix.json | 8 - languages/uk-UA/common.json | 3 - languages/uk-UA/dashboard.json | 4 +- 67 files changed, 1180 insertions(+), 1337 deletions(-) delete mode 100644 TO REWRITE/Administration/setprefix.js delete mode 100644 TO REWRITE/General/avatar.js delete mode 100644 TO REWRITE/General/emoji.js delete mode 100644 TO REWRITE/General/minecraft.js delete mode 100644 TO REWRITE/General/remindme.js delete mode 100644 TO REWRITE/General/report.js delete mode 100644 TO REWRITE/General/serverinfo.js delete mode 100644 TO REWRITE/General/setafk.js delete mode 100644 TO REWRITE/General/shorturl.js delete mode 100644 TO REWRITE/General/staff.js delete mode 100644 TO REWRITE/General/stats.js delete mode 100644 TO REWRITE/General/suggest.js delete mode 100644 TO REWRITE/General/userinfo.js delete mode 100644 TO REWRITE/General/whois.js create mode 100644 commands/General/afk.js create mode 100644 commands/General/avatar.js create mode 100644 commands/General/emoji.js create mode 100644 commands/General/minecraft.js create mode 100644 commands/General/remindme.js create mode 100644 commands/General/report.js create mode 100644 commands/General/serverinfo.js create mode 100644 commands/General/shorturl.js create mode 100644 commands/General/staff.js create mode 100644 commands/General/stats.js create mode 100644 commands/General/suggest.js create mode 100644 commands/General/userinfo.js create mode 100644 commands/General/whois.js delete mode 100644 helpers/resolvers.js delete mode 100644 languages/ru-RU/administration/setprefix.json rename languages/ru-RU/general/{setafk.json => afk.json} (57%) delete mode 100644 languages/uk-UA/administration/setprefix.json diff --git a/TO REWRITE/Administration/autorole.js b/TO REWRITE/Administration/autorole.js index 234d4d42..2945f2bb 100644 --- a/TO REWRITE/Administration/autorole.js +++ b/TO REWRITE/Administration/autorole.js @@ -1,5 +1,4 @@ -const Command = require("../../base/Command"), - Resolvers = require("../../helpers/resolvers"); +const Command = require("../../base/Command"); class Autorole extends Command { constructor(client) { diff --git a/TO REWRITE/Administration/configuration.js b/TO REWRITE/Administration/configuration.js index 2359a58f..4fa10126 100644 --- a/TO REWRITE/Administration/configuration.js +++ b/TO REWRITE/Administration/configuration.js @@ -31,10 +31,6 @@ class Configuration extends Command { }); embed.addFields([ - { // Guild prefix - name: message.translate("administration/configuration:PREFIX_TITLE"), - value: guildData.prefix - }, { // Ignored channels name: message.translate("administration/configuration:IGNORED_CHANNELS_TITLE"), value: guildData.ignoredChannels.length > 0 ? guildData.ignoredChannels.map((ch) => `<#${ch}>`).join(", ") : message.translate("administration/configuration:NO_IGNORED_CHANNELS") diff --git a/TO REWRITE/Administration/goodbye.js b/TO REWRITE/Administration/goodbye.js index 8a2c1573..75530c8f 100644 --- a/TO REWRITE/Administration/goodbye.js +++ b/TO REWRITE/Administration/goodbye.js @@ -1,5 +1,4 @@ -const Command = require("../../base/Command"), - Resolvers = require("../../helpers/resolvers"); +const Command = require("../../base/Command"); class Goodbye extends Command { constructor(client) { diff --git a/TO REWRITE/Administration/setbirthdays.js b/TO REWRITE/Administration/setbirthdays.js index 660d9091..f5ace784 100644 --- a/TO REWRITE/Administration/setbirthdays.js +++ b/TO REWRITE/Administration/setbirthdays.js @@ -1,5 +1,4 @@ -const Command = require("../../base/Command"), - Resolvers = require("../../helpers/resolvers"); +const Command = require("../../base/Command"); class Setbirthdays extends Command { constructor(client) { diff --git a/TO REWRITE/Administration/setmodlogs.js b/TO REWRITE/Administration/setmodlogs.js index 6a5cc145..2fb8b3d6 100644 --- a/TO REWRITE/Administration/setmodlogs.js +++ b/TO REWRITE/Administration/setmodlogs.js @@ -1,5 +1,4 @@ -const Command = require("../../base/Command"), - Resolvers = require("../../helpers/resolvers"); +const Command = require("../../base/Command"); class Setmodlogs extends Command { constructor(client) { diff --git a/TO REWRITE/Administration/setprefix.js b/TO REWRITE/Administration/setprefix.js deleted file mode 100644 index a680f126..00000000 --- a/TO REWRITE/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/TO REWRITE/Administration/setreports.js b/TO REWRITE/Administration/setreports.js index 7e73f550..da955d95 100644 --- a/TO REWRITE/Administration/setreports.js +++ b/TO REWRITE/Administration/setreports.js @@ -1,5 +1,4 @@ -const Command = require("../../base/Command"), - Resolvers = require("../../helpers/resolvers"); +const Command = require("../../base/Command"); class Setreports extends Command { constructor(client) { diff --git a/TO REWRITE/Administration/setsuggests.js b/TO REWRITE/Administration/setsuggests.js index 5bdf3664..969b0af8 100644 --- a/TO REWRITE/Administration/setsuggests.js +++ b/TO REWRITE/Administration/setsuggests.js @@ -1,5 +1,4 @@ -const Command = require("../../base/Command"), - Resolvers = require("../../helpers/resolvers"); +const Command = require("../../base/Command"); class Setsuggests extends Command { constructor(client) { diff --git a/TO REWRITE/Administration/welcome.js b/TO REWRITE/Administration/welcome.js index 2e2bd7ad..dde95048 100644 --- a/TO REWRITE/Administration/welcome.js +++ b/TO REWRITE/Administration/welcome.js @@ -1,5 +1,4 @@ -const Command = require("../../base/Command"), - Resolvers = require("../../helpers/resolvers"); +const Command = require("../../base/Command"); class Welcome extends Command { constructor(client) { diff --git a/TO REWRITE/General/avatar.js b/TO REWRITE/General/avatar.js deleted file mode 100644 index ddaefd85..00000000 --- a/TO REWRITE/General/avatar.js +++ /dev/null @@ -1,36 +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({ - 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/TO REWRITE/General/emoji.js b/TO REWRITE/General/emoji.js deleted file mode 100644 index 7d3f9da5..00000000 --- a/TO REWRITE/General/emoji.js +++ /dev/null @@ -1,57 +0,0 @@ -const Command = require("../../base/Command"), - { EmbedBuilder, parseEmoji } = 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 = parseEmoji(rawEmoji); - - const embed = new EmbedBuilder() - .setAuthor({ - name: message.translate("general/emoji:TITLE", { - emoji: parsedEmoji.name - }) - }) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }) - .addFields([ - { - name: message.translate("general/emoji:NAME"), - value: parsedEmoji.name - }, - { - name: message.translate("general/emoji:ANIMATED"), - value: parsedEmoji.animated ? message.translate("common:YES") : message.translate("common:NO") - }, - { - name: message.translate("general/emoji:ID"), - value: 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/TO REWRITE/General/minecraft.js b/TO REWRITE/General/minecraft.js deleted file mode 100644 index 30e44e67..00000000 --- a/TO REWRITE/General/minecraft.js +++ /dev/null @@ -1,105 +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.EmbedBuilder() - .setAuthor({ - name: json.name - }) - .addFields([ - { - name: message.translate("general/minecraft:FIELD_STATUS"), - value: message.translate("general/minecraft:ONLINE") - }, - { - name: message.translate("general/minecraft:FIELD_CONNECTED"), - value: `**${(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"))}` - }, - { - name: message.translate("general/minecraft:FIELD_IP"), - value: json.connect, - inline: true - }, - { - name: message.translate("general/minecraft:FIELD_VERSION"), - value: json.raw.vanilla.raw.version.name, - inline: true - - }, - { - name: message.translate("general/minecraft:FIELD_PING"), - value: 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/TO REWRITE/General/remindme.js b/TO REWRITE/General/remindme.js deleted file mode 100644 index eb5861b6..00000000 --- a/TO REWRITE/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/TO REWRITE/General/report.js b/TO REWRITE/General/report.js deleted file mode 100644 index ab294c42..00000000 --- a/TO REWRITE/General/report.js +++ /dev/null @@ -1,86 +0,0 @@ -const Command = require("../../base/Command"), - { EmbedBuilder, parseEmoji} = 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 EmbedBuilder() - .setAuthor({ - name: message.translate("general/report:TITLE", { - user: member.user.tag - }), - iconURL: message.author.displayAvatarURL({ - extension: "png", - size: 512 - }) - }) - .addFields([ - { - name: message.translate("common:AUTHOR"), - value: message.author.tag, - inline: true - }, - { - name: message.translate("common:DATE"), - value: this.client.printDate(new Date(Date.now())), - inline: true - }, - { - name: message.translate("common:REASON"), - value: rep, - inline: true - }, - { - name: message.translate("common:USER"), - value: `\`${member.user.tag}\` (${member.user.toString()})`, - inline: true - } - ]) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - - const success = parseEmoji(this.client.customEmojis.cool).id; - const error = parseEmoji(this.client.customEmojis.notcool).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/TO REWRITE/General/serverinfo.js b/TO REWRITE/General/serverinfo.js deleted file mode 100644 index bb386b0b..00000000 --- a/TO REWRITE/General/serverinfo.js +++ /dev/null @@ -1,101 +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.EmbedBuilder() - .setAuthor({ - name: guild.name, - iconURL: guild.iconURL() - }) - .setThumbnail(guild.iconURL()) - .addFields([ - { - name: this.client.customEmojis.link + " " + message.translate("general/serverinfo:LINK"), - value: `[${message.translate("general/serverinfo:LINK_TEXT")}](${this.client.config.dashboard.baseURL}/stats/${guild.id})` - }, - { - name: this.client.customEmojis.title + message.translate("common:NAME"), - value: guild.name, - inline: true - }, - { - name: this.client.customEmojis.calendar + message.translate("common:CREATION"), - value: this.client.printDate(guild.createdAt), - inline: true - }, - { - name: this.client.customEmojis.users + message.translate("common:MEMBERS"), - value: `${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"))}`, - inline: true - }, - { - name: this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), - value: guild.afkChannel ? guild.afkChannel.toString() : message.translate("general/serverinfo:NO_AFK_CHANNEL"), - inline: true - }, - { - name: this.client.customEmojis.id + message.translate("common:ID"), - value: guild.id, - inline: true - }, - { - name: this.client.customEmojis.crown + message.translate("common:OWNER"), - value: owner.toString(), - inline: true - }, - { - name: this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), - value: guild.premiumSubscriptionCount.toString() || "0", - inline: true - }, - { - name: this.client.customEmojis.channels + message.translate("common:CHANNELS"), - value: `${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"))}`, - inline: 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/TO REWRITE/General/setafk.js b/TO REWRITE/General/setafk.js deleted file mode 100644 index 2d54f2b4..00000000 --- a/TO REWRITE/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/TO REWRITE/General/shorturl.js b/TO REWRITE/General/shorturl.js deleted file mode 100644 index df49351d..00000000 --- a/TO REWRITE/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.EmbedBuilder() - .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/TO REWRITE/General/staff.js b/TO REWRITE/General/staff.js deleted file mode 100644 index 61e45dd5..00000000 --- a/TO REWRITE/General/staff.js +++ /dev/null @@ -1,50 +0,0 @@ -const Command = require("../../base/Command"), - { PermissionsBitField, EmbedBuilder } = 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(PermissionsBitField.Flags.Administrator) && !m.user.bot); - const moderators = message.guild.members.cache.filter((m) => !administrators.has(m.id) && m.permissions.has(PermissionsBitField.Flags.ManageMessages) && !m.user.bot); - const embed = new EmbedBuilder() - .setAuthor({ - name: message.translate("general/staff:TITLE", { - guild: message.guild.name - }) - }) - .addFields([ - { - name: message.translate("general/staff:ADMINS"), - value: (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")) - }, - { - name: message.translate("general/staff:MODS"), - value: (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/TO REWRITE/General/stats.js b/TO REWRITE/General/stats.js deleted file mode 100644 index f2b96444..00000000 --- a/TO REWRITE/General/stats.js +++ /dev/null @@ -1,90 +0,0 @@ -const Command = require("../../base/Command"), - { PermissionsBitField, EmbedBuilder, version } = 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 EmbedBuilder() - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }) - .setAuthor({ - name: message.translate("common:STATS") - }) - .setDescription(message.translate("general/stats:MADE")) - .addFields([ - { - name: this.client.customEmojis.stats + " " + message.translate("general/stats:COUNTS_TITLE"), - value: message.translate("general/stats:COUNTS_CONTENT", { - servers: servers, - users: users - }), - inline: true - }, - { - name: this.client.customEmojis.version + " " + message.translate("general/stats:VERSIONS_TITLE"), - value: `\`Discord.js: v${version}\`\n\`Nodejs: v${process.versions.node}\``, - inline: true - }, - { - name: this.client.customEmojis.ram + " " + message.translate("general/stats:RAM_TITLE"), - value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``, - inline: true - }, - { - name: this.client.customEmojis.status.online + " " + message.translate("general/stats:ONLINE_TITLE"), - value: message.translate("general/stats:ONLINE_CONTENT", { - time: this.client.convertTime(Date.now() + this.client.uptime, true, true) - }) - }, - { - name: this.client.customEmojis.voice + " " + message.translate("general/stats:MUSIC_TITLE"), - value: 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"))}` - }) - }, - { - name: message.translate("general/stats:CREDITS_TITLE"), - value: message.translate("general/stats:CREDITS_CONTENT", { - donators: ["**`Добрый Спецназ#8801`** - Тестер, генератор идей"].join("\n"), - translators: ["**`Jonny_Bro#4226`** - :flag_ru:", "**`[ДАННЫЕ УДАЛЕНЫ]#4507`** - :flag_ua: (НЕ ОБНОВЛЕН!)"].join("\n") - }) - }, - { - name: this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"), - value: 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: [ PermissionsBitField.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/TO REWRITE/General/suggest.js b/TO REWRITE/General/suggest.js deleted file mode 100644 index e5f798d0..00000000 --- a/TO REWRITE/General/suggest.js +++ /dev/null @@ -1,76 +0,0 @@ -const Command = require("../../base/Command"), - { EmbedBuilder, parseEmoji } = 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 EmbedBuilder() - .setAuthor({ - name: message.translate("general/suggest:TITLE", { - user: message.author.username - }), - iconURL: message.author.displayAvatarURL({ - extension: "png", - size: 512, - }) - }) - .addFields([ - { - name: message.translate("common:AUTHOR"), - value: `\`${message.author.username}#${message.author.discriminator}\``, - inline: true - }, - { - name: message.translate("common:DATE"), - value: this.client.printDate(new Date(Date.now())), - inline: true - }, - { - name: message.translate("common:CONTENT"), - value: sugg - } - ]) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - - const success = parseEmoji(this.client.customEmojis.cool).id; - const error = 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/TO REWRITE/General/userinfo.js b/TO REWRITE/General/userinfo.js deleted file mode 100644 index d7950f7e..00000000 --- a/TO REWRITE/General/userinfo.js +++ /dev/null @@ -1,147 +0,0 @@ -const Command = require("../../base/Command"), - Discord = require("discord.js"); - -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.EmbedBuilder() - .setAuthor({ - name: `${user.tag} (${user.id})`, - iconURL: user.displayAvatarURL({ - extension: "png", - size: 512 - }) - }) - .setThumbnail(user.displayAvatarURL()) - .addFields([ - { - name: ":man: " + message.translate("common:USERNAME"), - value: member.nickname || user.username, - inline: true - }, - { - name: this.client.customEmojis.discriminator + " " + message.translate("common:DISCRIMINATOR"), - value: user.discriminator, - inline: true - }, - { - name: this.client.customEmojis.bot + " " + message.translate("common:ROBOT"), - value: (user.bot ? message.translate("common:YES") : message.translate("common:NO")), - inlinee: true - }, - { - name: this.client.customEmojis.calendar + " " + message.translate("common:CREATION"), - value: this.client.printDate(user.createdAt), - inline: true - }, - { - name: this.client.customEmojis.avatar + " " + message.translate("common:AVATAR"), - value: member.displayAvatarURL({ - extension: "png", - size: 512 - }) - } - ]) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - - if (displayPresence) { - if (member.presence.activities[0].name === "Custom Status") { - embed.addFields([ - { - name: this.client.customEmojis.games + " " + message.translate("common:GAME"), - value: (member.presence.activities[0] ? `Пользовательский статус\n${member.presence.activities[0].state || message.translate("common:NOT_DEFINED")}` : message.translate("general/userinfo:NO_GAME")), - inline: true - }, - { - name: this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"), - value: message.translate("common:STATUS_" + (member.presence.status.toUpperCase())), - inline: true - } - ]); - } else { - embed.addFields([ - { - name: this.client.customEmojis.games + " " + message.translate("common:GAME"), - value: (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")), - inline: true - }, - { - name: this.client.customEmojis.status[member.presence.status] + " " + message.translate("common:STATUS"), - value: message.translate("common:STATUS_" + (member.presence.status.toUpperCase())), - inline: true - } - ]); - } - } - - if (member) { - embed.addFields([ - { - name: this.client.customEmojis.calendar2 + " " + message.translate("common:JOIN"), - value: this.client.printDate(member.joinedAt), - inline: true - }, - { - name: this.client.customEmojis.color + " " + message.translate("common:COLOR"), - value: member.displayHexColor, - inline: true - }, - { - name: this.client.customEmojis.pencil + " " + message.translate("common:NICKNAME"), - value: (member.nickname ? member.nickname : message.translate("general/userinfo:NO_NICKNAME")), - inline: true - }, - { - name: this.client.customEmojis.roles + " " + message.translate("common:ROLES"), - value: (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(", ")) - } - ]); - } - - message.reply({ - embeds: [embed] - }); - } -} - -module.exports = Userinfo; \ No newline at end of file diff --git a/TO REWRITE/General/whois.js b/TO REWRITE/General/whois.js deleted file mode 100644 index adbb996f..00000000 --- a/TO REWRITE/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.EmbedBuilder() - .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.EmbedBuilder() - .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 || message.translate("common:UNKNOWN")} (${whois.countryCode || message.translate("common:UNKNOWN")})`, inline: true }, - { name: message.translate("general/whois:REGION"), value: `${whois.regionName || message.translate("common:UNKNOWN")} (${whois.region || message.translate("common:UNKNOWN")})`, inline: true }, - { name: message.translate("general/whois:CITY"), value: `${whois.city || message.translate("common:UNKNOWN")}`, inline: true }, - { name: message.translate("general/whois:ZIP"), value: `${whois.zip || message.translate("common:UNKNOWN")}`, inline: true }, - { name: message.translate("general/whois:TIMEZONE"), value: `${whois.timezone || message.translate("common:UNKNOWN")}`, inline: true }, - { name: message.translate("general/whois:CONTINENT"), value: `${whois.continent || message.translate("common:UNKNOWN")} (${whois.continentCode || message.translate("common:UNKNOWN")})`, inline: true }, - { name: message.translate("general/whois:CURRENCY"), value: `${whois.currency || message.translate("common:UNKNOWN")}`, inline: true }, - { name: message.translate("general/whois:ISP"), value: `${whois.isp || message.translate("common:UNKNOWN")}`, 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/base/Guild.js b/base/Guild.js index a196cd26..c39bdc2a 100644 --- a/base/Guild.js +++ b/base/Guild.js @@ -3,51 +3,42 @@ const mongoose = require("mongoose"), languages = require("../languages/language-meta.json"); module.exports = mongoose.model("Guild", new Schema({ - /* REQUIRED */ - id: { type: String }, // Discord ID of the guild + id: { type: String }, - /* MEMBERSDATA */ - membersData: { type: Object, default: {} }, // Members data of the guild + membersData: { type: Object, default: {} }, members: [{ type: Schema.Types.ObjectId, ref: "Member" }], - /* CONFIGURATION */ - language: { type: String, default: languages.find((l) => l.default).name }, // Language of the guild - plugins: { type: Object, default: { // Plugins data - // Welcome messages + language: { type: String, default: languages.find((l) => l.default).name }, + plugins: { type: Object, default: { welcome: { - enabled: false, // Whether the welcome messages are enabled - message: null, // The welcome message - channel: null, // The channel to send the welcome messages - withImage: null // Whether the welcome images are enabled + enabled: false, + message: null, + channel: null, + withImage: null }, - // Goodbye messages goodbye: { - enabled: false, // Whether the goodbye messages are enabled - message: null, // The goodbye message - channel: null, // The channel to send the goodbye messages - withImage: null // Whether the goodbye images are enabled + enabled: false, + message: null, + channel: null, + withImage: null }, - // Autorole autorole: { - enabled: false, // Whether the autorole is enabled - role: null // The role to add when a member join the server + enabled: false, + role: null }, - // Auto moderation automod: { - enabled: false, // Whether the auto moderation is enabled - ignored: [] // The channels in which the auto moderation is disabled + enabled: false, + ignored: [] }, - // Auto sanctions warnsSanctions: { - kick: false, // The number of warns required to kick the user - ban: false // The number of warns required to ban the user + kick: false, + ban: false }, - suggestions: false, // the channel in which the suggestions will be sent - modlogs: false, // the channel in which the moderation logs (mute, kick, ban, etc...) will be sent - birthdays: false, // the channel in which birtdays announcements will be sent - 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 + suggestions: false, + modlogs: false, + birthdays: false, + reports: false }}, casesCount: { type: Number, default: 0 }, - autoDeleteModCommands: { type: Boolean, default: false }, // Whether to auto delete moderation commands + autoDeleteModCommands: { type: Boolean, default: false }, })); \ No newline at end of file diff --git a/base/JaBa.js b/base/JaBa.js index c7c084a9..ad5f9afc 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -1,8 +1,5 @@ -const {/* EmbedBuilder, */Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder } = require("discord.js"), +const { Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder } = require("discord.js"), { GiveawaysManager } = require("discord-giveaways"), - // { SoundCloudPlugin } = require("@distube/soundcloud"), - // { SpotifyPlugin } = require("@distube/spotify"), - // { YtDlpPlugin } = require("@distube/yt-dlp"), { Player } = require("discord-player"), { REST } = require("@discordjs/rest"), { Routes } = require("discord-api-types/v10"); @@ -14,11 +11,10 @@ const BaseEvent = require("./BaseEvent.js"), path = require("path"), fs = require("fs").promises, mongoose = require("mongoose"), - // DisTube = require("distube"), moment = require("moment"); -moment.relativeTimeThreshold("s", 60); moment.relativeTimeThreshold("ss", 5); +moment.relativeTimeThreshold("s", 60); moment.relativeTimeThreshold("m", 60); moment.relativeTimeThreshold("h", 60); moment.relativeTimeThreshold("d", 24); @@ -28,18 +24,18 @@ moment.relativeTimeThreshold("M", 12); class JaBa extends Client { constructor(options) { super(options); - this.config = require("../config"); // Load the config file - 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.logger = require("../helpers/logger"); // Load the logger file - this.wait = require("node:timers/promises").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.dashboard = require("../dashboard/app"); // Dashboard app - this.states = {}; // Used for the dashboard + this.config = require("../config"); + this.customEmojis = require("../emojis"); + this.languages = require("../languages/language-meta"); + this.commands = new Collection(); + this.logger = require("../helpers/logger"); + this.wait = require("node:timers/promises").setTimeout; + this.functions = require("../helpers/functions"); + this.guildsData = require("../base/Guild"); + this.usersData = require("../base/User"); + this.membersData = require("../base/Member"); + this.dashboard = require("../dashboard/app"); + this.states = {}; this.knownGuilds = []; this.databaseCache = {}; diff --git a/base/Member.js b/base/Member.js index f00d73ad..9a010c58 100644 --- a/base/Member.js +++ b/base/Member.js @@ -1,30 +1,25 @@ const mongoose = require("mongoose"); module.exports = mongoose.model("Member", new mongoose.Schema({ - /* REQUIRED */ - id: { type: String }, // Discord ID of the user - guildID: { type: String }, // ID of the guild to which the member is connected + id: { type: String }, + guildID: { type: String }, - /* SERVER ECONOMY */ - money: { type: Number, default: 0 }, // Money of the user - workStreak: { type: Number, default: 0 }, // work streak of the user - bankSold: { type: Number, default: 0 }, // Bank sold of the user - exp: { type: Number, default: 0 }, // Exp points of the user - level: { type: Number, default: 0 }, // Level of the user - transactions: { type: Array, default: [] }, // Transactions of the user + money: { type: Number, default: 0 }, + workStreak: { type: Number, default: 0 }, + bankSold: { type: Number, default: 0 }, + exp: { type: Number, default: 0 }, + level: { type: Number, default: 0 }, + transactions: { type: Array, default: [] }, - /* STATS */ - registeredAt: { type: Number, default: Date.now() }, // Registered date of the member + registeredAt: { type: Number, default: Date.now() }, - /* COOLDOWN */ cooldowns: { type: Object, default: { work: 0, rob: 0 }}, - /* OTHER INFORMATIONS */ - sanctions: { type: Array, default: [] }, // Array of the member sanctions (mute, ban, kick, etc...) - mute: { type: Object, default: { // The member mute infos + sanctions: { type: Array, default: [] }, + mute: { type: Object, default: { muted: false, case: null, endDate: null diff --git a/base/User.js b/base/User.js index d7cf0758..c6ffd02c 100644 --- a/base/User.js +++ b/base/User.js @@ -11,19 +11,15 @@ const genToken = () => { }; const userSchema = new mongoose.Schema({ - /* REQUIRED */ - id: { type: String }, // Discord ID of the user + id: { type: String }, - /* ECONOMY (GLOBAL) */ - rep: { type: Number, default: 0 }, // Reputation points of the user - bio: { type: String }, // Biography of the user - birthdate: { type: Number }, // Birthdate of the user (the timestamp) - lover: { type: String }, // The person with whom the user is in a relationship + rep: { type: Number, default: 0 }, + bio: { type: String }, + birthdate: { type: Number }, + lover: { type: String }, - /* STATS */ - registeredAt: { type: Number, default: Date.now() }, // Registered date of the user + registeredAt: { type: Number, default: Date.now() }, - /* ACHIEVEMENTS */ achievements: { type: Object, default: { married: { achieved: false, @@ -76,16 +72,14 @@ const userSchema = new mongoose.Schema({ } }}, - /* COOLDOWN */ cooldowns: { type: Object, default: { rep: 0 }}, - /* OTHER INFORMATIONS */ - afk: { type: String, default: null }, // The AFK reason (if any) - reminds: { type: Array, default: [] }, // The reminds 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 + afk: { type: String, default: null }, + reminds: { type: Array, default: [] }, + logged: { type: Boolean, default: false }, + apiToken: { type: String, default: genToken() } }); userSchema.method("getAchievements", async function() { diff --git a/commands/General/afk.js b/commands/General/afk.js new file mode 100644 index 00000000..017fb03b --- /dev/null +++ b/commands/General/afk.js @@ -0,0 +1,48 @@ +const { SlashCommandBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Afk extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("afk") + .setDescription(client.translate("general/afk:DESCRIPTION")) + .addStringOption(option => option.setName("message") + .setDescription(client.translate("common:MESSAGE")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction, data) { + const reason = interaction.options.getString("message"); + + data.userData.afk = reason; + data.userData.save(); + + interaction.success("general/afk:SUCCESS", { + reason + }, { ephemeral: true }); + } +} + +module.exports = Afk; \ No newline at end of file diff --git a/commands/General/avatar.js b/commands/General/avatar.js new file mode 100644 index 00000000..8f86ccb1 --- /dev/null +++ b/commands/General/avatar.js @@ -0,0 +1,49 @@ +const { SlashCommandBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Avatar extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("avatar") + .setDescription(client.translate("general/avatar:DESCRIPTION")) + .addUserOption(option => option.setName("user") + .setDescription(client.translate("common:USER"))), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const user = interaction.options.getUser("user") || interaction.user; + const avatarURL = user.displayAvatarURL({ + size: 512 + }); + + interaction.reply({ + files: [{ + attachment: avatarURL + }] + }); + } +} + +module.exports = Avatar; \ No newline at end of file diff --git a/commands/General/emoji.js b/commands/General/emoji.js new file mode 100644 index 00000000..28c6a98b --- /dev/null +++ b/commands/General/emoji.js @@ -0,0 +1,71 @@ +const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Emoji extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("emoji") + .setDescription(client.translate("general/emoji:DESCRIPTION")) + .addStringOption(option => option.setName("emoji") + .setDescription(client.translate("common:EMOJI")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const rawEmoji = interaction.options.getString("emoji"); + const parsedEmoji = parseEmoji(rawEmoji); + + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("general/emoji:TITLE", { + emoji: parsedEmoji.name + }) + }) + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }) + .addFields([ + { + name: interaction.translate("general/emoji:NAME"), + value: parsedEmoji.name + }, + { + name: interaction.translate("general/emoji:ANIMATED"), + value: parsedEmoji.animated ? interaction.translate("common:YES") : interaction.translate("common:NO") + }, + { + name: interaction.translate("general/emoji:ID"), + value: parsedEmoji.id?.toString() || interaction.translate("general/emoji:STANDART") + } + ]); + + interaction.reply({ + embeds: [embed] + }); + } +} + +module.exports = Emoji; \ No newline at end of file diff --git a/commands/General/minecraft.js b/commands/General/minecraft.js new file mode 100644 index 00000000..95666476 --- /dev/null +++ b/commands/General/minecraft.js @@ -0,0 +1,102 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"), + gamedig = require("gamedig"); + +class Minecraft extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("minecraft") + .setDescription(client.translate("general/minecraft:DESCRIPTION")) + .addStringOption(option => option.setName("ip") + .setDescription(client.translate("common:IP")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + await interaction.deferReply(); + const ip = interaction.options.getString("ip"); + + const options = { + type: "minecraft", + host: ip + }; + + if (ip.split(":").length > 1) { + const splitIp = ip.split(":"); + options.host = splitIp[0]; + options.port = splitIp[1]; + } + + var res = await gamedig.query(options).catch(() => {}); + + if (!res) { + options.type = "minecraftpe"; + res = await gamedig.query(options).catch(() => {}); + } + + if (!res) return interaction.error("general/minecraft:FAILED", null, { edit: true }); + + const embed = new EmbedBuilder() + .setAuthor({ + name: res.name + }) + .addFields([ + { + name: interaction.translate("general/minecraft:FIELD_STATUS"), + value: interaction.translate("general/minecraft:ONLINE") + }, + { + name: interaction.translate("general/minecraft:FIELD_CONNECTED"), + value: `**${(res.raw.players ? res.raw.players.online : res.players.length)}** ${client.getNoun((res.raw.players ? res.raw.players.online : res.players.length), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))} / **${(res.raw.players ? res.raw.players.max : res.maxplayers)}** ${client.getNoun((res.raw.players ? res.raw.players.max : res.maxplayers), interaction.translate("misc:NOUNS:PLAYERS:1"), interaction.translate("misc:NOUNS:PLAYERS:2"), interaction.translate("misc:NOUNS:PLAYERS:5"))}` + }, + { + name: interaction.translate("general/minecraft:FIELD_IP"), + value: res.connect, + inline: true + }, + { + name: interaction.translate("general/minecraft:FIELD_VERSION"), + value: res.raw.vanilla.raw.version.name, + inline: true + + }, + { + name: interaction.translate("general/minecraft:FIELD_PING"), + value: res.raw.vanilla.ping.toString() + } + ]) + .setColor(client.config.embed.color) + .setThumbnail(`https://eu.mc-api.net/v3/server/favicon/${ip}`) + .setFooter({ + text: client.config.embed.footer + }); + + interaction.editReply({ + embeds: [embed] + }); + } +} + +module.exports = Minecraft; \ No newline at end of file diff --git a/commands/General/remindme.js b/commands/General/remindme.js new file mode 100644 index 00000000..10ef342a --- /dev/null +++ b/commands/General/remindme.js @@ -0,0 +1,61 @@ +const { SlashCommandBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"), + ms = require("ms"); + +class Remindme extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("remindme") + .setDescription(client.translate("general/remindme:DESCRIPTION")) + .addStringOption(option => option.setName("time") + .setDescription(client.translate("owner/remindme:TIME")) + .setRequired(true)) + .addStringOption(option => option.setName("message") + .setDescription(client.translate("common:MESSAGE")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction, data) { + const time = interaction.options.getString("time"); + const message = interaction.options.getString("message"); + const dateNow = Date.now(); + if (!data.userData.reminds) data.userData.reminds = []; + + const rData = { + message: message, + createdAt: dateNow, + sendAt: dateNow + ms(time) + }; + + data.userData.reminds.push(rData); + data.userData.markModified("reminds"); + data.userData.save(); + client.databaseCache.usersReminds.set(message.author.id, data.userData); + + interaction.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 new file mode 100644 index 00000000..de679288 --- /dev/null +++ b/commands/General/report.js @@ -0,0 +1,99 @@ +const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Report extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("report") + .setDescription(client.translate("general/report:DESCRIPTION")) + .addUserOption(option => option.setName("user") + .setDescription(client.translate("common:USER")) + .setRequired(true)) + .addStringOption(option => option.setName("message") + .setDescription(client.translate("common:MESSAGE")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + if (interaction.user.id === "285109105717280768") return interaction.reply({ content: "Пошёл нахуй фахон" }); + const repChannel = interaction.guild.channels.cache.get(interaction.guild.data.plugins.reports); + if (!repChannel) return interaction.error("general/report:MISSING_CHANNEL"); + const member = interaction.options.getMember("user"); + if (member.id === interaction.user.id) return interaction.error("general/report:INVALID_USER"); + const rep = interaction.options.getString("message"); + + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("general/report:TITLE", { + user: member.user.tag + }), + iconURL: interaction.user.displayAvatarURL({ + extension: "png", + size: 512 + }) + }) + .addFields([ + { + name: interaction.translate("common:DATE"), + value: client.printDate(new Date(Date.now())) + }, + { + name: interaction.translate("common:AUTHOR"), + value: interaction.user.toString(), + inline: true + }, + { + name: interaction.translate("common:USER"), + value: member.user.toString(), + inline: true + }, + { + name: interaction.translate("common:REASON"), + value: rep, + inline: true + } + ]) + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }); + + const success = parseEmoji(client.customEmojis.cool).id; + const error = parseEmoji(client.customEmojis.notcool).id; + + repChannel.send({ + embeds: [embed] + }).then(async (m) => { + await m.react(success); + await m.react(error); + }); + + interaction.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 new file mode 100644 index 00000000..0997f62f --- /dev/null +++ b/commands/General/serverinfo.js @@ -0,0 +1,106 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Serverinfo extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("serverinfo") + .setDescription(client.translate("general/serverinfo:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const guild = interaction.guild; + + await guild.members.fetch(); + const owner = await guild.fetchOwner(); + + const embed = new EmbedBuilder() + .setAuthor({ + name: guild.name, + iconURL: guild.iconURL() + }) + .setThumbnail(guild.iconURL()) + .addFields([ + { + name: client.customEmojis.link + " " + interaction.translate("general/serverinfo:LINK"), + value: `[${interaction.translate("general/serverinfo:LINK_TEXT")}](${client.config.dashboard.baseURL}/stats/${guild.id})` + }, + { + name: client.customEmojis.title + interaction.translate("common:NAME"), + value: guild.name, + inline: true + }, + { + name: client.customEmojis.calendar + interaction.translate("common:CREATION"), + value: client.printDate(guild.createdAt), + inline: true + }, + { + name: client.customEmojis.users + interaction.translate("common:MEMBERS"), + value: `${guild.members.cache.filter(m => !m.user.bot).size} ${client.getNoun(guild.members.cache.filter(m => !m.user.bot).size, interaction.translate("misc:NOUNS:MEMBERS:1"), interaction.translate("misc:NOUNS:MEMBERS:2"), interaction.translate("misc:NOUNS:MEMBERS:5"))}` + + "\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${client.getNoun(guild.members.cache.filter(m => m.user.bot).size, interaction.translate("misc:NOUNS:BOTS:1"), interaction.translate("misc:NOUNS:BOTS:2"), interaction.translate("misc:NOUNS:BOTS:5"))}`, + inline: true + }, + { + name: client.customEmojis.afk + interaction.translate("general/serverinfo:AFK_CHANNEL"), + value: guild.afkChannel?.toString() || interaction.translate("common:MISSING"), + inline: true + }, + { + name: client.customEmojis.id + interaction.translate("common:ID"), + value: guild.id, + inline: true + }, + { + name: client.customEmojis.crown + interaction.translate("common:OWNER"), + value: owner.toString(), + inline: true + }, + { + name: client.customEmojis.boost + interaction.translate("general/serverinfo:BOOSTS"), + value: guild.premiumSubscriptionCount?.toString() || "0", + inline: true + }, + { + name: client.customEmojis.channels + interaction.translate("common:CHANNELS"), + value: `${guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size} ${client.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_TEXT").size, interaction.translate("misc:NOUNS:TEXT:1"), interaction.translate("misc:NOUNS:TEXT:2"), interaction.translate("misc:NOUNS:TEXT:5"))}` + + "\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size} ${client.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_VOICE").size, interaction.translate("misc:NOUNS:VOICE:1"), interaction.translate("misc:NOUNS:VOICE:2"), interaction.translate("misc:NOUNS:VOICE:5"))}` + + "\n" + `${guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size} ${client.getNoun(guild.channels.cache.filter(c => c.type === "GUILD_CATEGORY").size, interaction.translate("misc:NOUNS:CATEGORY:1"), interaction.translate("misc:NOUNS:CATEGORY:2"), interaction.translate("misc:NOUNS:CATEGORY:5"))}`, + inline: true + } + ]) + + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }); + + interaction.reply({ + embeds: [embed] + }); + } +} + +module.exports = Serverinfo; \ No newline at end of file diff --git a/commands/General/shorturl.js b/commands/General/shorturl.js new file mode 100644 index 00000000..f27110a4 --- /dev/null +++ b/commands/General/shorturl.js @@ -0,0 +1,48 @@ +const { SlashCommandBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"), + fetch = require("node-fetch"); + +class Shorturl extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("shorturl") + .setDescription(client.translate("general/shorturl:DESCRIPTION")) + .addStringOption(option => option.setName("url") + .setDescription(client.translate("general/shorturl:URL")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const url = interaction.options.getString("url"); + const res = await fetch(`https://is.gd/create.php?format=simple&url=${encodeURI(url)}`).then(res => res.text()); + + interaction.reply({ + content: `<${res}>`, + ephemeral: true + }); + } +} + +module.exports = Shorturl; \ No newline at end of file diff --git a/commands/General/staff.js b/commands/General/staff.js new file mode 100644 index 00000000..1429ec11 --- /dev/null +++ b/commands/General/staff.js @@ -0,0 +1,64 @@ +const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Staff extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("staff") + .setDescription(client.translate("general/staff:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + await interaction.guild.members.fetch(); + const administrators = interaction.guild.members.cache.filter((m) => m.permissions.has(PermissionsBitField.Flags.Administrator) && !m.user.bot); + const moderators = interaction.guild.members.cache.filter((m) => !administrators.has(m.id) && m.permissions.has(PermissionsBitField.Flags.ManageMessages) && !m.user.bot); + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("general/staff:TITLE", { + guild: interaction.guild.name + }) + }) + .addFields([ + { + name: interaction.translate("general/staff:ADMINS"), + value: (administrators.size > 0 ? administrators.map((a) => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : interaction.translate("general/staff:NO_ADMINS")) + }, + { + name: interaction.translate("general/staff:MODS"), + value: (moderators.size > 0 ? moderators.map((m) => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS")) + } + ]) + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }); + + interaction.reply({ + embeds: [embed] + }); + } +} + +module.exports = Staff; \ No newline at end of file diff --git a/commands/General/stats.js b/commands/General/stats.js new file mode 100644 index 00000000..9aaab6a8 --- /dev/null +++ b/commands/General/stats.js @@ -0,0 +1,104 @@ + +const { SlashCommandBuilder, EmbedBuilder, PermissionsBitField, version } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Stats extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("stats") + .setDescription(client.translate("general/stats:DESCRIPTION")), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const hiddenGuild = await client.guilds.fetch("568120814776614924"); + const users = client.users.cache.size - hiddenGuild.memberCount; + const servers = client.guilds.cache.size - 1; + + const statsEmbed = new EmbedBuilder() + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }) + .setAuthor({ + name: interaction.translate("common:STATS") + }) + .setDescription(interaction.translate("general/stats:MADE")) + .addFields([ + { + name: client.customEmojis.stats + " " + interaction.translate("general/stats:COUNTS_TITLE"), + value: interaction.translate("general/stats:COUNTS_CONTENT", { + servers: servers, + users: users + }), + inline: true + }, + { + name: client.customEmojis.version + " " + interaction.translate("general/stats:VERSIONS_TITLE"), + value: `\`Discord.js: v${version}\`\n\`Nodejs: v${process.versions.node}\``, + inline: true + }, + { + name: client.customEmojis.ram + " " + interaction.translate("general/stats:RAM_TITLE"), + value: `\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}MB\``, + inline: true + }, + { + name: client.customEmojis.status.online + " " + interaction.translate("general/stats:ONLINE_TITLE"), + value: interaction.translate("general/stats:ONLINE_CONTENT", { + time: client.convertTime(Date.now() + client.uptime, true, true) + }) + }, + { + name: client.customEmojis.voice + " " + interaction.translate("general/stats:MUSIC_TITLE"), + value: interaction.translate("general/stats:MUSIC_CONTENT", { + count: `${client.player.queues.size} ${client.getNoun(client.player.queues.size, interaction.translate("misc:NOUNS:SERVERS:1"), interaction.translate("misc:NOUNS:SERVERS:2"), interaction.translate("misc:NOUNS:SERVERS:5"))}` + }) + }, + { + name: interaction.translate("general/stats:CREDITS_TITLE"), + value: interaction.translate("general/stats:CREDITS_CONTENT", { + donators: ["**`Добрый Спецназ#8801`** - Тестер, генератор идей"].join("\n"), + translators: ["**`[ДАННЫЕ УДАЛЕНЫ]#4507`** - :flag_ua: (НЕ ОБНОВЛЕН!)"].join("\n") + }) + }, + { + name: client.customEmojis.link + " " + interaction.translate("general/stats:LINKS_TITLE"), + value: interaction.translate("misc:STATS_FOOTER", { + dashboardLink: client.config.dashboard.baseURL, + docsLink: `${client.config.dashboard.baseURL}/docs/`, + inviteLink: client.generateInvite({ scopes: ["bot", "applications.commands"], permissions: [ PermissionsBitField.Flags.Administrator ] }), + donateLink: "https://qiwi.com/n/JONNYBRO/", + owner: client.config.owner.id + }) + } + ]); + + interaction.reply({ + embeds: [statsEmbed] + }); + } +} + +module.exports = Stats; \ No newline at end of file diff --git a/commands/General/suggest.js b/commands/General/suggest.js new file mode 100644 index 00000000..a086af12 --- /dev/null +++ b/commands/General/suggest.js @@ -0,0 +1,88 @@ +const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Suggest extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("suggest") + .setDescription(client.translate("general/suggest:DESCRIPTION")) + .addStringOption(option => option.setName("message") + .setDescription(client.translate("common:MESSAGE")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + if (interaction.user.id === "285109105717280768") return interaction.reply({ content: "Пошёл нахуй фахон" }); + const suggChannel = interaction.guild.channels.cache.get(interaction.guild.data.plugins.suggestions); + if (!suggChannel) return interaction.error("general/suggest:MISSING_CHANNEL"); + const suggestion = interaction.options.getString("message"); + + const embed = new EmbedBuilder() + .setAuthor({ + name: interaction.translate("general/suggest:TITLE", { + user: interaction.user.tag + }), + iconURL: interaction.member.displayAvatarURL({ + size: 512 + }) + }) + .addFields([ + { + name: interaction.translate("common:DATE"), + value: client.printDate(new Date(Date.now())) + }, + { + name: interaction.translate("common:AUTHOR"), + value: interaction.user.toString(), + inline: true + }, + { + name: interaction.translate("common:CONTENT"), + value: suggestion, + inline: true + } + ]) + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }); + + const success = parseEmoji(client.customEmojis.cool).id; + const error = parseEmoji(client.customEmojis.notcool).id; + + suggChannel.send({ + embeds: [embed] + }).then(async (m) => { + await m.react(success); + await m.react(error); + }); + + interaction.success("general/suggest:SUCCESS", { + channel: suggChannel.toString() + }); + } +} + +module.exports = Suggest; \ No newline at end of file diff --git a/commands/General/userinfo.js b/commands/General/userinfo.js new file mode 100644 index 00000000..b75c9ca0 --- /dev/null +++ b/commands/General/userinfo.js @@ -0,0 +1,120 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"); + +class Userinfo extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("userinfo") + .setDescription(client.translate("general/userinfo:DESCRIPTION")) + .addUserOption(option => option.setName("user") + .setDescription(client.translate("common:USER"))), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + const member = interaction.options.getMember("user") || interaction.member; + const embed = new EmbedBuilder() + .setAuthor({ + name: `${member.user.tag} (${member.id})`, + iconURL: member.displayAvatarURL({ + size: 512 + }) + }) + .setThumbnail(member.displayAvatarURL({ + size: 512 + })) + .addFields([ + { + name: ":man: " + interaction.translate("common:USERNAME"), + value: member.user.tag, + inline: true + }, + { + name: client.customEmojis.pencil + " " + interaction.translate("common:NICKNAME"), + value: member.nickname || interaction.translate("general/userinfo:NO_NICKNAME"), + inline: true + }, + { + name: client.customEmojis.status[member.presence.status] + " " + interaction.translate("common:STATUS"), + value: interaction.translate(`common:STATUS_${member.presence.status.toUpperCase()}`), + inline: true + }, + { + name: client.customEmojis.bot + " " + interaction.translate("common:ROBOT"), + value: member.user.bot ? interaction.translate("common:YES") : interaction.translate("common:NO"), + inline: true + }, + { + name: client.customEmojis.calendar + " " + interaction.translate("common:CREATION"), + value: client.printDate(member.user.createdAt), + inline: true + }, + { + name: client.customEmojis.calendar2 + " " + interaction.translate("common:JOIN"), + value: client.printDate(member.joinedAt), + inline: true + }, + { + name: client.customEmojis.color + " " + interaction.translate("common:COLOR"), + value: member.displayHexColor, + inline: true + }, + { + name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"), + value: (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 10).join(", ") + " " + interaction.translate("general/userinfo:MORE_ROLES", { + count: member.roles.cache.size - 10 + }) : (member.roles.cache.size < 1) ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", ")), + inline: true + } + ]) + .setColor(client.config.embed.color) + .setFooter({ + text: client.config.embed.footer + }); + + if (member.presence.activities[0].name === "Custom Status") { + embed.addFields([ + { + name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"), + value: member.presence.activities[0] ? `${interaction.translate("general/userinfo:CUSTOM")}\n${member.presence.activities[0].state || interaction.translate("common:NOT_DEFINED")}` : interaction.translate("general/userinfo:NO_ACTIVITY"), + inline: true + } + ]); + } else { + embed.addFields([ + { + name: client.customEmojis.games + " " + interaction.translate("common:ACTIVITY"), + value: member.presence.activities[0] ? `${member.presence.activities[0].name}\n${member.presence.activities[0].details}\n${member.presence.activities[0].state}` : interaction.translate("general/userinfo:NO_GAME"), + inline: true + } + ]); + } + + interaction.reply({ + embeds: [embed] + }); + } +} + +module.exports = Userinfo; \ No newline at end of file diff --git a/commands/General/whois.js b/commands/General/whois.js new file mode 100644 index 00000000..9cd006f5 --- /dev/null +++ b/commands/General/whois.js @@ -0,0 +1,73 @@ +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); +const BaseCommand = require("../../base/BaseCommand"), + fetch = require("node-fetch"); + +class Whois extends BaseCommand { + /** + * + * @param {import("../base/JaBa")} client + */ + constructor(client) { + super({ + command: new SlashCommandBuilder() + .setName("whois") + .setDescription(client.translate("general/whois:DESCRIPTION")) + .addStringOption(option => option.setName("ip") + .setDescription(client.translate("common:IP")) + .setRequired(true)), + aliases: [], + dirname: __dirname, + guildOnly: true, + ownerOnly: false + }); + } + /** + * + * @param {import("../../base/JaBa")} client + */ + async onLoad() { + //... + } + /** + * + * @param {import("../../base/JaBa")} client + * @param {import("discord.js").ChatInputCommandInteraction} interaction + * @param {Array} data + */ + async execute(client, interaction) { + await interaction.deferReply(); + const ip = interaction.options.getString("ip"); + const whois = await fetch(`http://ip-api.com/json/${ip}?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") return interaction.reply({ content: interaction.translate("general/whois:ERROR", { ip }) }); + const embed = new EmbedBuilder() + .setTitle(interaction.translate("general/whois:INFO_ABOUT", { + ip + })) + .setFooter({ + text: client.config.embed.footer + }) + .setColor(client.config.embed.color) + .addFields( + { name: interaction.translate("common:IP"), value: whois.query, inline: true }, + { name: interaction.translate("general/whois:COUNTRY"), value: `${whois.country || interaction.translate("common:UNKNOWN")} (${whois.countryCode || interaction.translate("common:UNKNOWN")})`, inline: true }, + { name: interaction.translate("general/whois:REGION"), value: `${whois.regionName || interaction.translate("common:UNKNOWN")} (${whois.region || interaction.translate("common:UNKNOWN")})`, inline: true }, + { name: interaction.translate("general/whois:CITY"), value: `${whois.city || interaction.translate("common:UNKNOWN")}`, inline: true }, + { name: interaction.translate("general/whois:ZIP"), value: `${whois.zip || interaction.translate("common:UNKNOWN")}`, inline: true }, + { name: interaction.translate("general/whois:TIMEZONE"), value: `${whois.timezone || interaction.translate("common:UNKNOWN")}`, inline: true }, + { name: interaction.translate("general/whois:CONTINENT"), value: `${whois.continent || interaction.translate("common:UNKNOWN")} (${whois.continentCode || interaction.translate("common:UNKNOWN")})`, inline: true }, + { name: interaction.translate("general/whois:CURRENCY"), value: `${whois.currency || interaction.translate("common:UNKNOWN")}`, inline: true }, + { name: interaction.translate("general/whois:ISP"), value: `${whois.isp || interaction.translate("common:UNKNOWN")}`, inline: true } + ) + .setTimestamp(); + + if (whois.proxy) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:PROXY") }); + else if (whois.mobile) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:MOBILE") }); + else if (whois.hosting) embed.addFields({ name: interaction.translate("general/whois:INFO"), value: interaction.translate("general/whois:HOSTING") }); + + interaction.editReply({ + embeds: [embed] + }); + } +} + +module.exports = Whois; \ No newline at end of file diff --git a/commands/Music/queue.js b/commands/Music/queue.js index d4691796..03036761 100644 --- a/commands/Music/queue.js +++ b/commands/Music/queue.js @@ -35,8 +35,8 @@ class Queue extends BaseCommand { if (!queue) return interaction.error("music/play:NOT_PLAYING"); const currentTrack = queue.current; - const tracks = queue.tracks.slice(0, 10).map((t, i) => { - return `${i}. [${t.title}](${t.url})\n> ${interaction.translate("music/queue:ADDED")} ${t.requestedBy}`; + const tracks = queue.tracks.slice(0, 10).map(track => { + return `${queue.tracks.indexOf(track)}. [${track.title}](${track.url})\n> ${interaction.translate("music/queue:ADDED")} ${track.requestedBy}`; }); const embed = new EmbedBuilder() diff --git a/commands/Owner/announcement.js b/commands/Owner/announcement.js index 31d46e45..bd5c3067 100644 --- a/commands/Owner/announcement.js +++ b/commands/Owner/announcement.js @@ -11,10 +11,9 @@ class Announcement extends BaseCommand { command: new SlashCommandBuilder() .setName("announcement") .setDescription(client.translate("owner/announcement:DESCRIPTION")) - .addStringOption(option => - option.setName("message") - .setDescription(client.translate("owner/say:MESSAGE")) - .setRequired(true)), + .addStringOption(option => option.setName("message") + .setDescription(client.translate("common:MESSAGE")) + .setRequired(true)), aliases: [], dirname: __dirname, guildOnly: true, diff --git a/commands/Owner/debug.js b/commands/Owner/debug.js index 5704340b..6f71c6f8 100644 --- a/commands/Owner/debug.js +++ b/commands/Owner/debug.js @@ -11,51 +11,43 @@ class Debug extends BaseCommand { command: new SlashCommandBuilder() .setName("debug") .setDescription(client.translate("owner/debug:DESCRIPTION")) - .addSubcommand(subcommand => - subcommand.setName("set") - .setDescription(client.translate("owner/debug:SET")) - .addStringOption(option => - option.setName("type") - .setDescription(client.translate("owner/debug:TYPE")) - .setRequired(true) - .addChoices( - { name: client.translate("common:LEVEL"), value: "level" }, - { name: client.translate("common:XP"), value: "xp" }, - { name: client.translate("common:CREDITS"), value: "credits" }, - { name: client.translate("economy/transactions:BANK"), value: "bank" }, - { name: client.translate("common:REP"), value: "rep" }, - )) - .addUserOption(option => - option.setName("target") - .setDescription(client.translate("owner/debug:TARGET")) - .setRequired(true)) - .addIntegerOption(option => - option.setName("int") - .setDescription(client.translate("owner/debug:INT")) - .setRequired(true)) + .addSubcommand(subcommand => subcommand.setName("set") + .setDescription(client.translate("owner/debug:SET")) + .addStringOption(option => option.setName("type") + .setDescription(client.translate("owner/debug:TYPE")) + .setRequired(true) + .addChoices( + { name: client.translate("common:LEVEL"), value: "level" }, + { name: client.translate("common:XP"), value: "xp" }, + { name: client.translate("common:CREDITS"), value: "credits" }, + { name: client.translate("economy/transactions:BANK"), value: "bank" }, + { name: client.translate("common:REP"), value: "rep" }, + )) + .addUserOption(option => option.setName("target") + .setDescription(client.translate("owner/debug:TARGET")) + .setRequired(true)) + .addIntegerOption(option => option.setName("int") + .setDescription(client.translate("owner/debug:INT")) + .setRequired(true)) ) - .addSubcommand(subcommand => - subcommand.setName("add") - .setDescription(client.translate("owner/debug:ADD")) - .addStringOption(option => - option.setName("type") - .setDescription(client.translate("owner/debug:TYPE")) - .setRequired(true) - .addChoices( - { name: client.translate("common:LEVEL"), value: "level" }, - { name: client.translate("common:XP"), value: "xp" }, - { name: client.translate("common:CREDITS"), value: "credits" }, - { name: client.translate("economy/transactions:BANK"), value: "bank" }, - { name: client.translate("common:REP"), value: "rep" }, - )) - .addUserOption(option => - option.setName("user") - .setDescription(client.translate("common:USER")) - .setRequired(true)) - .addIntegerOption(option => - option.setName("int") - .setDescription(client.translate("owner/debug:INT")) - .setRequired(true)) + .addSubcommand(subcommand => subcommand.setName("add") + .setDescription(client.translate("owner/debug:ADD")) + .addStringOption(option => option.setName("type") + .setDescription(client.translate("owner/debug:TYPE")) + .setRequired(true) + .addChoices( + { name: client.translate("common:LEVEL"), value: "level" }, + { name: client.translate("common:XP"), value: "xp" }, + { name: client.translate("common:CREDITS"), value: "credits" }, + { name: client.translate("economy/transactions:BANK"), value: "bank" }, + { name: client.translate("common:REP"), value: "rep" }, + )) + .addUserOption(option => option.setName("user") + .setDescription(client.translate("common:USER")) + .setRequired(true)) + .addIntegerOption(option => option.setName("int") + .setDescription(client.translate("owner/debug:INT")) + .setRequired(true)) ), aliases: [], dirname: __dirname, diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js index fe76982e..505c187e 100644 --- a/commands/Owner/eval.js +++ b/commands/Owner/eval.js @@ -11,10 +11,9 @@ class Eval extends BaseCommand { command: new SlashCommandBuilder() .setName("eval") .setDescription(client.translate("owner/eval:DESCRIPTION")) - .addStringOption(option => - option.setName("code") - .setDescription(client.translate("owner/eval:CODE")) - .setRequired(true)), + .addStringOption(option => option.setName("code") + .setDescription(client.translate("owner/eval:CODE")) + .setRequired(true)), aliases: [], dirname: __dirname, guildOnly: true, diff --git a/commands/Owner/reload.js b/commands/Owner/reload.js index de1fe5e2..2f1fa425 100644 --- a/commands/Owner/reload.js +++ b/commands/Owner/reload.js @@ -13,10 +13,9 @@ class Reload extends BaseCommand { command: new SlashCommandBuilder() .setName("reload") .setDescription(client.translate("owner/reload:DESCRIPTION")) - .addStringOption(option => - option.setName("command") - .setDescription(client.translate("owner/reload:COMMAND")) - .setRequired(true)), + .addStringOption(option => option.setName("command") + .setDescription(client.translate("owner/reload:COMMAND")) + .setRequired(true)), aliases: [], dirname: __dirname, guildOnly: true, diff --git a/commands/Owner/say.js b/commands/Owner/say.js index b42a6f52..68ce38e5 100644 --- a/commands/Owner/say.js +++ b/commands/Owner/say.js @@ -11,13 +11,11 @@ class Say extends BaseCommand { command: new SlashCommandBuilder() .setName("say") .setDescription(client.translate("owner/say:DESCRIPTION")) - .addStringOption(option => - option.setName("message") - .setDescription(client.translate("owner/say:MESSAGE")) - .setRequired(true)) - .addChannelOption(option => - option.setName("channel") - .setDescription(client.translate("owner/say:CHANNEL"))), + .addStringOption(option => option.setName("message") + .setDescription(client.translate("common:MESSAGE")) + .setRequired(true)) + .addChannelOption(option => option.setName("channel") + .setDescription(client.translate("common:CHANNEL"))), aliases: [], dirname: __dirname, guildOnly: true, diff --git a/dashboard/views/manager/guild.ejs b/dashboard/views/manager/guild.ejs index a521ce3e..ed222210 100644 --- a/dashboard/views/manager/guild.ejs +++ b/dashboard/views/manager/guild.ejs @@ -98,17 +98,11 @@
- -
- - -