Is it possible to check if user have PM's enabled?

白昼怎懂夜的黑 提交于 2020-01-11 14:07:13

问题


I'd like to know if there is a way to check if a User have Private Messages Enabled.

This Feature is for an Support Bot. Currently I use the GuildMessageRecievedEvent and send a Private Message to the User.


回答1:


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();
    });

This is also shown as an example in openPrivateChannel



来源:https://stackoverflow.com/questions/58890877/is-it-possible-to-check-if-user-have-pms-enabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!