Update 4.5

This commit is contained in:
rubenlagus 2019-12-31 11:40:34 +01:00 committed by Ruben Bermudez
parent d8eacfc0b4
commit 915a3dcd41
3 changed files with 35 additions and 1 deletions

View File

@ -8,5 +8,6 @@ package org.telegram.telegrambots.meta.api.methods;
*/
public class ParseMode {
public static final String MARKDOWN = "Markdown";
public static final String MARKDOWNV2 = "MarkdownV2";
public static final String HTML = "html";
}

View File

@ -5,8 +5,8 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.ParseMode;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -155,6 +155,15 @@ public class SendMessage extends BotApiMethod<Message> {
return this;
}
public SendMessage enableMarkdownV2(boolean enable) {
if (enable) {
this.parseMode = ParseMode.MARKDOWNV2;
} else {
this.parseMode = null;
}
return this;
}
@Override
public String getMethod() {
return PATH;

View File

@ -10,7 +10,9 @@ import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
*/
public class ChatPhoto implements BotApiObject {
private static final String SMALLFILEID_FIELD = "small_file_id";
private static final String SMALLFILEUNIQUEID_FIELD = "small_file_unique_id";
private static final String BIGFILEID_FIELD = "big_file_id";
private static final String BIGFILEUNIQUEID_FIELD = "big_file_unique_id";
/**
* Unique file identifier of a small chat photo (160x160).
@ -18,12 +20,24 @@ public class ChatPhoto implements BotApiObject {
*/
@JsonProperty(SMALLFILEID_FIELD)
private String smallFileId;
/**
* Unique identifier for a big chat photo (160x160), which is supposed to be the same over time and for different bots.
* Can't be used to download or reuse the file.
*/
@JsonProperty(SMALLFILEUNIQUEID_FIELD)
private String smallFileUniqueId;
/**
* Unique file identifier of a big chat photo (640x640).
* This file_id can be used only for photo download and only for as long as the photo is not changed.
*/
@JsonProperty(BIGFILEID_FIELD)
private String bigFileId;
/**
* Unique identifier for a big chat photo (640x640), which is supposed to be the same over time and for different bots.
* Can't be used to download or reuse the file.
*/
@JsonProperty(BIGFILEUNIQUEID_FIELD)
private String bigFileUniqueId;
public ChatPhoto() {
super();
@ -37,11 +51,21 @@ public class ChatPhoto implements BotApiObject {
return bigFileId;
}
public String getSmallFileUniqueId() {
return smallFileUniqueId;
}
public String getBigFileUniqueId() {
return bigFileUniqueId;
}
@Override
public String toString() {
return "ChatPhoto{" +
"smallFileId='" + smallFileId + '\'' +
", smallFileUniqueId='" + smallFileUniqueId + '\'' +
", bigFileId='" + bigFileId + '\'' +
", bigFileUniqueId='" + bigFileUniqueId + '\'' +
'}';
}
}