45 lines
1.7 KiB
Java
45 lines
1.7 KiB
Java
package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.Builder;
|
|
import lombok.Data;
|
|
import lombok.NoArgsConstructor;
|
|
import lombok.NonNull;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
|
|
|
/**
|
|
* @author Ruben Bermudez
|
|
* @version 1.0
|
|
* Represents the content of a text message to be sent as the result of an inline query.
|
|
*/
|
|
@JsonDeserialize
|
|
@Data
|
|
@RequiredArgsConstructor
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@Builder
|
|
public class InputTextMessageContent implements InputMessageContent {
|
|
|
|
private static final String MESSAGETEXT_FIELD = "message_text";
|
|
private static final String PARSEMODE_FIELD = "parse_mode";
|
|
private static final String DISABLEWEBPAGEPREVIEW_FIELD = "disable_web_page_preview";
|
|
|
|
@JsonProperty(MESSAGETEXT_FIELD)
|
|
@NonNull
|
|
private String messageText; ///< Text of a message to be sent, 1-4096 characters
|
|
@JsonProperty(PARSEMODE_FIELD)
|
|
private String parseMode; ///< Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.
|
|
@JsonProperty(DISABLEWEBPAGEPREVIEW_FIELD)
|
|
private Boolean disableWebPagePreview; ///< Optional. Disables link previews for links in the sent message
|
|
|
|
@Override
|
|
public void validate() throws TelegramApiValidationException {
|
|
if (messageText == null || messageText.isEmpty()) {
|
|
throw new TelegramApiValidationException("MessageText parameter can't be empty", this);
|
|
}
|
|
}
|
|
}
|