Долгожданный фикс статуса на сайте

This commit is contained in:
JonnyBro 2022-02-14 00:24:48 +05:00
parent c76bfc3664
commit 0df1e56d8b
4 changed files with 13 additions and 5 deletions

View file

@ -20,17 +20,22 @@ async function fetchUser(userData, client, query) {
guild.iconURL = (guild.icon ? `https://cdn.discordapp.com/icons/${guild.id}/${guild.icon}.png?size=128` : "https://discordemoji.com/assets/emoji/discordcry.png"); guild.iconURL = (guild.icon ? `https://cdn.discordapp.com/icons/${guild.id}/${guild.icon}.png?size=128` : "https://discordemoji.com/assets/emoji/discordcry.png");
guild.displayed = (query ? guild.name.toLowerCase().includes(query.toLowerCase()) : true); guild.displayed = (query ? guild.name.toLowerCase().includes(query.toLowerCase()) : true);
}); });
userData.displayedGuilds = userData.guilds.filter((g) => g.displayed && g.admin); userData.displayedGuilds = userData.guilds.filter(g => g.displayed && g.admin);
if (userData.displayedGuilds.length < 1) delete userData.displayedGuilds; if (userData.displayedGuilds.length < 1) delete userData.displayedGuilds;
} }
const user = await client.users.fetch(userData.id); const user = await client.users.fetch(userData.id);
const userDb = await client.findOrCreateUser({ const userDb = await client.findOrCreateUser({
id: user.id id: user.id
}, true); }, true);
const guildData = await client.guilds.fetch(userData.guilds.filter(g => g.displayed)[0].id);
const userPresence = guildData.members.cache.get(user.id).presence;
const userInfos = { const userInfos = {
...user.toJSON(), ...user.toJSON(),
...userDb, ...userDb,
...userData ...userData,
...userPresence
}; };
return userInfos; return userInfos;

View file

@ -9,9 +9,12 @@
</div> </div>
<div class="pull-left info"> <div class="pull-left info">
<p><%= user.username %></p> <p><%= user.username %></p>
<a href="#"><i class="fa fa-circle text-<%= user.status === "dnd" ? "danger" : user.status === "idle" ? "warning" : user.status === "online" ? "success" : ""%>"></i>
<%= translate("common:STATUS_" + user.status.toUpperCase()) %>
</a>
</div> </div>
</div> </div>
<!-- sidebar menu: : style can be found in sidebar.less --> <!-- sidebar menu: style can be found in sidebar.less -->
<ul class="sidebar-menu" data-widget="tree"> <ul class="sidebar-menu" data-widget="tree">
<li class="header"><%= translate("dashboard:SERVERS_MANAGEMENT").toUpperCase() %></li> <li class="header"><%= translate("dashboard:SERVERS_MANAGEMENT").toUpperCase() %></li>
<li class="treeview menu-open"> <li class="treeview menu-open">

View file

@ -21,7 +21,7 @@
"AVATAR": "Аватар", "AVATAR": "Аватар",
"GAME": "Активность", "GAME": "Активность",
"STATUS": "Статус", "STATUS": "Статус",
"STATUS_ONLINE": "Онлайн", "STATUS_ONLINE": "В сети",
"STATUS_OFFLINE": "Не в сети", "STATUS_OFFLINE": "Не в сети",
"STATUS_IDLE": "Неактивен", "STATUS_IDLE": "Неактивен",
"STATUS_DND": "Не беспокоить", "STATUS_DND": "Не беспокоить",

View file

@ -21,7 +21,7 @@
"AVATAR": "Аватар", "AVATAR": "Аватар",
"GAME": "Активність", "GAME": "Активність",
"STATUS": "Статус", "STATUS": "Статус",
"STATUS_ONLINE": "Онлайн", "STATUS_ONLINE": "В мережі",
"STATUS_OFFLINE": "Не в мережі", "STATUS_OFFLINE": "Не в мережі",
"STATUS_IDLE": "Неактивен", "STATUS_IDLE": "Неактивен",
"STATUS_DND": "Не турбувати", "STATUS_DND": "Не турбувати",