LoginSignup

Is there a way to check if a specific user id exists within the server? without using cache

Asked 2 months agoAnswer 0Votes 1

1

Is there a way to check if a specific user id exists within the server? without using cache I couldn't find a working code, whether or not the user had never chatted.

` commands.add('test3', (arg) =>{

var exists = bot.users.cache.has(arg);

if (exists == true) { msg.channel.send('1'); }else { msg.channel.send('2');} //msg.sme{e

}); `

This is a temporary command for testing. When user send a command with @anyuser, the bot needs to make sure the user is on the server first (otherwise it could be crashed) but nothing I tried worked properly...

Is there a better way than this?

Is there a way to check if a specific user id exists within the server? without using cache


0 Answers


Your Answer