Информация о профиле на сайте
This commit is contained in:
JonnyBro 2022-01-12 20:31:47 +05:00
parent 93a74149c4
commit fbd42b6fa5
12 changed files with 86 additions and 25 deletions

View file

@ -35,7 +35,7 @@ class Setafk extends Command {
const m = await message.success("general/setafk:SUCCESS", {
reason,
prefix: message.guild ? data.guild.prefix : "$"
prefix: message.guild ? data.guild.prefix : ""
});
setTimeout(() => {

View file

@ -43,6 +43,7 @@ module.exports.load = async(client) => {
if (req.user) {
req.translate = req.client.translations.get(req.locale);
req.printDate = (date) => req.client.printDate(date, null, req.locale);
req.convertTime = (time) => req.client.convertTime(time, "to", true, req.locale);
};
next();
})

View file

@ -16,12 +16,15 @@ router.get("/:serverID", CheckAuth, async(req, res) => {
// Fetch guild informations
const guildInfos = await utils.fetchGuild(guild.id, req.client, req.user.guilds);
const memberData = await req.client.findOrCreateMember({ id: req.userInfos.id, guildID: guild.id });
res.render("manager/guild", {
guild: guildInfos,
user: req.userInfos,
memberData: memberData,
translate: req.translate,
bot: req.client,
convertTime: req.convertTime,
currentURL: `${req.client.config.dashboard.baseURL}/${req.originalUrl}`
});
});

View file

@ -4,7 +4,7 @@ const express = require("express"),
// Gets profile page
router.get("/", CheckAuth, async function(req, res) {
res.render("settings", {
res.render("profile", {
user: req.userInfos,
translate: req.translate,
printDate: req.printDate,
@ -25,7 +25,7 @@ router.post("/", CheckAuth, async function(req, res) {
};
await user.save();
res.redirect(303, "/settings");
res.redirect(303, "/profile");
});
module.exports = router;

View file

@ -193,13 +193,20 @@
<div class="row">
<div class="col-md-12">
<pre class="brush: html">
-----------------------------------------------------------------------------------------
JaBa v3.2.7
-----------------------------------------------------------------------------------------
Добавлено
- Некоторая информация о вашем профиле на сайте, на страницах серверов и в настройках.
(Скоро там будет больше всякой информации).
-----------------------------------------------------------------------------------------
JaBa v3.2.6
-----------------------------------------------------------------------------------------
Исправления
- Команда goodbye снова работает.
Изменено
Изменения
- Команда setafk и ответ бота автоматически удаляются через 10 секунд.
- Новые карточки при входе и выходе пользователей
(Я не дизайнер, не бейте :( ).
@ -208,7 +215,7 @@
-----------------------------------------------------------------------------------------
JaBa v3.2.5
-----------------------------------------------------------------------------------------
Изменено
Изменения
- Переписана команда loop.
Теперь нужен аргумент song или queue для включения соответствующего режима повтора.
Если не указать агрумент, то повтор отключится.

View file

@ -40,11 +40,11 @@
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<% if(user.displayedGuilds) { %>
<% if (user.displayedGuilds) { %>
<ul class="treeview-menu">
<% user.displayedGuilds.forEach((guild) => { %>
<li><a href="<%= guild.settingsUrl %>"><i
class="fa fa-circle-o text-<%= guild.owner ? "blue" : "grey" %>"></i>
class="fa fa-circle-o text-<%= guild.owner ? "green" : "grey" %>"></i>
<%= guild.name %></a></li>
<% }); %>
</ul>

View file

@ -29,8 +29,9 @@
<div class="row">
<div class="col-md-6">
<div class="box box-widget widget-user">
<div class="widget-user-header bg-aqua-active">
<div class="widget-user-header bg-red">
<h3 class="widget-user-username"><%= guild.name %></h3>
<i> <%= guild.id %> </i>
</div>
<div class="widget-user-image">
<img class="img-circle" src="<%= guild.iconURL %>" alt="Server icon">
@ -50,6 +51,38 @@
</div>
<!-- /.box-footer -->
</div>
<div class="info-box">
<span class="info-box-icon bg-green"><i class="fa fa-area-chart"></i></span>
<div class="info-box-content">
<span class="info-box-text"><%= translate("common:LEVEL") %></span>
<span class="info-box-number"><%= guild.members.find(u => u.id === user.id).level %></span>
</div>
<!-- /.info-box-content -->
</div>
<div class="info-box">
<span class="info-box-icon bg-green"><i class="fa fa-money"></i></span>
<div class="info-box-content">
<span class="info-box-text"><%= translate("common:CREDITS") %> / <%= translate("economy/transactions:BANK") %></span>
<span class="info-box-number"><%= guild.members.find(u => u.id === user.id).money %> / <%= guild.members.find(u => u.id === user.id).bankSold %></span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
<div class="info-box">
<span class="info-box-icon bg-green"><i class="fa fa-refresh"></i></span>
<div class="info-box-content">
<span class="info-box-text"><%= translate("dashboard:COOLDOWNS") %></span>
<% for (const c in memberData.cooldowns) { %>
<% if (c !== "rob") { %>
<span class="info-box-number"><%= translate("dashboard:" + c.toUpperCase()) %>: <%= memberData.cooldowns[c] !== 0 ? convertTime(memberData.cooldowns[c]) : translate("dashboard:CAN_USE") %></span>
<% } else { %>
<span class="info-box-number"><%= translate("dashboard:" + c.toUpperCase()) %>: <%= memberData.cooldowns[c] !== 0 ? convertTime(memberData.cooldowns[c]) : translate("dashboard:NO_DEFENCE") %></span>
<% }; %>
<% }; %>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
<!-- BASIC CONFIGURATION -->
<div class="box box-warning">
<div class="box-header with-border">
@ -69,7 +102,7 @@
<label><%= translate("common:LANGUAGE") %></label>
<select class="form-control" name="language">
<% bot.languages.forEach((language) => { %>
<% if(guild.language === language.name) { %>
<% if (guild.language === language.name) { %>
<option selected="selected"><%= language.aliases[0] %></option>
<% } else { %>
<option><%= language.aliases[0] %></options>
@ -98,7 +131,7 @@
<div class="form-group">
<label><%= translate("common:SUGGESTIONS") %></label>
<select class="form-control" name="suggestions">
<% if(guild.plugins.suggestions && bot.channels.cache.has(guild.plugins.suggestions)) { %>
<% if (guild.plugins.suggestions && bot.channels.cache.has(guild.plugins.suggestions)) { %>
<option selected="selected">
#<%= bot.channels.cache.get(guild.plugins.suggestions).name %></option>
<% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT" && ch.id !== guild.plugins.suggestions).forEach((ch) => { %>
@ -116,7 +149,7 @@
<div class="form-group">
<label><%= translate("common:REPORTS") %></label>
<select class="form-control" name="reports">
<% if(guild.plugins.reports && bot.channels.cache.has(guild.plugins.reports)) { %>
<% if (guild.plugins.reports && bot.channels.cache.has(guild.plugins.reports)) { %>
<option selected="selected">
#<%= bot.channels.cache.get(guild.plugins.reports).name %></option>
<% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT" && ch.id !== guild.plugins.reports).forEach((ch) => { %>
@ -134,7 +167,7 @@
<div class="form-group">
<label><%= translate("common:MODLOGS") %></label>
<select class="form-control" name="modlogs">
<% if(guild.plugins.modlogs && bot.channels.cache.has(guild.plugins.modlogs)) { %>
<% if (guild.plugins.modlogs && bot.channels.cache.has(guild.plugins.modlogs)) { %>
<option selected="selected">
#<%= bot.channels.cache.get(guild.plugins.modlogs).name %></option>
<% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT" && ch.id !== guild.plugins.modlogs).forEach((ch) => { %>
@ -152,7 +185,7 @@
<div class="form-group">
<label><%= translate("common:BIRTHDAYS") %></label>
<select class="form-control" name="birthdays">
<% if(guild.plugins.birthdays && bot.channels.cache.has(guild.plugins.birthdays)) { %>
<% if (guild.plugins.birthdays && bot.channels.cache.has(guild.plugins.birthdays)) { %>
<option selected="selected">
#<%= bot.channels.cache.get(guild.plugins.birthdays).name %></option>
<% guild.channels.cache.filter((ch) => ch.type === "GUILD_TEXT" && ch.id !== guild.plugins.birthdays).forEach((ch) => { %>
@ -196,7 +229,7 @@
<div class="form-group">
<label><%= translate("common:CHANNEL") %></label>
<select class="form-control" name="channel">
<% if(guild.plugins.welcome.enabled && bot.channels.cache.has(guild.plugins.welcome.channel)) { %>
<% if (guild.plugins.welcome.enabled && bot.channels.cache.has(guild.plugins.welcome.channel)) { %>
<option selected="selected">
#<%= bot.channels.cache.get(guild.plugins.welcome.channel).name %>
</option>
@ -216,7 +249,7 @@
<div class="form-group">
<div class="checkbox">
<label>
<% if(guild.plugins.welcome.withImage || !guild.plugins.welcome.enabled) { %>
<% if (guild.plugins.welcome.withImage || !guild.plugins.welcome.enabled) { %>
<input type="checkbox" name="withImage"
checked><%= translate("dashboard:WELCOME_IMG") %>
<% } else { %>
@ -229,7 +262,7 @@
</div>
<!-- /.box-body -->
<div class="box-footer">
<% if(guild.plugins.welcome.enabled) { %>
<% if (guild.plugins.welcome.enabled) { %>
<button type="submit" name="welcomeDisable"
class="btn btn-danger"><%= translate("dashboard:DISABLE_MESSAGES") %></button>
<button type="submit" name="welcomeUpdate"
@ -259,7 +292,7 @@
<div class="form-group">
<label><%= translate("common:CHANNEL") %></label>
<select class="form-control" name="channel">
<% if(guild.plugins.goodbye.enabled && bot.channels.cache.has(guild.plugins.goodbye.channel)) { %>
<% if (guild.plugins.goodbye.enabled && bot.channels.cache.has(guild.plugins.goodbye.channel)) { %>
<option selected="selected">
#<%= bot.channels.cache.get(guild.plugins.goodbye.channel).name %>
</option>
@ -279,7 +312,7 @@
<div class="form-group">
<div class="checkbox">
<label>
<% if(guild.plugins.goodbye.withImage || !guild.plugins.goodbye.enabled) { %>
<% if (guild.plugins.goodbye.withImage || !guild.plugins.goodbye.enabled) { %>
<input type="checkbox" name="withImage"
checked><%= translate("dashboard:GOODBYE_IMG") %>
<% } else { %>
@ -292,7 +325,7 @@
</div>
<!-- /.box-body -->
<div class="box-footer">
<% if(guild.plugins.goodbye.enabled) { %>
<% if (guild.plugins.goodbye.enabled) { %>
<button type="submit" name="goodbyeDisable"
class="btn btn-danger"><%= translate("dashboard:DISABLE_MESSAGES") %></button>
<button type="submit" name="goodbyeUpdate"
@ -316,7 +349,7 @@
<div class="form-group">
<label><%= translate("common:ROLE") %></label>
<select class="form-control" name="role">
<% if(guild.plugins.autorole.enabled && guild.roles.cache.has(guild.plugins.autorole.role)) { %>
<% if (guild.plugins.autorole.enabled && guild.roles.cache.has(guild.plugins.autorole.role)) { %>
<option selected="selected">
@<%= guild.roles.cache.get(guild.plugins.autorole.role).name %></option>
<% guild.roles.cache.filter((r) => r.id !== guild.plugins.autorole.role && r.name !== "@everyone").forEach((r) => { %>
@ -334,7 +367,7 @@
</div>
<!-- /.box-body -->
<div class="box-footer">
<% if(guild.plugins.autorole.enabled) { %>
<% if (guild.plugins.autorole.enabled) { %>
<button type="submit" name="autoroleDisable"
class="btn btn-danger"><%= translate("dashboard:DISABLE_AUTOROLE") %></button>
<button type="submit" name="autoroleUpdate"

View file

@ -23,7 +23,7 @@
<section class="content">
<div class="row">
<% if(user.displayedGuilds) { user.displayedGuilds.forEach(function(guild) { %>
<% if (user.displayedGuilds) { user.displayedGuilds.forEach(function(guild) { %>
<!-- Displays 4 servers by line -->
<div class="col-md-3">
<div class="box box-solid">

View file

@ -30,6 +30,15 @@
<!-- Info boxes -->
<div class="row">
<div class="col-md-12">
<div class="info-box">
<span class="info-box-icon bg-green"><i class="fa fa-star-o"></i></span>
<div class="info-box-content">
<span class="info-box-text"><%= translate("dashboard:REPUTATION") %></span>
<span class="info-box-number"><%= user.rep %></span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
<!-- general form elements -->
<div class="box box-primary">
<div class="box-header with-border">

View file

@ -31,7 +31,7 @@ module.exports = {
else return 1;
}).forEach((cmd) => {
arrCat.push([
`**${cmd.help.name}** ${cmd.help.aliases.length ? `**(${cmd.help.aliases.join(", ")})**` : ""}`,
`**${cmd.help.name}** ${cmd.help.aliases.length ? `**(${cmd.help.aliases.join(", ")})**` : ""} ${cmd.conf.guildOnly ? "*Только на сервере*" : ""}`,
client.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:DESCRIPTION`),
client.translate(`${cmd.help.category.toLowerCase()}/${cmd.help.name}:USAGE`),
`${Math.ceil(cmd.conf.cooldown / 1000)} ${client.getNoun(Math.ceil(cmd.conf.cooldown / 1000), "секунда", "секунды", "секунд")}`

View file

@ -21,5 +21,13 @@
"ENABLE_AUTOROLE": "Включить",
"DISABLE_AUTOROLE": "Выключить",
"SELECTOR": "Выбор серверов",
"MANAGE": "Управление"
"MANAGE": "Управление",
"REPUTATION": "Очки репутации",
"COOLDOWNS": "Откаты",
"REP": "Команда rep",
"WORK": "Зарплата в work",
"ROB": "Защита от rob",
"CAN_USE": "Можно использовать",
"NO_DEFENCE": "Вы беспомощны"
}

View file

@ -1,6 +1,6 @@
{
"name": "jaba",
"version": "3.2.6",
"version": "3.2.7",
"description": "A very complete Discord bot (more than 100 commands) that uses the Discord.js",
"main": "index.js",
"private": true,