Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道是否有办法检查用户是否启用了私人消息。
此功能适用于支持机器人。目前我使用 GuildMessageRecievedEvent 并向用户发送私人消息。
不,那里没有。您只能发送消息并处理失败:
user.openPrivateChannel().submit() .thenCompose(channel -> channel.sendMessage(x).submit()) .whenComplete((message, error) -> { if (error != null) failed(); else success(); });