From 81526839cbd81906a4ca2c3a6a3c168a3833f67c Mon Sep 17 00:00:00 2001 From: Histmy Date: Tue, 16 Sep 2025 19:58:10 +0200 Subject: [PATCH] Improve strange status logging --- package-lock.json | 4 ++-- package.json | 2 +- src/app.ts | 12 +++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 532fc05..3961676 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "denim_3001", - "version": "3001.62.5", + "version": "3001.62.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "denim_3001", - "version": "3001.62.5", + "version": "3001.62.6", "license": "ISC", "dependencies": { "@discordjs/voice": "^0.18.0", diff --git a/package.json b/package.json index d330dfa..10c505c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "denim_3001", - "version": "3001.62.5", + "version": "3001.62.6", "description": "Toto je velmi kvalitní bot.", "repository": { "url": "https://github.com/Histmy/Denim-Bot/" diff --git a/src/app.ts b/src/app.ts index f5e7556..63b4802 100644 --- a/src/app.ts +++ b/src/app.ts @@ -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 { 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"; @@ -373,10 +373,8 @@ client.on("messageCreate", async mes => { }); }); -function alertPokudNestandardni(client: CClient, presence: ClientPresenceStatusData | null) { - if (!presence) { - return; - } +function alertPokudNestandardni(client: CClient, aft: Presence) { + const presence = aft.clientStatus; for (const pres in presence) { if (["web", "mobile", "desktop"].includes(pres)) { @@ -384,7 +382,7 @@ function alertPokudNestandardni(client: CClient, presence: ClientPresenceStatusD } // 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; - alertPokudNestandardni(client, aft.clientStatus); + alertPokudNestandardni(client, aft); const naCo = aft.clientStatus || {}; user.presence = naCo;