How to send a DM to a specific user id on a sharded bot?

I need to send a DM to a specific user id on my sharded bot, how do I do this?
8 Replies
d.js toolkit
d.js toolkit•14mo 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!
d.js docs
d.js docs•14mo ago
method UserManager#send() Sends a message to a user.
Kinect3000
Kinect3000•14mo ago
It only becomes complicated when you want to receive messages from shards other than 0
Eddippla
Eddippla•14mo ago
So I can send messages to any discord user that the bot has a shared server with from shard 0?
Kinect3000
Kinect3000•14mo ago
You can use any shard
Eddippla
Eddippla•14mo ago
Perfect also, do you know the best way to do a "global ban" throughout all servers the bot is in on a sharded bot? im thinking of running an eval on each shard, going through the cache and then banning each find of the member true, however the list of globally banned people can get pretty big how im thinking of implementing it is: - have a cache of every user and their id - each cache has all the members respective joined servers that tildebot is also in - once my bot wants to ban someone, it goes through that users cache, then the server ids there and bans them from each one and everything is done except the actual banning system the cache is implemented using mongodb as its very fast and doesn't use RAM, it uses the storage drive p.s. i think i just lost like 10 server adds because my bot has "require oauth 2 grant" enabled and i think it needs to manually join then lmao
Eddippla
Eddippla•14mo ago
this person tried to add it like 2 times as you can see but it failed twice
No description
Eddippla
Eddippla•14mo ago
im not fully sure, i turned it on by accident today lol btw, the bot i made is fully optimized for everything, speed, etc for example it could probably handle like thousands of servers right now as its on a dedi server,only issue is im not sure if discord APi itself is that optimized like if discord api goes down then I will not have new members cached for example true lol, the bot and all its systems should be very very safe and optimized and work well, sharding is already set up even though its not even over 100 servers (yet), etc much more too
Want results from more Discord servers?
Add your server