'Discord js send everyone pm
I want send everyone in server a message or a embed.
I searching google nothing shows up . I Saw some bots doing anonuncements. PM everyone. How i can do that . I want a working example i was using discord js .
Solution 1:[1]
The most effective way to do this would be to make an announcement channel and get the bot to "@everyone".
If you want to DM everyone in the server, loop through a servers members list and DM each user individually; remember that Discord limits 5 messages per every 5 seconds, so put a delay in your loop.
Solution 2:[2]
Discord Api got limits There are limitations with bot DMs, which you can read at https://discordapp.com/developers/docs/topics/rate-limits Better to mention everyone or role.
Solution 3:[3]
This is not recommended, as the Discord API has limits. On the other hand, sending multiple direct messages to users will cause your bot to get blacklisted from "Possible Spam".
Still, you can achieve this as follows:
// Assuming 'guild' is the Server Guild
guild.members.cache.each(member => {
// Send message
member.user.send('An amazing message!').catch(e => {
// An error has occurred
console.log(e);
});
});
Solution 4:[4]
It is possible to go loop through and DM all of the users. However, with the Discord API having limitations this can be more tricky with a large server and you are going to want to implement a sleep function.
Use the code:
guild.members.cache.forEach(m => {
m.user.send('Hello this is a dm!')
})
As Morgan said it is probably easier to simply create a channel and just @everyone
Solution 5:[5]
Discord prohibits you from mass dming users. and you will get rate limited
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Morgan |
Solution 2 | imbeggineroke |
Solution 3 | DangerousZone |
Solution 4 | Kermit |
Solution 5 | Northern Star |