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

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.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;
}
const user = await client.users.fetch(userData.id);
const userDb = await client.findOrCreateUser({
id: user.id
}, 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 = {
...user.toJSON(),
...userDb,
...userData
...userData,
...userPresence
};
return userInfos;

View file

@ -9,9 +9,12 @@
</div>
<div class="pull-left info">
<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>
<!-- 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">
<li class="header"><%= translate("dashboard:SERVERS_MANAGEMENT").toUpperCase() %></li>
<li class="treeview menu-open">

View file

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

View file

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