Improve strange status logging

This commit is contained in:
Histmy 2025-09-16 19:58:10 +02:00
parent eaa505bfb1
commit 81526839cb
Signed by: Histmy
GPG Key ID: AC2E43C463D8F329
3 changed files with 8 additions and 10 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.62.5", "version": "3001.62.6",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.62.5", "version": "3001.62.6",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@discordjs/voice": "^0.18.0", "@discordjs/voice": "^0.18.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "denim_3001", "name": "denim_3001",
"version": "3001.62.5", "version": "3001.62.6",
"description": "Toto je velmi kvalitní bot.", "description": "Toto je velmi kvalitní bot.",
"repository": { "repository": {
"url": "https://github.com/Histmy/Denim-Bot/" "url": "https://github.com/Histmy/Denim-Bot/"

View File

@ -1,4 +1,4 @@
import { ButtonStyle, ChannelType, Client, ClientPresenceStatusData, CommandInteraction, GatewayIntentBits, InteractionReplyOptions, Message, Partials } from "discord.js"; import { ButtonStyle, ChannelType, Client, ClientPresenceStatusData, CommandInteraction, GatewayIntentBits, InteractionReplyOptions, Message, Partials, Presence } from "discord.js";
import { readdirSync } from "fs"; import { readdirSync } from "fs";
import { CClient, CUser, HelpServer, Komand, KomandNaExport, KomandRaw, ListenerFunkce, Modul, SMessage, SRecord, SuperListenerFunkce } from "./utils/types"; import { CClient, CUser, HelpServer, Komand, KomandNaExport, KomandRaw, ListenerFunkce, Modul, SMessage, SRecord, SuperListenerFunkce } from "./utils/types";
import { adminLog, areStatusesSame, formatCas, log, nabidni, oddiakritikovat, prefix, rand, messageReply } from "./utils/utils.js"; import { adminLog, areStatusesSame, formatCas, log, nabidni, oddiakritikovat, prefix, rand, messageReply } from "./utils/utils.js";
@ -373,10 +373,8 @@ client.on("messageCreate", async mes => {
}); });
}); });
function alertPokudNestandardni(client: CClient, presence: ClientPresenceStatusData | null) { function alertPokudNestandardni(client: CClient, aft: Presence) {
if (!presence) { const presence = aft.clientStatus;
return;
}
for (const pres in presence) { for (const pres in presence) {
if (["web", "mobile", "desktop"].includes(pres)) { if (["web", "mobile", "desktop"].includes(pres)) {
@ -384,7 +382,7 @@ function alertPokudNestandardni(client: CClient, presence: ClientPresenceStatusD
} }
// Máme jinej // Máme jinej
adminLog(client, `zahlidnul jsem zvlastni status "${pres}"`); adminLog(client, `zahlidnul jsem zvlastni status "${pres}".\n\`\`\`${JSON.stringify(presence)}\`\`\`\nod uzivatele ${aft.userId} ${aft.user}`);
} }
} }
@ -396,7 +394,7 @@ client.on("presenceUpdate", async (bef, aft) => {
if (areStatusesSame(aft.clientStatus, user.presence)) return; if (areStatusesSame(aft.clientStatus, user.presence)) return;
alertPokudNestandardni(client, aft.clientStatus); alertPokudNestandardni(client, aft);
const naCo = aft.clientStatus || {}; const naCo = aft.clientStatus || {};
user.presence = naCo; user.presence = naCo;