Replies: 3 comments 3 replies
-
Be more descriptive. You want to send every member on DM, Channel or Mention from Channel? |
Beta Was this translation helpful? Give feedback.
2 replies
-
Sorry for late reply but we can send dm message with only bot... node self-bot isn't working for that. // Place `https://gist.github.com/rigwild/6063278cbc9267e7691c084c67176114` here and replace your script like this;
// Don't forget to install `node-fetch` module. ( npm i [email protected] ) <--- IMPORTANT!
// Don't forget to make isBotAccount = false <--- IMPORTANT!
// Don't forget set authHeader Token <--- IMPORTANT!
// Your script
;(async () => {
const guildId = "GUILD_ID_HERE"; // Your Guild ID
// We must don't have body so i write this;
fetch(`https://discord.com/api/v10/guilds/${guildId}/members?limit=1000`, { // Maximum 1000 User
method: "GET",
headers: {
Authorization: `${authHeader}`
}
})
.then(response => response.json())
.then(data => {
console.log(data) // Logging all users to console, if you don't want remove this line
// Sending all user with loop (this is doesn't have delay so its sending immediately)
data.forEach(user => {
// Create DM for all users
fetch(`https://discord.com/api/v10/users/@me/channels`, {
method: "POST",
headers: {
Authorization: `${authHeader}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ recipient_id: user.user.id })
})
.then(response => response.json())
.then(channelData => {
// Sending message with API
fetch(`https://discord.com/api/v10/channels/${channelData.id}/messages`, {
method: "POST",
headers: {
Authorization: `${authHeader}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ content: "Message content" }) // Your message content here
});
});
});
});
})() |
Beta Was this translation helpful? Give feedback.
0 replies
-
Is messaging users with this bot working or not? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
how can i send message to every member in guild
Beta Was this translation helpful? Give feedback.
All reactions