本文介绍了是否可以检查用户是否启用了PM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否可以检查用户是否启用了私人消息。
I'd like to know if there is a way to check if a User have Private Messages Enabled.
此功能用于支持机器人。当前,我使用GuildMessageRecievedEvent并将私人消息发送给用户。
This Feature is for an Support Bot. Currently I use the GuildMessageRecievedEvent and send a Private Message to the User.
推荐答案
不,没有。您只能发送一条消息并处理失败:
No, there is not. You can only send a message and handle the failure:
user.openPrivateChannel().submit()
.thenCompose(channel -> channel.sendMessage(x).submit())
.whenComplete((message, error) -> {
if (error != null) failed();
else success();
});
这篇关于是否可以检查用户是否启用了PM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!