bivashy / java-vk-bots-long-poll-api

A Java library to create VK bots using Bots Long Poll API
MIT License
3 stars 0 forks source link

[Question] Как проверить, из беседы ли сообщение? #120

Closed BlackBaroness closed 2 years ago

BlackBaroness commented 2 years ago

Как можно из MessageNew узнать, что сообщение пришло в беседе, а не в лс сообщества? Не нашёл у ВК документации на эту тему

yvasyliev commented 2 years ago
/**
 * To check whether the message came from a dialog or a group chat.
 *
 * @param message a message to check.
 * @return {@code true} if the message is from a dialog, and {@code false} otherwise.
 */
public boolean isDialogMessage(Message message) {
    return message.getPeerId().equals(message.getFromId());
}