So I was writing tje code as a test to implement some functionality.
when a user sends a user ID with a command, the bot have to check if the id is on the server or not, but this error occurs Cannot read properties of undefined (reading 'members')
if (command === "give") {
message.channel.send('test');
if (guild.members.cache.find(m => m.id === args)?.id) {
// true
message.channel.send('FOUND');
} else {
// false
message.channel.send('who is that');
}}
Is there a way to solve the problem or is there another way?