1

For a server of mine, I need my bot to DM everyone at regular periods of time. I use

client.users.cache.get(args[1]).send(toSend);

to do this, where args[1] contains the user's id and toSend is the message to send. However, it just turns up Cannot read property 'send' of undefined. Then I tried logging client.users.cache to the console and it appears that only 2 users are in it, the bot itself and me. Why is this so, given that the server has at least 30 users?

  • 2
    see if this answers your question https://stackoverflow.com/questions/64739350/discord-js-bot-welcomes-member-assign-a-role-and-send-them-a-dm/64739684#64739684 – Worthy Alpaca Nov 23 '20 at 19:17
  • @WorthyAlpaca Oh wow, that simple. Thanks! – Computer Crafter Nov 23 '20 at 19:32
  • 1
    Does this answer your question? [Discord.js Bot Welcomes Member, Assign a Role and send them a DM](https://stackoverflow.com/questions/64739350/discord-js-bot-welcomes-member-assign-a-role-and-send-them-a-dm) – Xeoth Nov 23 '20 at 20:23
  • 2
    Does this answer your question? [None of my discord.js guildmember events are emitting, my user caches are basically empty, and my functions are timing out?](https://stackoverflow.com/questions/64559390/none-of-my-discord-js-guildmember-events-are-emitting-my-user-caches-are-basica) – Lioness100 Nov 23 '20 at 20:45

0 Answers0