public static boolean isUserMessage(Update update) {
    if (MESSAGE.test(update)) {
      return update.getMessage().isUserMessage();
    } else if (CALLBACK_QUERY.test(update)) {
      return update.getCallbackQuery().getMessage().isUserMessage();
    } else if (CHANNEL_POST.test(update)) {
      return update.getChannelPost().isUserMessage();
    } else if (EDITED_CHANNEL_POST.test(update)) {
      return update.getEditedChannelPost().isUserMessage();
    } else if (EDITED_MESSAGE.test(update)) {
      return update.getEditedMessage().isUserMessage();
    } else if (CHOSEN_INLINE_QUERY.test(update) || INLINE_QUERY.test(update)) {
      return true;
    } else {
      throw new IllegalStateException("Could not retrieve update context origin (user/group)");
    }
  }
public static boolean isUserMessage ( Update update ) { if ( MESSAGE . test ( update ) ) { return update . getMessage ( ) . isUserMessage ( ) ; } else if ( CALLBACK_QUERY . test ( update ) ) { return update . getCallbackQuery ( ) . getMessage ( ) . isUserMessage ( ) ; } else if ( CHANNEL_POST . test ( update ) ) { return update . getChannelPost ( ) . isUserMessage ( ) ; } else if ( EDITED_CHANNEL_POST . test ( update ) ) { return update . getEditedChannelPost ( ) . isUserMessage ( ) ; } else if ( EDITED_MESSAGE . test ( update ) ) { return update . getEditedMessage ( ) . isUserMessage ( ) ; } else if ( CHOSEN_INLINE_QUERY . test ( update ) || INLINE_QUERY . test ( update ) ) { return true ; } else { throw new IllegalStateException ( "Could not retrieve update context origin (user/group)" ) ; } }
@param update a Telegram {@link Update}
@return <tt>true</tt> if the update contains contains a private user message