"Вчера работало, а сегодня уже нет"
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) { .use(async function(req, res, next) {
req.user = req.session.user; req.user = req.session.user;
req.client = client; 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.url !== "/") req.userInfos = await utils.fetchUser(req.user, req.client);
if (req.user) { if (req.user) {
req.translate = req.client.translations.get(req.locale); 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({ 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 guildData = await client.guilds.fetch(userData.displayedGuilds[0].id);
const userPresence = guildData.members.cache.get(user.id).presence; // const userPresence = guildData.members.cache.get(user.id).presence;
const userInfos = { const userInfos = {
...user.toJSON(), ...user.toJSON(),
...userDb, ...userDb,
...userData, ...userData
...userPresence // ...userPresence
}; };
return userInfos; return userInfos;

View file

@ -9,9 +9,9 @@
</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> <!-- <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()) %> <%=// translate("common:STATUS_" + user.status.toUpperCase()) %>
</a> </a> -->
</div> </div>
</div> </div>
<!-- sidebar menu: style can be found in sidebar.less --> <!-- sidebar menu: style can be found in sidebar.less -->