fix: add GuildMembers intent and force-fetch target user
All checks were successful
CI / CD / test-build (push) Successful in 10m15s
CI / CD / deploy-dev (push) Successful in 1m32s
CI / CD / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-23 20:20:33 +02:00
parent 5116040274
commit 20bba47cbd

View File

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