Getting guild members on a sharded bot

I want to check if a user is present in a guild on the userUpdate event im doing this
client.guilds.cache.forEach(async (g) => {
if(!g.members.cache.get(id)) return;
}
client.guilds.cache.forEach(async (g) => {
if(!g.members.cache.get(id)) return;
}
now since i sharded my bot i gotta use fetchClientValues ( i think ) and the fetch client values for guilds.cache returns an array inside an array with 2 objects of the guilds the bot is in but they are no the full member object... they have a member property which is also an array but only has the cached member id ( only an array of id's ) s accessing the sharded guild object:
let res = await client.shard.fetchClientValues(`guilds.cache`);
res[0][0] //----> guild object ( not the full one )
res[0][0].members // ----> [ id1, id2, id3, ... ]
let res = await client.shard.fetchClientValues(`guilds.cache`);
res[0][0] //----> guild object ( not the full one )
res[0][0].members // ----> [ id1, id2, id3, ... ]
so is there any other method for what i need ?
9 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
node: v17.3.0 djs: v14.7.1
Parogo_72
Parogo_722y ago
Thats api spammy
wen
wenOP2y ago
it was but now i'm switching so
Parogo_72
Parogo_722y ago
No, its still api spam If you want to know shared guilds with your bot, use oauth2
wen
wenOP2y ago
how i've never used oauth2 before
d.js docs
d.js docs2y ago
Oauth is about giving access to your stuff without sharing your identity • oauth.net | Discord API | guide example
wen
wenOP2y ago
so i have a to make a whole website... just to check if the user is present in a guild
Parogo_72
Parogo_722y ago
But a shard can have multiple guilds where the user is present So they would still need to fetch every guild which is api spam Unless I missed something
Want results from more Discord servers?
Add your server