From f188dcd1178b98cac327d36db768b9af1ec253ea Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Fri, 14 Jan 2022 18:20:27 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D1=81=D0=BC=D0=B5=D1=82=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D1=81=D0=BA=D0=B8=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/Economy/leaderboard.js | 8 +++---- helpers/autoUpdateDocs.js | 8 +++---- helpers/birthdays.js | 39 ++++++++++++++++++++------------- helpers/checkReminds.js | 12 +++++++--- helpers/checkUnmutes.js | 11 ++++++---- helpers/functions.js | 2 +- helpers/languages.js | 8 +++---- helpers/logger.js | 1 - 8 files changed, 53 insertions(+), 36 deletions(-) diff --git a/commands/Economy/leaderboard.js b/commands/Economy/leaderboard.js index e5d0c521..bdb8262e 100644 --- a/commands/Economy/leaderboard.js +++ b/commands/Economy/leaderboard.js @@ -42,7 +42,7 @@ class Leaderboard extends Command { const user = (await this.client.users.fetch(data.id)).tag; userNames += `**${i + 1}**. ${user}\n`; - money += `**${data.money}**\n`; + money += `${data.money}\n`; } const embed = new Discord.MessageEmbed() @@ -89,8 +89,8 @@ class Leaderboard extends Command { const user = (await this.client.users.fetch(data.id)).tag; userNames += `**${i + 1}**. ${user}\n`; - level += `**${data.level}**\n`; - xp += `**${data.xp}** / **${5 * (data.level * data.level) + 80 * data.level + 100}**\n`; + level += `${data.level}\n`; + xp += `${data.xp} / ${5 * (data.level * data.level) + 80 * data.level + 100}\n`; } const embed = new Discord.MessageEmbed() @@ -139,7 +139,7 @@ class Leaderboard extends Command { const user = (await this.client.users.fetch(data.id)).tag; userNames += `**${i + 1}**. ${user}\n`; - rep += `**${data.rep}**\n`; + rep += `${data.rep}\n`; } const embed = new Discord.MessageEmbed() diff --git a/helpers/autoUpdateDocs.js b/helpers/autoUpdateDocs.js index de6e7605..3738ce89 100644 --- a/helpers/autoUpdateDocs.js +++ b/helpers/autoUpdateDocs.js @@ -5,10 +5,10 @@ module.exports = { * @param {object} client The Discord Client instance */ update(client) { - const table = require("markdown-table"); - const fs = require("fs"); - const commands = client.commands; - const categories = []; + const table = require("markdown-table"), + fs = require("fs"), + commands = client.commands, + categories = []; commands.forEach((cmd) => { if (!categories.includes(cmd.help.category)) categories.push(cmd.help.category); }); diff --git a/helpers/birthdays.js b/helpers/birthdays.js index 68f8529e..1e3994f7 100644 --- a/helpers/birthdays.js +++ b/helpers/birthdays.js @@ -4,13 +4,13 @@ const CronJob = require("cron").CronJob, async function init(client) { new CronJob("0 8 * * *", async function () { client.guilds.cache.forEach(async (guild) => { - const date = new Date(); - const currentDay = date.getDate(); - const currentMonth = date.getMonth(); - const currentYear = date.getFullYear(); - const guildData = await client.findOrCreateGuild({ - id: guild.id - }); + const date = new Date(), + currentDay = date.getDate(), + currentMonth = date.getMonth(), + currentYear = date.getFullYear(), + guildData = await client.findOrCreateGuild({ + id: guild.id + }); if (guildData.plugins.birthdays) { const channel = client.channels.cache.get(guildData.plugins.birthdays); @@ -27,18 +27,25 @@ async function init(client) { if (currentMonth === month && currentDay === day) { const embed = new Discord.MessageEmbed() - .setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL({ - size: 512, - dynamic: true, - format: "png" - })}) + .setAuthor({ + name: client.user.username, + iconURL: client.user.displayAvatarURL({ + size: 512, + dynamic: true, + format: "png" + }) + }) .setColor(client.config.embed.color) - .setFooter({ text: client.config.embed.footer }) + .setFooter({ + text: client.config.embed.footer + }) .addField(client.translate("economy/birthdate:HAPPY_BIRTHDAY"), client.translate("economy/birthdate:HAPPY_BIRTHDAY_MESSAGE", { user: user.id, age: `${age} ${client.getNoun(age, client.translate("misc:NOUNS:AGE:1"), client.translate("misc:NOUNS:AGE:2"), client.translate("misc:NOUNS:AGE:5"))}` })); - const msg = await channel.send({ content: "@here", embeds: [embed] }); + const msg = await channel.send({ + embeds: [embed] + }); await msg.react("🎉"); } } @@ -49,4 +56,6 @@ async function init(client) { }, null, true, "Europe/Moscow"); } -module.exports = { init }; \ No newline at end of file +module.exports = { + init +}; \ No newline at end of file diff --git a/helpers/checkReminds.js b/helpers/checkReminds.js index 543e173d..71edc3f5 100644 --- a/helpers/checkReminds.js +++ b/helpers/checkReminds.js @@ -25,14 +25,20 @@ module.exports = { if (mustSent.length > 0) { mustSent.forEach((r) => { const embed = new Discord.MessageEmbed() - .setAuthor({ name: client.translate("general/remindme:TITLE") }) + .setAuthor({ + name: client.translate("general/remindme:TITLE") + }) .addField(client.translate("common:CREATION"), client.translate("general/remindme:CREATED", { time: client.convertTime(r.createdAt, "from") })) .addField(client.translate("common:MESSAGE"), r.message) .setColor(client.config.embed.color) - .setFooter({ text: client.config.embed.footer }); - dUser.send({ embeds: [embed] }); + .setFooter({ + text: client.config.embed.footer + }); + dUser.send({ + embeds: [embed] + }); }); user.reminds = user.reminds.filter((r) => r.sendAt >= dateNow); user.save(); diff --git a/helpers/checkUnmutes.js b/helpers/checkUnmutes.js index 181b03a9..0bfabe38 100644 --- a/helpers/checkUnmutes.js +++ b/helpers/checkUnmutes.js @@ -1,9 +1,8 @@ const Discord = require("discord.js"); -/* THIS CHECK IF THERE IS A USER TO UNMUTE */ module.exports = { /** - * Starts checking... + * Check if there is a user to unmute * @param {object} client The Discord Client instance */ async init(client) { @@ -47,9 +46,13 @@ module.exports = { count: memberData.mute.case })) .setColor("#f44271") - .setFooter({ text: guild.client.config.embed.footer }); + .setFooter({ + text: guild.client.config.embed.footer + }); const channel = guild.channels.cache.get(guildData.plugins.modlogs); - if (channel) channel.send({ embeds: [embed] }); + if (channel) channel.send({ + embeds: [embed] + }); memberData.mute = { muted: false, diff --git a/helpers/functions.js b/helpers/functions.js index f4802cce..7ec6a398 100644 --- a/helpers/functions.js +++ b/helpers/functions.js @@ -31,7 +31,7 @@ module.exports = { } }, - // This function return a actual link to the support server + // This function return an actual link to the support server async supportLink(client) { const guild = client.guilds.cache.get(client.config.support.id); const member = guild.me; diff --git a/helpers/languages.js b/helpers/languages.js index 65581a7e..70246e98 100644 --- a/helpers/languages.js +++ b/helpers/languages.js @@ -1,7 +1,7 @@ -const i18next = require("i18next"); -const Backend = require("i18next-node-fs-backend"); -const path = require("path"); -const fs = require("fs").promises; +const i18next = require("i18next"), + Backend = require("i18next-node-fs-backend"), + path = require("path"), + fs = require("fs").promises; async function walkDirectory(dir, namespaces = [], folderName = "") { const files = await fs.readdir(dir); diff --git a/helpers/logger.js b/helpers/logger.js index e4761433..79cb58b4 100644 --- a/helpers/logger.js +++ b/helpers/logger.js @@ -24,7 +24,6 @@ module.exports = class Logger { static log(content, type = "log") { const date = `[${format(new Date(Date.now()))}]:`; switch (type) { - // Check the message type and then print him in the console case "log": { return console.log(`${date} ${bgBlue(type.toUpperCase())} ${content} `); }