Im trying to dm a user but I only have there id. This is the code im using:
const member = bot.users.cache.find(ID)
member.send('TEXT')
it isn't working. Does anyone know why?
Im trying to dm a user but I only have there id. This is the code im using:
const member = bot.users.cache.find(ID)
member.send('TEXT')
it isn't working. Does anyone know why?
Like somebody else has stated, the user probably isn't cached. There isn't anything you can do about this as far as I can tell.
If you want to avoid the undefined
error your having, and to catch any errors that may occur when sending the message:
const member = bot.users.cache.find(ID);
if (member) member.send('TEXT').catch(console.error);