From b0deb2e4475badf69598c3692c42b8442b7ee8d3 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Thu, 13 Jan 2022 18:55:13 +0500 Subject: [PATCH] =?UTF-8?q?v3.2.8=20=D0=A1=D1=82=D0=B0=D1=82=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D0=B8=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20=D0=B8=20=D1=81=D0=B5?= =?UTF-8?q?=D1=80=D0=B2=D0=B5=D1=80=D0=B0=20=D0=BD=D0=B0=20=D1=81=D0=B0?= =?UTF-8?q?=D0=B9=D1=82=D0=B5=20=D0=A3=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20?= =?UTF-8?q?=D0=BB=D0=B8=D1=88=D0=BD=D0=B8=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB?= =?UTF-8?q?=20=D0=9E=D1=82=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=B4=D0=BD=D0=B0=20someone=20=D0=A4?= =?UTF-8?q?=D0=B8=D0=BA=D1=81=20currentURL=20=D0=B2=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=86=20=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BB=D0=BE=D0=BA=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/Economy/profile.js | 1 + commands/General/serverinfo.js | 3 +- commands/General/someone.js | 2 +- commands/General/stats.js | 13 +- commands/Owner/eval.js | 3 +- dashboard/app.js | 2 + dashboard/public/docs/updates.md | 13 +- dashboard/routes/commands.js | 19 --- dashboard/routes/docs.js | 2 +- dashboard/routes/guild-manager.js | 8 +- dashboard/routes/guild-stats.js | 95 +++----------- dashboard/routes/index.js | 2 +- dashboard/routes/profile.js | 3 +- dashboard/routes/user.js | 38 ++++++ dashboard/utils.js | 82 ++++++++++--- dashboard/views/404.ejs | 2 +- dashboard/views/500.ejs | 2 +- dashboard/views/manager/guild.ejs | 10 +- dashboard/views/profile.ejs | 63 +++++++++- dashboard/views/stats/guild.ejs | 157 ++++++++++++++++++++++++ dashboard/views/user.ejs | 134 ++++++++++++++++++++ events/messageCreate.js | 2 +- languages/ru-RU/common.json | 4 +- languages/ru-RU/dashboard.json | 7 +- languages/ru-RU/economy/profile.json | 3 +- languages/ru-RU/general/serverinfo.json | 4 +- package.json | 2 +- 27 files changed, 520 insertions(+), 156 deletions(-) delete mode 100644 dashboard/routes/commands.js create mode 100644 dashboard/routes/user.js create mode 100644 dashboard/views/stats/guild.ejs create mode 100644 dashboard/views/user.ejs diff --git a/commands/Economy/profile.js b/commands/Economy/profile.js index 8489b82e..ae23fd60 100644 --- a/commands/Economy/profile.js +++ b/commands/Economy/profile.js @@ -63,6 +63,7 @@ class Profile extends Command { }) }) .setImage("attachment://achievements.png") + .addField(this.client.customEmojis.link + " " + message.translate("economy/profile:LINK"), `[${message.translate("economy/profile:LINK_TEXT")}](https://jaba.pp.ua/user/${member.user.id}/${message.guild.id})`) .addField(message.translate("economy/profile:BIO"), userData.bio ? userData.bio : message.translate("economy/profile:NO_BIO")) .addField(message.translate("economy/profile:CASH"), `**${memberData.money}** ${message.getNoun(memberData.money, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) .addField(message.translate("economy/profile:BANK"), `**${memberData.bankSold}** ${message.getNoun(memberData.bankSold, message.translate("misc:NOUNS:CREDIT:1"), message.translate("misc:NOUNS:CREDIT:2"), message.translate("misc:NOUNS:CREDIT:5"))}`, true) diff --git a/commands/General/serverinfo.js b/commands/General/serverinfo.js index a4c42b0a..5d741827 100644 --- a/commands/General/serverinfo.js +++ b/commands/General/serverinfo.js @@ -41,13 +41,14 @@ class Serverinfo extends Command { .setThumbnail(guild.iconURL({ dynamic: true })) + .addField(this.client.customEmojis.link + " " + message.translate("general/serverinfo:LINK"), `[${message.translate("general/serverinfo:LINK_TEXT")}](https://jaba.pp.ua/stats/${guild.id})`) .addField(this.client.customEmojis.title + message.translate("common:NAME"), guild.name, true) .addField(this.client.customEmojis.calendar + message.translate("common:CREATION"), message.printDate(guild.createdAt), true) .addField(this.client.customEmojis.users + message.translate("common:MEMBERS"), `${guild.members.cache.filter(m => !m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => !m.user.bot).size, message.translate("misc:NOUNS:MEMBERS:1"), message.translate("misc:NOUNS:MEMBERS:2"), message.translate("misc:NOUNS:MEMBERS:5"))}` + "\n" + `${guild.members.cache.filter(m => m.user.bot).size} ${message.getNoun(guild.members.cache.filter(m => m.user.bot).size, message.translate("misc:NOUNS:BOTS:1"), message.translate("misc:NOUNS:BOTS:2"), message.translate("misc:NOUNS:BOTS:5"))}`, true ) - .addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel.toString() || message.translate("general/serverinfo:NO_AFK_CHANNEL"), true) + .addField(this.client.customEmojis.afk + message.translate("general/serverinfo:AFK_CHANNEL"), guild.afkChannel ? guild.afkChannel.toString() : message.translate("general/serverinfo:NO_AFK_CHANNEL"), true) .addField(this.client.customEmojis.id + message.translate("common:ID"), guild.id, true) .addField(this.client.customEmojis.crown + message.translate("common:OWNER"), owner.toString(), true) .addField(this.client.customEmojis.boost + message.translate("general/serverinfo:BOOSTS"), guild.premiumSubscriptionCount.toString() || "0", true) diff --git a/commands/General/someone.js b/commands/General/someone.js index 26925fcc..4419c69a 100644 --- a/commands/General/someone.js +++ b/commands/General/someone.js @@ -6,7 +6,7 @@ class Someone extends Command { super(client, { name: "someone", dirname: __dirname, - enabled: true, + enabled: false, guildOnly: true, aliases: ["somebody"], memberPermissions: [], diff --git a/commands/General/stats.js b/commands/General/stats.js index a790a14f..9cb445c7 100644 --- a/commands/General/stats.js +++ b/commands/General/stats.js @@ -46,14 +46,13 @@ class Stats extends Command { .addField(message.translate("general/stats:CREDITS_TITLE"), message.translate("general/stats:CREDITS_CONTENT", { donators: ["**`Добрый Спецназ#8801`** - Тестер, генератор идей"].join("\n"), translators: ["**`Jonny_Bro#4226`** (:flag_ru:)"].join("\n") + })) + .addField(this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", { + dashboardLink: "https://jaba.pp.ua/", + docsLink: "https://jaba.pp.ua/docs/", + donateLink: "https://qiwi.com/n/JONNYBRO/", + owner: this.client.config.owner.id })); - - statsEmbed.addField(this.client.customEmojis.link + " " + message.translate("general/stats:LINKS_TITLE"), message.translate("misc:STATS_FOOTER", { - dashboardLink: "https://jaba.pp.ua/", - docsLink: "https://jaba.pp.ua/docs/", - donateLink: "https://qiwi.com/n/JONNYBRO/", - owner: this.client.config.owner.id - })); message.channel.send({ embeds: [statsEmbed] }); diff --git a/commands/Owner/eval.js b/commands/Owner/eval.js index 291808a5..4fc8d174 100644 --- a/commands/Owner/eval.js +++ b/commands/Owner/eval.js @@ -1,3 +1,4 @@ +/* eslint-disable no-unused-vars */ const Command = require("../../base/Command"); class Eval extends Command { @@ -16,7 +17,7 @@ class Eval extends Command { }); } - async run(message) { + async run(message, data) { const content = message.content.split(" ").slice(1).join(" "); const result = new Promise((resolve) => resolve(eval(content))); diff --git a/dashboard/app.js b/dashboard/app.js index f57aed21..ec107f41 100644 --- a/dashboard/app.js +++ b/dashboard/app.js @@ -14,6 +14,7 @@ module.exports.load = async(client) => { discordAPIRouter = require("./routes/discord"), logoutRouter = require("./routes/logout"), profileRouter = require("./routes/profile"), + userRouter = require("./routes/user"), guildStatsRouter = require("./routes/guild-stats"), guildManagerRouter = require("./routes/guild-manager"), docsManagerRouter = require("./routes/docs"); @@ -52,6 +53,7 @@ module.exports.load = async(client) => { .use("/manage", guildManagerRouter) .use("/stats", guildStatsRouter) .use("/profile", profileRouter) + .use("/user", userRouter) .use("/", mainRouter) .use("/docs", docsManagerRouter) .use(CheckAuth, function(req, res) { diff --git a/dashboard/public/docs/updates.md b/dashboard/public/docs/updates.md index 4fbf2ec8..6369d0a4 100644 --- a/dashboard/public/docs/updates.md +++ b/dashboard/public/docs/updates.md @@ -1,3 +1,12 @@ +### JaBa v3.2.7 +* Добавлено + * Статистика сервера на сайте ([пример](https://jaba.pp.ua/stats/651412418202959872)). + * Профиль пользователя определённого сервера на сайте ([пример](https://jaba.pp.ua/user/281361531411890186/651412418202959872)) + Ссылки на статистику сервера и профиль пользователя можно найти в *serverinfo* и *profile (@пользователь)* соответственно. + +* Изменения + * Отключены команда *someone* и тэг *@someone*. + ### JaBa v3.2.7 * Добавлено * Некоторая информация о вашем профиле на сайте, на страницах серверов и в настройках. @@ -15,7 +24,6 @@ * Команда *setafk* и ответ бота автоматически удаляются через 10 секунд. * Новые карточки при входе и выходе пользователей (Я не дизайнер, не бейте :(). - * Обновлена локализация для карточек. ### JaBa v3.2.5 * Изменения @@ -77,7 +85,6 @@ * Некорректное описание *seek*. * Некорректная работа *seek*. * Некорректное описание *unban*. - * Мелкие правки в локализации. ### JaBa v3.1.5 * Изменено @@ -114,7 +121,7 @@ ### JaBa v3.1 * Изменено - * Обновлена русская локализация, исправлены орфографические ошибки. + * Исправлены орфографические ошибки в русской локализации. * Отключёна английская локализация. * Исправлены ошибки. diff --git a/dashboard/routes/commands.js b/dashboard/routes/commands.js deleted file mode 100644 index e73018bb..00000000 --- a/dashboard/routes/commands.js +++ /dev/null @@ -1,19 +0,0 @@ -const express = require("express"), - router = express.Router(), - fs = require("fs"), - marked = require("marked"); - -router.get("/", function (req, res) { - var md = function (filename) { - return marked.parse(fs.readFileSync("./dashboard/views/docs/" + filename, "utf8")); - }; - - res.render("commands", { - user: req.userInfos, - translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}`, - "md": md - }); -}); - -module.exports = router; \ No newline at end of file diff --git a/dashboard/routes/docs.js b/dashboard/routes/docs.js index 3745d7c3..40f55f68 100644 --- a/dashboard/routes/docs.js +++ b/dashboard/routes/docs.js @@ -5,7 +5,7 @@ router.get("/", function (req, res) { res.render("docs", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` }); }); diff --git a/dashboard/routes/guild-manager.js b/dashboard/routes/guild-manager.js index ecaa3a99..61b59151 100644 --- a/dashboard/routes/guild-manager.js +++ b/dashboard/routes/guild-manager.js @@ -10,7 +10,7 @@ router.get("/:serverID", CheckAuth, async(req, res) => { return res.render("404", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` }); } @@ -25,7 +25,7 @@ router.get("/:serverID", CheckAuth, async(req, res) => { translate: req.translate, bot: req.client, convertTime: req.convertTime, - currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` }); }); @@ -36,7 +36,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => { return res.render("404", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` }); } @@ -44,7 +44,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => { const data = req.body; if (data.language) { - const language = req.client.languages.find((language) => language.aliases[0].toLowerCase() === data.language.toLowerCase()); + const language = req.client.languages.find((language) => language.nativeName.toLowerCase() === data.language.toLowerCase()); if (language) guildData.language = language.name; if (data.prefix.length >= 1 && data.prefix.length < 2000) guildData.prefix = data.prefix; diff --git a/dashboard/routes/guild-stats.js b/dashboard/routes/guild-stats.js index f0057c03..09184d74 100644 --- a/dashboard/routes/guild-stats.js +++ b/dashboard/routes/guild-stats.js @@ -1,28 +1,27 @@ const express = require("express"), utils = require("../utils"), CheckAuth = require("../auth/CheckAuth"), - router = express.Router(), - generator = require("colors-generator"); + router = express.Router(); -router.get("/:serverID", CheckAuth, async(req, res) => { +router.get("/:serverID", CheckAuth, async (req, res) => { // Check if the user has the permissions to edit this guild const guild = req.client.guilds.cache.get(req.params.serverID); if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID)) { return res.render("404", { user: req.userInfos, - language: req.language, - currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}` + translate: req.translate, + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` }); } // Fetch guild informations - const guildInfos = await utils.fetchGuild(guild.id, req.client, req.user.guilds); - - const membersData = await req.client.membersData.find({ guildID: guild.id }).lean(); + const membersData = await req.client.membersData.find({ + guildID: guild.id + }).lean(); const leaderboards = { - money: sortArrayOfObjects("money", membersData), - level: sortArrayOfObjects("level", membersData) + money: utils.sortArrayOfObjects("money", membersData), + level: utils.sortArrayOfObjects("level", membersData) }; for (const cat in leaderboards) { @@ -36,77 +35,13 @@ router.get("/:serverID", CheckAuth, async(req, res) => { }; res.render("stats/guild", { - stats, - commands: getCommands(guildInfos.commands.filter((c) => c.date > Date.now()-604800000)), - commandsUsage: getCommandsUsage(guildInfos.commands), user: req.userInfos, - language: req.language, - currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}`, + stats, + bot: req.client, + guildID: guild.id, + translate: req.translate, + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}`, }); }); -module.exports = router; - -function getCommands(commands) { - const aDateCommand = {}; - commands.forEach((cmd) => { - const tDate = formatDate(new Date(cmd.date)); - if (aDateCommand[tDate]) aDateCommand[tDate]++; - else aDateCommand[tDate] = 1; - }); - return aDateCommand; -} - -function getCommandsUsage(commands) { - const objectCount = commands.reduce((acc, curr) => { - if (typeof acc[curr.command] == "undefined") acc[curr.command] = 1; - else acc[curr.command] += 1; - - return acc; - }, {}); - const percentages = getPercentagePerKey(objectCount); // [ { key: "help", percentage: 20 } ] - const colors = generator.generate("#86bff2", percentages.length).get(); - let i = 0; - percentages.forEach((p) => { - p.color = colors[i]; - i++; - }); - - return percentages; -} - -function getPercentagePerKey(myArray) { - const sum = getSum(myArray); - const arrayWithPercentages = []; - for (const key in myArray) { - const val = myArray[key]; - const percentage = Math.round((val / sum) * 100); - arrayWithPercentages.push({key, percentage}); - } - - return arrayWithPercentages; -} - -function getSum(myArray) { - let sum = 0; - for (const key in myArray) sum += myArray[key]; - - return sum; -} - -function sortArrayOfObjects(key, arr) { - const array = arr.slice(0); - return array.sort((a, b) => { - return b[key] - a[key]; - }); -} - -function formatDate(date) { - let dd = date.getDate(); - let mm = date.getMonth() + 1; - if (dd < 10) dd = `0${dd}`; - if (mm < 10) mm = `0${mm}`; - date = `${mm}/${dd}`; - - return date; -} \ No newline at end of file +module.exports = router; \ No newline at end of file diff --git a/dashboard/routes/index.js b/dashboard/routes/index.js index a69a610c..0b1a60e4 100644 --- a/dashboard/routes/index.js +++ b/dashboard/routes/index.js @@ -10,7 +10,7 @@ router.get("/selector", CheckAuth, async(req, res) => { res.render("selector", { user: req.userInfos, translate: req.translate, - currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` }); }); diff --git a/dashboard/routes/profile.js b/dashboard/routes/profile.js index 7097787c..8420c0e4 100644 --- a/dashboard/routes/profile.js +++ b/dashboard/routes/profile.js @@ -6,9 +6,10 @@ const express = require("express"), router.get("/", CheckAuth, async function(req, res) { res.render("profile", { user: req.userInfos, + bot: req.client, translate: req.translate, printDate: req.printDate, - currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}` + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` }); }); diff --git a/dashboard/routes/user.js b/dashboard/routes/user.js new file mode 100644 index 00000000..3ed3e3d3 --- /dev/null +++ b/dashboard/routes/user.js @@ -0,0 +1,38 @@ +const express = require("express"), + utils = require("../utils"), + CheckAuth = require("../auth/CheckAuth"), + router = express.Router(); + +// Gets user page +router.get("/:userID/:serverID", CheckAuth, async function (req, res) { + const guild = req.client.guilds.cache.get(req.params.serverID); + if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID)) { + return res.render("404", { + user: req.userInfos, + translate: req.translate, + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + }); + } + + const guildData = await req.client.findOrCreateGuild({ id: guild.id }); + await utils.fetchUser({ + id: req.params.userID + }, req.client).catch(() => { + res.render("404", { + user: req.userInfos, + translate: req.translate, + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + }); + }); + + res.render("user", { + user: req.userInfos, + guild: guildData, + bot: req.client, + translate: req.translate, + printDate: req.printDate, + currentURL: `${req.client.config.dashboard.baseURL}${req.originalUrl}` + }); +}); + +module.exports = router; \ No newline at end of file diff --git a/dashboard/utils.js b/dashboard/utils.js index a3697953..1ce1ec31 100644 --- a/dashboard/utils.js +++ b/dashboard/utils.js @@ -1,18 +1,5 @@ const { Permissions } = require("discord.js"); -/** - * Fetch guild informations - * @param {string} guildID The ID of the guild to fetch - * @param {object} client The discord client instance - * @param {array} guilds The user guilds - */ -async function fetchGuild(guildID, client, guilds) { - const guild = client.guilds.cache.get(guildID); - const conf = await client.findOrCreateGuild({ id:guild.id }); - - return { ...guild, ...conf.toJSON(), ...guilds.find((g) => g.id === guild.id) }; -} - /** * Fetch user informations (stats, guilds, etc...) * @param {object} userData The oauth2 user informations @@ -24,6 +11,7 @@ async function fetchUser(userData, client, query) { if (userData.guilds) { userData.guilds.forEach((guild) => { if (!client.guilds.cache.get(guild.id)) return; + // eslint-disable-next-line no-undef const perms = new Permissions(BigInt(guild.permissions)); if (perms.has(Permissions.FLAGS.MANAGE_GUILD)) guild.admin = true; @@ -36,10 +24,72 @@ async function fetchUser(userData, client, query) { if (userData.displayedGuilds.length < 1) delete userData.displayedGuilds; } const user = await client.users.fetch(userData.id); - const userDb = await client.findOrCreateUser({ id: user.id }, true); - const userInfos = { ...user.toJSON(), ...userDb, ...userData }; + const userDb = await client.findOrCreateUser({ + id: user.id + }, true); + const userInfos = { + ...user.toJSON(), + ...userDb, + ...userData + }; return userInfos; } -module.exports = { fetchUser, fetchGuild }; \ No newline at end of file +/** + * Fetch users informations + * @param {object} array The array of users + * @param {object} client The discord client instance + * @returns {object} The user informations + */ +async function fetchUsers(array, client) { + return new Promise((resolve) => { + const users = []; + array.filter((e) => e.id).forEach((element) => { + client.users.fetch(element.id).then((user) => { + user.username = user.username.replace(/[\W_]+/g, " "); + if (user.username.length > 13) { + user.username = user.username.substr(0, 10) + "..."; + } + users.push({ + ...{ + money: element.money, + level: element.level, + rep: element.rep + }, + ...user.toJSON() + }); + }); + }); + resolve(users); + }); +} + +/** + * Fetch guild informations + * @param {string} guildID The ID of the guild to fetch + * @param {object} client The discord client instance + * @param {array} guilds The user guilds + * @returns {object} The guild informations + */ +async function fetchGuild(guildID, client, guilds) { + const guild = client.guilds.cache.get(guildID); + const conf = await client.findOrCreateGuild({ + id: guild.id + }); + + return { + ...guild, + ...conf.toJSON(), + ...guilds.find((g) => g.id === guild.id) + }; +} + +function sortArrayOfObjects(key, arr) { + const array = arr.slice(0); + return array.sort((a, b) => { + return b[key] - a[key]; + }); +} + +module.exports = { fetchUser, fetchUsers, fetchGuild, sortArrayOfObjects }; \ No newline at end of file diff --git a/dashboard/views/404.ejs b/dashboard/views/404.ejs index 4693dacd..5186618f 100644 --- a/dashboard/views/404.ejs +++ b/dashboard/views/404.ejs @@ -16,7 +16,7 @@

- 404 Error Page + Ошибка 404

diff --git a/dashboard/views/500.ejs b/dashboard/views/500.ejs index 6753535e..81c3b8ba 100644 --- a/dashboard/views/500.ejs +++ b/dashboard/views/500.ejs @@ -16,7 +16,7 @@

- 500 Error Page + Ошибка 500

diff --git a/dashboard/views/manager/guild.ejs b/dashboard/views/manager/guild.ejs index c41066f4..7d385890 100644 --- a/dashboard/views/manager/guild.ejs +++ b/dashboard/views/manager/guild.ejs @@ -30,7 +30,7 @@
- +
<%= translate("common:LEVEL") %> <%= memberData.level %> @@ -42,9 +42,9 @@
- +
- <%= translate("dashboard:EXP") %> + <%= translate("economy/profile:EXP").substr(2) %> <%= memberData.exp %> / <%= 5 * (memberData.level * memberData.level) + 80 * memberData.level + 100 %>
@@ -56,7 +56,7 @@
- <%= translate("common:CREDITS") %> / <%= translate("economy/transactions:BANK") %> + <%= translate("economy/profile:CASH").substr(2) %> / <%= translate("economy/profile:BANK").substr(2) %> <%= memberData.money %> / <%= memberData.bankSold %>
@@ -66,7 +66,7 @@
- +
<%= translate("dashboard:COOLDOWNS") %> <%= translate("dashboard:REP") %>: <%= user.cooldowns.rep > Date.now() ? convertTime(user.cooldowns.rep) : translate("dashboard:CAN_USE") %> diff --git a/dashboard/views/profile.ejs b/dashboard/views/profile.ejs index 7fe0b4ab..ec822965 100644 --- a/dashboard/views/profile.ejs +++ b/dashboard/views/profile.ejs @@ -30,9 +30,9 @@
- +
- <%= translate("dashboard:REPUTATION") %> + <%= translate("economy/profile:REPUTATION").substr(2) %> <%= user.rep %>
@@ -42,11 +42,64 @@
+
+ +
+ +
+

<%= user.tag %>

+
+
+ User Avatar +
+ +
+ +
-

<%= translate("economy/profile:YOUR_PROFILE") %>

+

<%= translate("common:CONFIGURATION") %>

@@ -55,12 +108,12 @@
- + ">
- +
diff --git a/dashboard/views/stats/guild.ejs b/dashboard/views/stats/guild.ejs new file mode 100644 index 00000000..12c8f876 --- /dev/null +++ b/dashboard/views/stats/guild.ejs @@ -0,0 +1,157 @@ + + + +<%- include("../includes/head") %> + + + + + + +
+ + + <%- include("../includes/header") %> + + + <%- include("../includes/sidebar") %> + + +
+ + +
+

<%= translate("dashboard:STATS") %> <%= bot.guilds.cache.get(guildID).name %> Dashboard v1.0

+
+ + +
+ +
+ +
+ + + +
+ +
+ +
+ +
+
+ User Avatar +
+ +

<%= stats.money[0].username %>

+
<%= translate("dashboard:TOP_CREDITS") %>
+
+
+ +
+ +
+ +
+ +
+
+ User Avatar +
+ +

<%= stats.level[0].username %>

+
<%= translate("dashboard:TOP_LEVEL") %>
+
+
+ +
+ +
+
+ +
+ + <%- include("../includes/footer") %> +
+ + + + + + + + + \ No newline at end of file diff --git a/dashboard/views/user.ejs b/dashboard/views/user.ejs new file mode 100644 index 00000000..336542ec --- /dev/null +++ b/dashboard/views/user.ejs @@ -0,0 +1,134 @@ + + + +<%- include("includes/head") %> + + + +
+ + + <%- include("includes/header") %> + + + <%- include("includes/sidebar") %> + + +
+ + +
+

<%= user.username %> Dashboard v1.0

+
+ +
+
+ +
+ +
+

<%= user.tag %>

+ <%= bot.guilds.cache.get(guild.id).name %> +

ID: <%= guild.id %>

+
+
+ User Avatar +
+ +
+ +
+ +
+
+
+ + +
+ <%= translate("economy/profile:LEVEL").substr(2) %> + <%= guild.members.find(u => u.id === user.id).level %> +
+ +
+ +
+ +
+
+ + +
+ <%= translate("economy/profile:CASH").substr(2) %> / <%= translate("economy/profile:BANK").substr(2) %> + <%= guild.members.find(u => u.id === user.id).money %> / <%= guild.members.find(u => u.id === user.id).bankSold %> +
+ +
+ +
+ +
+
+ + +
+ <%= translate("economy/profile:REPUTATION").substr(2) %> + <%= user.rep %> +
+ +
+ +
+ +
+
+
+ + + + <%- include("includes/footer") %> +
+ + + + \ No newline at end of file diff --git a/events/messageCreate.js b/events/messageCreate.js index 1a8c1283..862c4704 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -33,7 +33,7 @@ module.exports = class { else return message.sendT("misc:HELLO_DM"); } - if (message.content.includes("@someone") && message.guild) return client.commands.get("someone").run(message, null, data); + if (message.content.includes("@someone") && message.guild && client.commands.get("someone").conf.enabled) return client.commands.get("someone").run(message, null, data); if (message.guild) { // Gets the data of the member diff --git a/languages/ru-RU/common.json b/languages/ru-RU/common.json index 073688f6..d3654a2e 100644 --- a/languages/ru-RU/common.json +++ b/languages/ru-RU/common.json @@ -12,7 +12,7 @@ "MEMBERS": "Участники", "NAME": "Название", "CHANNELS": "Каналы", - "ID": "ID", + "ID": "ID сервера", "OWNER": "Владелец", "USERNAME": "Имя пользователя", "DISCRIMINATOR": "Тег", @@ -48,7 +48,7 @@ "PAGE": "Страница", "MESSAGE": "Сообщение", "PROFILE": "Профиль", - "CONFIGURATION": "Конфигурация", + "CONFIGURATION": "Настройки", "PREFIX": "Префикс", "LANGUAGE": "Язык", "CHANNEL": "Канал", diff --git a/languages/ru-RU/dashboard.json b/languages/ru-RU/dashboard.json index 261492e2..aae82b15 100644 --- a/languages/ru-RU/dashboard.json +++ b/languages/ru-RU/dashboard.json @@ -21,13 +21,14 @@ "ENABLE_AUTOROLE": "Включить", "DISABLE_AUTOROLE": "Выключить", "SELECTOR": "Выбор серверов", + "STATS": "Статистика", "MANAGE": "Управление", - "EXP": "Опыт", - "REPUTATION": "Очки репутации", "COOLDOWNS": "Откаты", "REP": "Команда rep", "WORK": "Зарплата в work", "ROB": "Защита от rob", "CAN_USE": "Можно использовать", - "NO_DEFENCE": "Вы беспомощны" + "NO_DEFENCE": "Вы беспомощны", + "TOP_LEVEL": "Первый по уровню", + "TOP_CREDITS": "Первый по кредитам" } \ No newline at end of file diff --git a/languages/ru-RU/economy/profile.json b/languages/ru-RU/economy/profile.json index 5a52d365..1497f650 100644 --- a/languages/ru-RU/economy/profile.json +++ b/languages/ru-RU/economy/profile.json @@ -4,7 +4,8 @@ "EXAMPLES": "{{prefix}}profile\n{{prefix}}profile @Jonny_Bro#4226", "BOT_USER": "У ботов нет профиля!", "TITLE": "Профиль {{username}}", - "YOUR_PROFILE": "Ваш профиль", + "LINK": "Профиль", + "LINK_TEXT": "Нажмите сюда, чтобы открыть профиль на текущем сервере!", "BIO": "🔖 Биография", "NO_BIO": "Биография отсутствует", "CASH": "💵 Кредиты", diff --git a/languages/ru-RU/general/serverinfo.json b/languages/ru-RU/general/serverinfo.json index 3889825f..f2cfefdc 100644 --- a/languages/ru-RU/general/serverinfo.json +++ b/languages/ru-RU/general/serverinfo.json @@ -4,5 +4,7 @@ "EXAMPLES": "{{prefix}}serverinfo кык\n{{prefix}}serverinfo", "AFK_CHANNEL": "AFK канал", "NO_AFK_CHANNEL": "Нет AFK канала", - "BOOSTS": "Кол-во бустов" + "BOOSTS": "Кол-во бустов", + "LINK": "Статистика сервера", + "LINK_TEXT": "Нажмите сюда, чтобы открыть статистику сервера!" } \ No newline at end of file diff --git a/package.json b/package.json index d0cd797e..09fdc424 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jaba", - "version": "3.2.7", + "version": "3.2.8", "description": "A very complete Discord bot (more than 100 commands) that uses the Discord.js", "main": "index.js", "private": true,