From 915a3dcd41e855a66f1a76ea008bd346fa7ba5b2 Mon Sep 17 00:00:00 2001 From: rubenlagus Date: Tue, 31 Dec 2019 11:40:34 +0100 Subject: [PATCH] Update 4.5 --- .../meta/api/methods/ParseMode.java | 1 + .../meta/api/methods/send/SendMessage.java | 11 ++++++++- .../meta/api/objects/ChatPhoto.java | 24 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ParseMode.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ParseMode.java index 496e2f37..71e763b0 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ParseMode.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/ParseMode.java @@ -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"; } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java index 6be6fd98..5377de33 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMessage.java @@ -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 { 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; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPhoto.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPhoto.java index d12f2e84..05e4cfba 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPhoto.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/ChatPhoto.java @@ -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 + '\'' + '}'; } }