From 20bba47cbd1ecc1efcc792354b5e106c2f741243 Mon Sep 17 00:00:00 2001 From: denshooter Date: Thu, 23 Apr 2026 20:20:33 +0200 Subject: [PATCH] fix: add GuildMembers intent and force-fetch target user --- discord-presence-bot/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/discord-presence-bot/index.js b/discord-presence-bot/index.js index efff010..9062e60 100644 --- a/discord-presence-bot/index.js +++ b/discord-presence-bot/index.js @@ -14,6 +14,7 @@ const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildPresences, + GatewayIntentBits.GuildMembers, ], }); @@ -86,7 +87,14 @@ function updateAll() { client.on("clientReady", () => { console.log(`Bot online as ${client.user.tag}`); client.user.setActivity("Watching Presence", { type: ActivityType.Watching }); - updateAll(); + for (const guild of client.guilds.cache.values()) { + guild.members.fetch(TARGET_USER_ID).then(() => { + console.log(`Found user ${TARGET_USER_ID} in guild ${guild.name}`); + updateAll(); + }).catch((err) => { + console.error(`Could not fetch user ${TARGET_USER_ID} in guild ${guild.name}:`, err.message); + }); + } }); client.on("presenceUpdate", () => {