I want to check if a member is or not in a server.
This is my current code:
function CheckIfManagerIsInServer(client, server_id, member) {
let isIn = { isIn: true, isNotIn: [] };
if (CheckIfIsInChain(server_id)) {
database.chains.forEach(chain => {
if(chain.membersID.includes(server_id)) {
chain.members.forEach(server => {
const guild = client.guilds.cache.get(server)
// check if member is in the server
})
}
})
}
return isIn;
}
member parameter is the id of the member.
How i can check if the member is or not in the server (guild)?
I'm using v13.5.0.
My bot is verified and it has GUILD_MEMBERS enabled.
I have tried multiple methods but they doesn't works.
How I can do?
Thank you in advance and sorry for bad english!
For checking that you can do like this
if (guild.members.cache.find(m => m.id === member)?.id) {
// true
} else {
// false
}