using only id to send DM

hey guys, quick question. to avoid api calls, I plan on saving a user's id to my database, then when I need to DM them:
const { Client, GatewayIntentBits, REST, Routes, WebhookClient, User,} = require('discord.js');
const user = new User(discordClient,{id:database_id})
user.send(message)
const { Client, GatewayIntentBits, REST, Routes, WebhookClient, User,} = require('discord.js');
const user = new User(discordClient,{id:database_id})
user.send(message)
it *seems * to work for the few users I've tried. but I have a feeling there are crucial downsides to it (all the other fields in user are null for example). anyone know more about this?
5 Replies
d.js toolkit
d.js toolkit5mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
d.js docs
d.js docs5mo ago
:method: UserManager#send @14.15.3 Sends a message to a user.
IH8MTG
IH8MTGOP5mo ago
does that get the user info with an api call? ok awesome! thanks I'll try it now yep worked perfectly. do you know any downsides to this? (I'm assuming users can't change their snowflake id right?)
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
IH8MTG
IH8MTGOP5mo ago
ok great. thanks guys! I'll close this thread (unless you want me to keep it open)
Want results from more Discord servers?
Add your server