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", () => {