From b3099f58cfee3dc1140abd82b1536467b926958a Mon Sep 17 00:00:00 2001 From: Chase22 Date: Sat, 31 Dec 2022 11:34:37 +0100 Subject: [PATCH] Externalize interface for MediaSendingMethods and add getMethod to PartialBotApiMethod --- .../meta/api/methods/BotApiMethod.java | 7 ------ .../meta/api/methods/PartialBotApiMethod.java | 8 +++++++ .../groupadministration/SetChatPhoto.java | 5 ++++ .../meta/api/methods/send/SendAnimation.java | 21 +++++++++++++--- .../meta/api/methods/send/SendAudio.java | 18 ++++++++++++-- .../meta/api/methods/send/SendDocument.java | 19 +++++++++++++-- .../api/methods/send/SendMediaBotMethod.java | 24 +++++++++++++++++++ .../meta/api/methods/send/SendMediaGroup.java | 5 ++++ .../meta/api/methods/send/SendPhoto.java | 17 +++++++++++-- .../meta/api/methods/send/SendSticker.java | 19 +++++++++++++-- .../meta/api/methods/send/SendVideo.java | 18 ++++++++++++-- .../meta/api/methods/send/SendVideoNote.java | 18 ++++++++++++-- .../meta/api/methods/send/SendVoice.java | 18 ++++++++++++-- .../api/methods/stickers/AddStickerToSet.java | 5 ++++ .../methods/stickers/CreateNewStickerSet.java | 7 ++++-- .../methods/stickers/UploadStickerFile.java | 5 ++++ .../updatingmessages/EditMessageMedia.java | 5 ++++ 17 files changed, 193 insertions(+), 26 deletions(-) create mode 100644 telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaBotMethod.java diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/BotApiMethod.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/BotApiMethod.java index 620f7bf2..6ca13881 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/BotApiMethod.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/BotApiMethod.java @@ -2,7 +2,6 @@ package org.telegram.telegrambots.meta.api.methods; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; @@ -17,10 +16,4 @@ import java.io.Serializable; public abstract class BotApiMethod extends PartialBotApiMethod { protected static final String METHOD_FIELD = "method"; - /** - * Getter for method path (that is the same as method name) - * @return Method path - */ - @JsonProperty(METHOD_FIELD) - public abstract String getMethod(); } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/PartialBotApiMethod.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/PartialBotApiMethod.java index 9251e867..a1e9d1f1 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/PartialBotApiMethod.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/PartialBotApiMethod.java @@ -1,6 +1,7 @@ package org.telegram.telegrambots.meta.api.methods; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.CollectionType; @@ -56,4 +57,11 @@ public abstract class PartialBotApiMethod implements Val throw new TelegramApiRequestException("Unable to deserialize response", e); } } + + /** + * Getter for method path (that is the same as method name) + * @return Method path + */ + @JsonProperty(BotApiMethod.METHOD_FIELD) + public abstract String getMethod(); } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPhoto.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPhoto.java index 69db04ec..cc63c7e3 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPhoto.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/SetChatPhoto.java @@ -46,6 +46,11 @@ public class SetChatPhoto extends PartialBotApiMethod { this.chatId = chatId.toString(); } + @Override + public String getMethod() { + return PATH; + } + @Override public Boolean deserializeResponse(String answer) throws TelegramApiRequestException { return deserializeResponse(answer, Boolean.class); diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java index 29f86c59..a0e306bb 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAnimation.java @@ -11,7 +11,6 @@ import lombok.Setter; import lombok.Singular; import lombok.ToString; import lombok.experimental.Tolerate; -import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.MessageEntity; @@ -37,7 +36,7 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @Builder -public class SendAnimation extends PartialBotApiMethod { +public class SendAnimation extends SendMediaBotMethod { public static final String PATH = "sendAnimation"; public static final String CHATID_FIELD = "chat_id"; @@ -58,6 +57,8 @@ public class SendAnimation extends PartialBotApiMethod { @NonNull private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) + private Integer messageThreadId; + /** * Animation to send. Pass a file_id as String to send an animation that exists on the * Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation @@ -67,7 +68,6 @@ public class SendAnimation extends PartialBotApiMethod { * Unique identifier for the target message thread (topic) of the forum; * for forum supergroups only */ - private Integer messageThreadId; @NonNull private InputFile animation; private Integer duration; ///< Optional. Duration of sent animation in seconds @@ -130,6 +130,21 @@ public class SendAnimation extends PartialBotApiMethod { } } + @Override + public String getMethod() { + return PATH; + } + + @Override + public InputFile getFile() { + return animation; + } + + @Override + public String getFileField() { + return ANIMATION_FIELD; + } + public static class SendAnimationBuilder { @Tolerate diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java index bee6f1d5..33c52d10 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendAudio.java @@ -11,7 +11,6 @@ import lombok.Setter; import lombok.Singular; import lombok.ToString; import lombok.experimental.Tolerate; -import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.MessageEntity; @@ -38,7 +37,7 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @Builder -public class SendAudio extends PartialBotApiMethod { +public class SendAudio extends SendMediaBotMethod { public static final String PATH = "sendaudio"; public static final String DURATION_FIELD = "duration"; @@ -127,6 +126,21 @@ public class SendAudio extends PartialBotApiMethod { } } + @Override + public String getMethod() { + return PATH; + } + + @Override + public InputFile getFile() { + return audio; + } + + @Override + public String getFileField() { + return AUDIO_FIELD; + } + public static class SendAudioBuilder { @Tolerate diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java index 75e4a4f0..c25acea0 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendDocument.java @@ -11,7 +11,6 @@ import lombok.Setter; import lombok.Singular; import lombok.ToString; import lombok.experimental.Tolerate; -import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.MessageEntity; @@ -34,7 +33,7 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @Builder -public class SendDocument extends PartialBotApiMethod { +public class SendDocument extends SendMediaBotMethod { public static final String PATH = "senddocument"; public static final String CHATID_FIELD = "chat_id"; @@ -97,6 +96,7 @@ public class SendDocument extends PartialBotApiMethod { public Message deserializeResponse(String answer) throws TelegramApiRequestException { return deserializeResponse(answer, Message.class); } + @Override public void validate() throws TelegramApiValidationException { if (chatId.isEmpty()) { @@ -118,6 +118,21 @@ public class SendDocument extends PartialBotApiMethod { } } + @Override + public InputFile getFile() { + return document; + } + + @Override + public String getFileField() { + return DOCUMENT_FIELD; + } + + @Override + public String getMethod() { + return PATH; + } + public static class SendDocumentBuilder { @Tolerate diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaBotMethod.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaBotMethod.java new file mode 100644 index 00000000..14b9f3ee --- /dev/null +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaBotMethod.java @@ -0,0 +1,24 @@ +package org.telegram.telegrambots.meta.api.methods.send; + +import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; +import org.telegram.telegrambots.meta.api.objects.InputFile; + +import java.io.Serializable; + +public abstract class SendMediaBotMethod extends PartialBotApiMethod { + public static String CHATID_FIELD = "chat_id"; + public static String MESSAGETHREADID_FIELD = "message_thread_id"; + public static String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; + public static String DISABLENOTIFICATION_FIELD = "disable_notification"; + public static String PROTECTCONTENT_FIELD = "protect_content"; + public static String ALLOWSENDINGWITHOUTREPLY_FIELD = "allow_sending_without_reply"; + + public abstract String getChatId(); + public abstract Integer getMessageThreadId(); + public abstract Integer getReplyToMessageId(); + public abstract Boolean getDisableNotification(); + public abstract Boolean getAllowSendingWithoutReply(); + public abstract Boolean getProtectContent(); + public abstract InputFile getFile(); + public abstract String getFileField(); +} diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java index b262ca77..cf0984cc 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendMediaGroup.java @@ -115,6 +115,11 @@ public class SendMediaGroup extends PartialBotApiMethod> { } } + @Override + public String getMethod() { + return PATH; + } + public static class SendMediaGroupBuilder { @Tolerate diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java index dbb3a6e8..5ebb5107 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendPhoto.java @@ -11,7 +11,6 @@ import lombok.Setter; import lombok.Singular; import lombok.ToString; import lombok.experimental.Tolerate; -import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.MessageEntity; @@ -35,7 +34,7 @@ import java.util.Objects; @NoArgsConstructor @AllArgsConstructor @Builder -public class SendPhoto extends PartialBotApiMethod { +public class SendPhoto extends SendMediaBotMethod { public static final String PATH = "sendphoto"; public static final String CHATID_FIELD = "chat_id"; @@ -108,8 +107,22 @@ public class SendPhoto extends PartialBotApiMethod { } } + @Override + public InputFile getFile() { + return photo; + } + + @Override + public String getFileField() { + return PHOTO_FIELD; + } + @Override + public String getMethod() { + return PATH; + } public static class SendPhotoBuilder { + @Tolerate public SendPhotoBuilder chatId(@NonNull Long chatId) { this.chatId = chatId.toString(); diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java index 85adf9ad..9dfefe04 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendSticker.java @@ -10,7 +10,6 @@ import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.ToString; import lombok.experimental.Tolerate; -import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; @@ -31,7 +30,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; @NoArgsConstructor @AllArgsConstructor @Builder -public class SendSticker extends PartialBotApiMethod { +public class SendSticker extends SendMediaBotMethod { public static final String PATH = "sendsticker"; public static final String CHATID_FIELD = "chat_id"; @@ -93,6 +92,22 @@ public class SendSticker extends PartialBotApiMethod { } } + @Override + public String getMethod() { + return null; + } + + @Override + public InputFile getFile() { + return sticker; + } + + @Override + public String getFileField() { + return STICKER_FIELD; + } + + public static class SendStickerBuilder { @Tolerate diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java index bfd9d850..303ffb0a 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideo.java @@ -11,7 +11,6 @@ import lombok.Setter; import lombok.Singular; import lombok.ToString; import lombok.experimental.Tolerate; -import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.MessageEntity; @@ -35,7 +34,7 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @Builder -public class SendVideo extends PartialBotApiMethod { +public class SendVideo extends SendMediaBotMethod { public static final String PATH = "sendvideo"; public static final String CHATID_FIELD = "chat_id"; @@ -125,6 +124,21 @@ public class SendVideo extends PartialBotApiMethod { } } + @Override + public InputFile getFile() { + return video; + } + + @Override + public String getFileField() { + return VIDEO_FIELD; + } + + @Override + public String getMethod() { + return PATH; + } + public static class SendVideoBuilder { @Tolerate diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java index 43e0a5b7..337300bd 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVideoNote.java @@ -10,7 +10,6 @@ import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.ToString; import lombok.experimental.Tolerate; -import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; @@ -32,7 +31,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; @NoArgsConstructor @AllArgsConstructor @Builder -public class SendVideoNote extends PartialBotApiMethod { +public class SendVideoNote extends SendMediaBotMethod { public static final String PATH = "sendvideonote"; public static final String CHATID_FIELD = "chat_id"; @@ -106,6 +105,21 @@ public class SendVideoNote extends PartialBotApiMethod { } } + @Override + public String getMethod() { + return PATH; + } + + @Override + public InputFile getFile() { + return videoNote; + } + + @Override + public String getFileField() { + return VIDEONOTE_FIELD; + } + public static class SendVideoNoteBuilder { @Tolerate diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java index 7c64ff1f..0936f81f 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/send/SendVoice.java @@ -11,7 +11,6 @@ import lombok.Setter; import lombok.Singular; import lombok.ToString; import lombok.experimental.Tolerate; -import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.MessageEntity; @@ -36,7 +35,7 @@ import java.util.List; @NoArgsConstructor @AllArgsConstructor @Builder -public class SendVoice extends PartialBotApiMethod { +public class SendVoice extends SendMediaBotMethod { public static final String PATH = "sendvoice"; public static final String CHATID_FIELD = "chat_id"; @@ -106,6 +105,21 @@ public class SendVoice extends PartialBotApiMethod { } } + @Override + public String getMethod() { + return PATH; + } + + @Override + public InputFile getFile() { + return voice; + } + + @Override + public String getFileField() { + return VOICE_FIELD; + } + public static class SendVoiceBuilder { @Tolerate diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/AddStickerToSet.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/AddStickerToSet.java index 80f1f0dd..1dd41b30 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/AddStickerToSet.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/AddStickerToSet.java @@ -76,6 +76,11 @@ public class AddStickerToSet extends PartialBotApiMethod { return deserializeResponse(answer, Boolean.class); } + @Override + public String getMethod() { + return PATH; + } + @Override public void validate() throws TelegramApiValidationException { if (userId <= 0) { diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/CreateNewStickerSet.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/CreateNewStickerSet.java index af7351f2..c2ea8ad5 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/CreateNewStickerSet.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/CreateNewStickerSet.java @@ -10,7 +10,6 @@ import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.ToString; import lombok.experimental.Tolerate; -import org.telegram.telegrambots.meta.api.methods.CopyMessage; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.stickers.MaskPosition; @@ -18,7 +17,6 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import java.util.Arrays; -import java.util.List; /** * @author Ruben Bermudez @@ -124,6 +122,11 @@ public class CreateNewStickerSet extends PartialBotApiMethod { return "mask".equals(stickerType); } + @Override + public String getMethod() { + return PATH; + } + @Override public Boolean deserializeResponse(String answer) throws TelegramApiRequestException { return deserializeResponse(answer, Boolean.class); diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/UploadStickerFile.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/UploadStickerFile.java index 840b3959..8954fd21 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/UploadStickerFile.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/stickers/UploadStickerFile.java @@ -42,6 +42,11 @@ public class UploadStickerFile extends PartialBotApiMethod { @NonNull private InputFile pngSticker; ///< New sticker file + @Override + public String getMethod() { + return PATH; + } + @Override public File deserializeResponse(String answer) throws TelegramApiRequestException { return deserializeResponse(answer, File.class); diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageMedia.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageMedia.java index 44745131..0b1ceb05 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageMedia.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/updatingmessages/EditMessageMedia.java @@ -81,6 +81,11 @@ public class EditMessageMedia extends PartialBotApiMethod { this.chatId = chatId == null ? null : chatId.toString(); } + @Override + public String getMethod() { + return PATH; + } + @Override public Serializable deserializeResponse(String answer) throws TelegramApiRequestException { try {