user13532543
user13532543

Reputation:

Discord.js sent message to all member in server?

Discord.js version : 11.4.2

sent message to everyone in server Hello

if(message.content === '!Hello'){
 message.sentall("Hello")
}

Upvotes: 0

Views: 77

Answers (1)

Tenclea
Tenclea

Reputation: 1464

Since you're using Discord.js v11, I suppose that this is what you'll need :

const guild = client.guilds.get("YourGuildID");
guild.members.forEach(member => {
    member.send("YourMessageToSend");
});

Make sure to replace YourGuildID with the id of the guild you want to send the message to, and do the same thing with YourMessageToSend but, with the message you want to send this time.

Upvotes: 1

Related Questions