"Вчера работало, а сегодня уже нет"
This commit is contained in:
JonnyBro 2022-04-03 12:47:54 +05:00
parent 1085d2107f
commit e2065b4523
3 changed files with 8 additions and 8 deletions

View file

@ -39,7 +39,7 @@ module.exports.load = async(client) => {
.use(async function(req, res, next) {
req.user = req.session.user;
req.client = client;
req.locale = req.user ? (req.user.locale === "ru" ? "ru-RU" : "en-US") : "en-US";
req.locale = req.user ? (req.user.locale === "ru" ? "ru-RU" : "uk-UA") : "ru-RU";
if (req.user && req.url !== "/") req.userInfos = await utils.fetchUser(req.user, req.client);
if (req.user) {
req.translate = req.client.translations.get(req.locale);

View file

@ -28,14 +28,14 @@ async function fetchUser(userData, client, query) {
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 guildData = await client.guilds.fetch(userData.displayedGuilds[0].id);
// const userPresence = guildData.members.cache.get(user.id).presence;
const userInfos = {
...user.toJSON(),
...userDb,
...userData,
...userPresence
...userData
// ...userPresence
};
return userInfos;

View file

@ -9,9 +9,9 @@
</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>
<!-- <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 -->