I am unable to send a private message no matter how I code it. I get the same error. Iv tried different ways of coding it. Iv tried complete(). I'm out of ideas now. I cannot get the bot to send a private message. If it helps, I can't even message the bot myself to even try opening the private conversation. I get Your message could not be delivered because you don't share a server with the recipient or you disabled direct messages on your shared server, recipient is only accepting direct messages from friends, or you were blocked by the recipient.
Expecting it to send a private message
@Override
public void onMessageReceived(MessageReceivedEvent e) {
if (e.getMessage().getContentRaw().equalsIgnoreCase("!help")) {
if (!e.getChannelType().equals(ChannelType.PRIVATE)) {
e.getChannel().sendMessage("Ok " + e.getAuthor().getAsMention() + ", " +
"I sent you a list of commands you can use.").queue();
e.getAuthor().openPrivateChannel().queue((channel) ->
{
channel.sendMessage("test").queue();
});
} else {
e.getChannel().sendMessage(helpList).queue();
}
}
}
16:36:33 [SEVERE] [ForkJoinPool.commonPool-worker-1] ERROR RestAction - RestAction queue returned failure: [ErrorResponseException] 50007: Cannot send messages to this user
My stupid ass had messages disabled from server members
For the next time also join the Discord as the issue tracker is reserved for bug reports and feature requests.
Most helpful comment
My stupid ass had messages disabled from server members