Direct messages are not sent
See original GitHub issueI need to send a message to all guild participants I have a message handler:
var userId = socketMessage.Author.Id;
var mainGuild = _client.GetGuild(Bot.MainGuildId);
// Send news
if (socketMessage.Channel.Id == NewsChannelId)
{
var users = mainGuild.GetUsersAsync().GetAsyncEnumerator();
while (users.MoveNextAsync().Result)
{
Console.WriteLine(users.Current.Count);
foreach (var user in users.Current)
{
try
{
var channel = await user.GetOrCreateDMChannelAsync();
await channel.SendMessageAsync(socketMessage.Content);
Console.WriteLine($"Sent msg to {user.Username}");
}
catch (Discord.Net.HttpException e)
{
Console.Write($"Msg: {e.Message}\n" +
$"Username: {user.Username}");
}
}
}
}
But while sending a message to the user ( users.MoveNextAsync() ), an HttpException is thrown with the message “Missing Access”. This is probably due to the fact that there is no DIRECT_MESSAGES intent in the config, but if I connect it, the bot will process Ready for a very long time and after that it will not respond to anything.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
How to Fix 'Instagram Direct Messages Not Sending' Issue
How to Fix 'Instagram Direct Messages Not Sending' Issue: A Comprehensive Guide · 1. Check Your Internet Connection · 2. Update the Instagram...
Read more >A Full Guide to Fixing Instagram Messages Not Sending ...
Fix 3: Restart Your Phone ... Restarting your device is the easiest way to fix the Instagram messages sending issue. That often works...
Read more >Instagram Messages Not Sending? Fix the Problem [The Best ...
Another reason is that the recipient is not following you and has set its settings to receive DMs only from followers. Indeed, that's...
Read more >Instagram Messages Not Sending? 7 Fixes to Try
1. Make Sure Your Internet Is Working · 2. Check if Instagram Is Down · 3. Fix Instagram's Message Problems by Clearing the...
Read more >Twitter Direct Message FAQ – DMs
If you are sending Direct Messages to accounts that do not follow you, you may need to verify your phone number. If you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s called mass dming that’s not allowed
I’ve tried mass DMing, not worth it, you’ll just get your Discord application banned. If you’re gonna do it anyway, then add a 10-minute delay every 10 users DMed.