From 50f84d317b7fe2ea01295331741798cc3713aea6 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Tue, 4 Jan 2022 21:16:52 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=B2=D1=81=D0=B5?= =?UTF-8?q?=D1=85=20=D0=BD=D0=B0=D0=B9=D0=B4=D0=B5=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 - README.md | 2 +- base/Guild.js | 1 - base/User.js | 2 + commands/Administration/configuration.js | 3 - commands/Administration/setfortniteshop.js | 81 ------------------- commands/Economy/achievements.js | 51 +++++++----- commands/Economy/pay.js | 4 +- commands/Economy/profile.js | 10 ++- commands/Economy/work.js | 2 +- commands/Fun/number.js | 3 +- commands/Fun/tictactoe.js | 2 +- commands/General/fortnite.js | 81 ------------------- commands/General/fortniteshop.js | 68 ---------------- commands/General/serverinfo.js | 5 +- commands/Moderation/announcement.js | 2 +- commands/Moderation/checkinvites.js | 53 ------------ commands/Moderation/clearsanctions.js | 4 +- commands/Moderation/poll.js | 2 +- commands/Moderation/warn.js | 2 +- commands/Music/np.js | 11 +++ commands/Music/seek.js | 2 +- commands/Owner/reload.js | 4 +- dashboard/routes/guild-manager.js | 3 - dashboard/views/manager/guild.ejs | 18 ----- events/ready.js | 4 - helpers/checkReminds.js | 2 +- helpers/checkUnmutes.js | 4 +- helpers/fortniteShop.js | 46 ----------- index.js | 14 +++- .../en-US/administration/configuration.json | 1 - .../en-US/administration/setfortniteshop.json | 7 -- languages/en-US/common.json | 1 - languages/en-US/general/fortnite.json | 21 ----- languages/en-US/general/fortniteshop.json | 10 --- languages/ru-RU/administration/backup.json | 2 +- .../ru-RU/administration/configuration.json | 1 - languages/ru-RU/administration/set.json | 2 +- .../ru-RU/administration/setfortniteshop.json | 7 -- languages/ru-RU/common.json | 1 - languages/ru-RU/economy/pay.json | 4 +- languages/ru-RU/economy/rob.json | 3 +- languages/ru-RU/fun/ascii.json | 2 +- languages/ru-RU/general/fortnite.json | 21 ----- languages/ru-RU/general/fortniteshop.json | 10 --- languages/ru-RU/moderation/checkinvites.json | 6 -- languages/ru-RU/moderation/unban.json | 4 +- languages/ru-RU/music/np.json | 1 + languages/ru-RU/music/seek.json | 2 +- languages/ru-RU/owner/debug.json | 2 +- languages/ru-RU/owner/reload.json | 2 +- package.json | 1 - scripts/verify-config.js | 15 ---- 53 files changed, 97 insertions(+), 519 deletions(-) delete mode 100644 commands/Administration/setfortniteshop.js delete mode 100644 commands/General/fortnite.js delete mode 100644 commands/General/fortniteshop.js delete mode 100644 commands/Moderation/checkinvites.js delete mode 100644 helpers/fortniteShop.js delete mode 100644 languages/en-US/administration/setfortniteshop.json delete mode 100644 languages/en-US/general/fortnite.json delete mode 100644 languages/en-US/general/fortniteshop.json delete mode 100644 languages/ru-RU/administration/setfortniteshop.json delete mode 100644 languages/ru-RU/general/fortnite.json delete mode 100644 languages/ru-RU/general/fortniteshop.json delete mode 100644 languages/ru-RU/moderation/checkinvites.json diff --git a/.gitignore b/.gitignore index a36d51cf..4ce366a1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,10 +6,6 @@ node_modules package-lock.json yarn.lock -# Fortnite Shop images -assets/img/fortnite/shop/**/*.png -!assets/img/fortnite/shop/**/example-shop.png - # DB giveaways.json diff --git a/README.md b/README.md index c7f677a0..a4527cc5 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# JaBa-new +# JaBa diff --git a/base/Guild.js b/base/Guild.js index 8bfbf0b4..5a93cd5f 100644 --- a/base/Guild.js +++ b/base/Guild.js @@ -53,7 +53,6 @@ module.exports = mongoose.model("Guild", new Schema({ 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 - fortniteshop: false, // the channel in which the fortnite shop image will be sent at 2.05am logs: false // the channel in which the logs (message deleted, etc...) will be sent }}, slowmode: { type: Object, default: { // Servers slowmode diff --git a/base/User.js b/base/User.js index bedb9cd4..dae7be95 100644 --- a/base/User.js +++ b/base/User.js @@ -108,10 +108,12 @@ userSchema.method("getAchievements", async function() { await Canvas.loadImage(`./assets/img/achievements/achievement${this.achievements.invite.achieved ? "_colored" : ""}7.png`) ]; let dim = 0; + for (let i = 0; i < images.length; i++) { await ctx.drawImage(images[i], dim, 10, 350, 200); dim += 200; }; + return canvas.toBuffer(); }); diff --git a/commands/Administration/configuration.js b/commands/Administration/configuration.js index 11520f47..594e0be4 100644 --- a/commands/Administration/configuration.js +++ b/commands/Administration/configuration.js @@ -66,9 +66,6 @@ class Configuration extends Command { }) + "\n" + message.translate("administration/configuration:BIRTHDAYS", { channel: guildData.plugins.birthdays ? `<#${guildData.plugins.birthdays}>` : message.translate("common:NOT_DEFINED") - }) + "\n" + - message.translate("administration/configuration:FORTNITESHOP", { - channel: guildData.plugins.fortniteshop ? `<#${guildData.plugins.fortniteshop}>` : message.translate("common:NOT_DEFINED") }) ); diff --git a/commands/Administration/setfortniteshop.js b/commands/Administration/setfortniteshop.js deleted file mode 100644 index 33b462d8..00000000 --- a/commands/Administration/setfortniteshop.js +++ /dev/null @@ -1,81 +0,0 @@ -const Command = require("../../base/Command.js"), - Discord = require("discord.js"), - Canvas = require("discord-canvas"); - -class Setfortniteshop extends Command { - constructor(client) { - super(client, { - name: "setfortniteshop", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["setfnshop"], - memberPermissions: ["MANAGE_GUILD"], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - if (!data.config.apiKeys.fortniteFNBR || data.config.apiKeys.fortniteFNBR.length === "") return message.error("misc:COMMAND_DISABLED"); - - if (data.guild.plugins.fortniteshop && !message.mentions.channels.first() || message.mentions.channels.first() && data.guild.plugins.fortniteshop === message.mentions.channels.first().id) { - data.guild.plugins.fortniteshop = false; - data.guild.markModified("plugins.fortniteshop"); - data.guild.save(); - return message.success("administration/setfortniteshop:DISABLED"); - }; - - const channel = message.mentions.channels.first() || message.channel; - data.guild.plugins.fortniteshop = channel.id; - data.guild.markModified("plugins.fortniteshop"); - data.guild.save(); - - message.success("administration/setfortniteshop:ENABLED", { - channel: channel.toString() - }); - - const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment; - const shop = new Canvas.FortniteShop(); - const image = await shop - .setToken(data.config.apiKeys.fortniteFNBR) - .setText("header", message.translate("general/fortniteshop:HEADER")) - .setText("daily", message.translate("general/fortniteshop:DAILY")) - .setText("featured", message.translate("general/fortniteshop:FEATURED")) - .setText("date", message.translate("general/fortniteshop:DATE", { - skipInterpolation: true - }).replace("{{date}}", "{date}")) - .setText("footer", message.translate("general/fortniteshop:FOOTER")) - .lang(momentName) - .toAttachment(); - const attachment = new Discord.MessageAttachment(image, "shop.png"); - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: this.client.translate("general/fortniteshop:DATE", { - date: this.client.printDate(new Date(Date.now()), null, message.guild.data.language) - }, message.guild.data.language), - iconURL: this.client.user.displayAvatarURL({ - size: 512, - dynamic: true, - format: "png" - }) - }) - .setImage("attachment://shop.png") - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - const msg = await channel.send({ - embeds: [embed], - files: [attachment] - }); - await msg.react("😍"); - await msg.react("😐"); - await msg.react("😭"); - } -}; - -module.exports = Setfortniteshop; \ No newline at end of file diff --git a/commands/Economy/achievements.js b/commands/Economy/achievements.js index 663d822e..82115099 100644 --- a/commands/Economy/achievements.js +++ b/commands/Economy/achievements.js @@ -18,6 +18,15 @@ class Achievements extends Command { } 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 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") @@ -28,39 +37,39 @@ class Achievements extends Command { }); embed.addField(message.translate("economy/achievements:SEND_CMD"), message.translate("economy/achievements:PROGRESS", { - now: data.userData.achievements.firstCommand.progress.now, - total: data.userData.achievements.firstCommand.progress.total, - percent: Math.round(100 * (data.userData.achievements.firstCommand.progress.now / data.userData.achievements.firstCommand.progress.total)) + 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: data.userData.achievements.work.progress.now, - total: data.userData.achievements.work.progress.total, - percent: Math.round(100 * (data.userData.achievements.work.progress.now / data.userData.achievements.work.progress.total)) + 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: data.userData.achievements.married.progress.now, - total: data.userData.achievements.married.progress.total, - percent: Math.round(100 * (data.userData.achievements.married.progress.now / data.userData.achievements.married.progress.total)) + 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: data.userData.achievements.slots.progress.now, - total: data.userData.achievements.slots.progress.total, - percent: Math.round(100 * (data.userData.achievements.slots.progress.now / data.userData.achievements.slots.progress.total)) + 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: data.userData.achievements.tip.progress.now, - total: data.userData.achievements.tip.progress.total, - percent: Math.round(100 * (data.userData.achievements.tip.progress.now / data.userData.achievements.tip.progress.total)) + 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: data.userData.achievements.rep.progress.now, - total: data.userData.achievements.rep.progress.total, - percent: Math.round(100 * (data.userData.achievements.rep.progress.now / data.userData.achievements.rep.progress.total)) + 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: data.userData.achievements.invite.progress.now, - total: data.userData.achievements.invite.progress.total, - percent: Math.round(100 * (data.userData.achievements.invite.progress.now / data.userData.achievements.invite.progress.total)) + 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.channel.send({ diff --git a/commands/Economy/pay.js b/commands/Economy/pay.js index 54deba0b..74c4ae59 100644 --- a/commands/Economy/pay.js +++ b/commands/Economy/pay.js @@ -27,7 +27,7 @@ class Pay extends Command { 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"))}` + 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({ @@ -42,7 +42,7 @@ class Pay extends Command { 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"))}`, + 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 }); } diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js index 572ed1f7..dd6ae721 100644 --- a/commands/Economy/profile.js +++ b/commands/Economy/profile.js @@ -82,12 +82,14 @@ class Profile extends Command { }) // Sets the footer of the embed .setTimestamp(); - const buffer = userData.getAchievements(); + const buffer = await userData.getAchievements(); + message.channel.send({ embeds: [profileEmbed], - // files: [{ - // attachment: buffer - // }] + files: [{ + name: "achievements.png", + attachment: buffer + }] }); // Send the embed in the current channel } }; diff --git a/commands/Economy/work.js b/commands/Economy/work.js index 48f18842..9a9b7220 100644 --- a/commands/Economy/work.js +++ b/commands/Economy/work.js @@ -83,7 +83,7 @@ class Work extends Command { data.memberData.save(); const messageOptions = { - emdeds: embed + embeds: [embed] }; if (!data.userData.achievements.work.achieved) { data.userData.achievements.work.progress.now += 1; diff --git a/commands/Fun/number.js b/commands/Fun/number.js index 5b588425..2263478e 100644 --- a/commands/Fun/number.js +++ b/commands/Fun/number.js @@ -68,8 +68,9 @@ class Number extends Command { }); userdata.money = userdata.money + won; userdata.save(); - collector.stop(msg.author.username); }; + + collector.stop(); }; if (parseInt(msg.content) < number) message.error("fun/number:BIG", { user: msg.author.toString(), diff --git a/commands/Fun/tictactoe.js b/commands/Fun/tictactoe.js index 9860ad8f..f394ee9f 100644 --- a/commands/Fun/tictactoe.js +++ b/commands/Fun/tictactoe.js @@ -6,7 +6,7 @@ class TicTacToe extends Command { super(client, { name: "tictactoe", dirname: __dirname, - enabled: true, + enabled: false, guildOnly: false, aliases: ["ttt"], memberPermissions: [], diff --git a/commands/General/fortnite.js b/commands/General/fortnite.js deleted file mode 100644 index 76a191fd..00000000 --- a/commands/General/fortnite.js +++ /dev/null @@ -1,81 +0,0 @@ -const Command = require("../../base/Command.js"), - Canvas = require("discord-canvas"), - Discord = require("discord.js"); - -class Fortnite extends Command { - constructor(client) { - super(client, { - name: "fortnite", - dirname: __dirname, - enabled: true, - guildOnly: false, - aliases: ["fn"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 2000 - }); - } - - async run(message, args, data) { - if (!data.config.apiKeys.fortniteTRN || data.config.apiKeys.fortniteTRN.length === "") return message.success("misc:COMMAND_DISABLED"); - - const stats = new Canvas.FortniteStats(); - - const platform = args[0].toLowerCase(); - if (!platform || (platform !== "pc" && platform !== "xbl" && platform !== "psn")) return message.error("general/fortnite:MISSING_PLATFORM"); - - const user = args.slice(1).join(" "); - if (!user) return message.error("general/fortnite:MISSING_USERNAME"); - - const m = await message.sendT("misc:PLEASE_WAIT", null, { - prefixEmoji: "loading" - }); - - const statsImage = await stats - .setToken(data.config.apiKeys.fortniteTRN) - .setUser(user) - .setPlatform(platform) - .setText("averageKills", message.translate("general/fortnite:AVERAGE_KILLS")) - .setText("averageKill", message.translate("general/fortnite:AVERAGE_KILL")) - .setText("wPercent", message.translate("general/fortnite:W_PERCENT")) - .setText("winPercent", message.translate("general/fortnite:WIN_PERCENT")) - .setText("kD", message.translate("general/fortnite:KD")) - .setText("wins", message.translate("general/fortnite:WINS")) - .setText("win", message.translate("general/fortnite:WIN")) - .setText("kills", message.translate("general/fortnite:KILLS")) - .setText("kill", message.translate("general/fortnite:KILL")) - .setText("matches", message.translate("general/fortnite:MATCHES")) - .setText("match", message.translate("general/fortnite:MATCH")) - .setText("footer", message.translate("general/fortnite:FOOTER")) - .toAttachment(); - - if (!statsImage) { - m.delete(); - return message.error("general/fortnite:NOT_FOUND", { - platform, - search: user - }); - }; - - // Send embed - const attachment = new Discord.MessageAttachment(statsImage.toBuffer(), "fortnite-stats-image.png"), - embed = new Discord.MessageEmbed() - .setDescription(message.translate("general/fortnite:TITLE", { - username: `[${stats.data.username}](${stats.data.url.replace(new RegExp(" ", "g"), "%20")})` - })) - .setImage("attachment://fortnite-stats-image.png") - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - message.channel.send({ - embeds: [embed], - files: [attachment] - }); - m.delete(); - } -}; - -module.exports = Fortnite; \ No newline at end of file diff --git a/commands/General/fortniteshop.js b/commands/General/fortniteshop.js deleted file mode 100644 index 9e2195bb..00000000 --- a/commands/General/fortniteshop.js +++ /dev/null @@ -1,68 +0,0 @@ -const Command = require("../../base/Command.js"), - Discord = require("discord.js"), - Canvas = require("discord-canvas"); - -class Fortniteshop extends Command { - constructor(client) { - super(client, { - name: "fortniteshop", - dirname: __dirname, - enabled: true, - guildOnly: false, - aliases: ["fns"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 2000 - }); - } - - async run(message, args, data) { - if (!data.config.apiKeys.fortniteFNBR || data.config.apiKeys.fortniteFNBR.length === "") return message.error("misc:COMMAND_DISABLED"); - - const m = await message.sendT("misc:PLEASE_WAIT", null, { - prefixEmoji: "loading" - }); - - const momentName = this.client.languages.find((language) => language.name === data.guild.language || language.aliases.includes(data.guild.language)).moment; - const shop = new Canvas.FortniteShop(); - const image = await shop - .setToken(data.config.apiKeys.fortniteFNBR) - .setText("header", message.translate("general/fortniteshop:HEADER")) - .setText("daily", message.translate("general/fortniteshop:DAILY")) - .setText("featured", message.translate("general/fortniteshop:FEATURED")) - .setText("date", message.translate("general/fortniteshop:DATE", { - skipInterpolation: true - }).replace("{{date}}", "{date}")) - .setText("footer", message.translate("general/fortniteshop:FOOTER")) - .lang(momentName) - .toAttachment(); - const attachment = new Discord.MessageAttachment(image, "shop.png"); - - const embed = new Discord.MessageEmbed() - .setAuthor({ - name: message.translate("general/fortniteshop:HEADER", { - date: message.printDate(new Date(Date.now())) - }), - iconURL: this.client.user.displayAvatarURL({ - size: 512, - dynamic: true, - format: "png" - }) - }) - .setImage("attachment://shop.png") - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - await message.channel.send({ - embeds: [embed], - files: [attachment] - }); - await m.delete(); - return; - } -}; - -module.exports = Fortniteshop; \ No newline at end of file diff --git a/commands/General/serverinfo.js b/commands/General/serverinfo.js index c065ec80..8b008819 100644 --- a/commands/General/serverinfo.js +++ b/commands/General/serverinfo.js @@ -29,6 +29,7 @@ class Serverinfo extends Command { }; await guild.members.fetch(); + const owner = await guild.fetchOwner(); const embed = new Discord.MessageEmbed() .setAuthor({ @@ -48,8 +49,8 @@ class Serverinfo extends Command { ) .addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel || message.translate("general/serverinfo:NO_AFK_CHANNEL"), true) .addField(this.client.customEmojis.id + message.translate("common:ID"), guild.id, true) - .addField(this.client.customEmojis.crown + message.translate("common:OWNER"), guild.owner, true) - .addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount || 0, true) + .addField(this.client.customEmojis.crown + message.translate("common:OWNER"), owner.toString(), true) + .addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount || "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"))}` + diff --git a/commands/Moderation/announcement.js b/commands/Moderation/announcement.js index 653258c2..69231b39 100644 --- a/commands/Moderation/announcement.js +++ b/commands/Moderation/announcement.js @@ -24,7 +24,7 @@ class Announcement extends Command { message.delete().catch(() => {}); - let mention = ""; + let mention = null; const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); const filter = m => m.author.id === message.author.id; diff --git a/commands/Moderation/checkinvites.js b/commands/Moderation/checkinvites.js deleted file mode 100644 index a1c12535..00000000 --- a/commands/Moderation/checkinvites.js +++ /dev/null @@ -1,53 +0,0 @@ -const Command = require("../../base/Command.js"), - Discord = require("discord.js"); - -class Checkinvites extends Command { - constructor(client) { - super(client, { - name: "checkinvites", - dirname: __dirname, - enabled: true, - guildOnly: true, - aliases: ["checkinvite", "checkinv"], - memberPermissions: [], - botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"], - nsfw: false, - ownerOnly: false, - cooldown: 1000 - }); - } - - async run(message, args, data) { - const withInvite = []; - message.guild.members.cache.forEach((m) => { - const possibleLinks = m.presence.activities.map((a) => [a.state, a.details, a.name]).flat(); - const inviteLinks = possibleLinks.filter((l) => /(discord\.(gg|io|me|li)\/.+|discordapp\.com\/invite\/.+)/i.test(l)); - if (inviteLinks.length > 0) { - withInvite.push({ - id: m.user.id, - tag: Discord.Util.escapeMarkdown(m.user.tag), - links: "**" + Discord.Util.escapeMarkdown(inviteLinks.join(", ")) + "**" - }); - }; - }); - - const text = (withInvite.length > 0 ? withInvite.map((m) => "`" + m.id + "` (" + m.tag + ") : " + m.links).join("\n") : message.translate("moderation/checkinvites:NOBODY")); - - const embed = new Discord.MessageEmbed() - .setDescription(text) - .setColor(data.config.embed.color) - .setFooter({ - text: data.config.embed.footer - }); - - const m = await message.channel.send({ - embeds: [embed] - }); - - setTimeout(function () { - m.delete(); - }, 3000); - } -}; - -module.exports = Checkinvites; \ No newline at end of file diff --git a/commands/Moderation/clearsanctions.js b/commands/Moderation/clearsanctions.js index a30ed9d6..591ddd6f 100644 --- a/commands/Moderation/clearsanctions.js +++ b/commands/Moderation/clearsanctions.js @@ -18,7 +18,7 @@ class Clearsanctions extends Command { async run(message, args) { const member = await this.client.resolveMember(args[0], message.guild); - if (!member) return message.error("moderation/clear-sanctions:MISSING_MEMBER"); + if (!member) return message.error("moderation/clearsanctions:MISSING_MEMBER"); const memberData = await this.client.findOrCreateMember({ id: member.id, @@ -26,7 +26,7 @@ class Clearsanctions extends Command { }); memberData.sanctions = []; memberData.save(); - message.success("moderation/clear-sanctions:SUCCESS", { + message.success("moderation/clearsanctions:SUCCESS", { username: member.user.tag }); } diff --git a/commands/Moderation/poll.js b/commands/Moderation/poll.js index 69e5122e..327454ac 100644 --- a/commands/Moderation/poll.js +++ b/commands/Moderation/poll.js @@ -23,7 +23,7 @@ class Poll extends Command { message.delete().catch(() => {}); - let mention = ""; + let mention = null; const msg = await message.sendT("moderation/announcement:MENTION_PROMPT"); const filter = m => m.author.id === message.author.id; diff --git a/commands/Moderation/warn.js b/commands/Moderation/warn.js index 3a570f65..da40e684 100644 --- a/commands/Moderation/warn.js +++ b/commands/Moderation/warn.js @@ -55,7 +55,7 @@ class Warn extends Command { 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:MODERATOR"), `\`${message.author.tag}\` (${message.author.toString()})`) .addField(message.translate("common:REASON"), reason, true); if (banCount) { diff --git a/commands/Music/np.js b/commands/Music/np.js index 90995562..296c5635 100644 --- a/commands/Music/np.js +++ b/commands/Music/np.js @@ -27,6 +27,16 @@ class Np extends Command { // Gets the current song const track = queue.songs[0]; + const status = queue => + `Фильтры: \`${queue.filters.join(", ") + || "Выкл"}\` | Повтор: \`${ + queue.repeatMode + ? queue.repeatMode === 2 + ? "Очереди" + : "Текущей песни" + : "Выкл" + }\` | Автовоспроизведение: \`${queue.autoplay ? "Вкл" : "Выкл"}\``; + // Generate discord embed to display song informations const embed = new Discord.MessageEmbed() .setAuthor({ @@ -36,6 +46,7 @@ class Np extends Command { .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.formattedDuration}`) + .addField(message.translate("music/np:T_CONF"), status(queue)) .setColor(data.config.embed.color) .setFooter({ text: data.config.embed.footer diff --git a/commands/Music/seek.js b/commands/Music/seek.js index 350ce767..c2d6d366 100644 --- a/commands/Music/seek.js +++ b/commands/Music/seek.js @@ -20,7 +20,7 @@ class Seek extends Command { async run(message, args) { const voice = message.member.voice.channel; const queue = this.client.player.getQueue(message); - const time = ms(args[0]); + 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"); diff --git a/commands/Owner/reload.js b/commands/Owner/reload.js index 747f8bf8..a377c095 100644 --- a/commands/Owner/reload.js +++ b/commands/Owner/reload.js @@ -25,7 +25,9 @@ class Reload extends Command { await this.client.unloadCommand(cmd.conf.location, cmd.help.name); await this.client.loadCommand(cmd.conf.location, cmd.help.name); - i18next.reloadResources(data.guild.language); + const lang = data.guild.language || "ru-RU"; + i18next.reloadResources(lang); + message.success("owner/reload:SUCCESS", { command: cmd.help.name }); diff --git a/dashboard/routes/guild-manager.js b/dashboard/routes/guild-manager.js index ea92252f..86306b0f 100644 --- a/dashboard/routes/guild-manager.js +++ b/dashboard/routes/guild-manager.js @@ -123,9 +123,6 @@ router.post("/:serverID", CheckAuth, async(req, res) => { if (data.modlogs === req.translate("common:NO_CHANNEL")) guildData.plugins.modlogs = false; else guildData.plugins.modlogs = guild.channels.cache.find((ch) => "#" + ch.name === data.modlogs).id; - if (data.fortniteshop === req.translate("common:NO_CHANNEL")) guildData.plugins.fortniteshop = false; - else guildData.plugins.fortniteshop = guild.channels.cache.find((ch) => "#" + ch.name === data.fortniteshop).id; - if (data.birthdays === req.translate("common:NO_CHANNEL")) guildData.plugins.birthdays = false; else guildData.plugins.birthdays = guild.channels.cache.find((ch) => "#" + ch.name === data.birthdays).id; diff --git a/dashboard/views/manager/guild.ejs b/dashboard/views/manager/guild.ejs index ae6a5402..ee8e9dcf 100644 --- a/dashboard/views/manager/guild.ejs +++ b/dashboard/views/manager/guild.ejs @@ -167,24 +167,6 @@ <% } %> -
- - -