diff --git a/src/main/java/org/telegram/api/Message.java b/src/main/java/org/telegram/api/Message.java index 8761a15..2321ca1 100644 --- a/src/main/java/org/telegram/api/Message.java +++ b/src/main/java/org/telegram/api/Message.java @@ -81,6 +81,9 @@ public class Message { public static final String REPLYTOMESSAGE_FIELD = "reply_to_message"; @JsonProperty(REPLYTOMESSAGE_FIELD) private Message replyToMessage; + public static final String VOICE_FIELD = "voice"; + @JsonProperty(VOICE_FIELD) + private Voice voice; ///< Optional. Message is a voice message, information about the file public Message() { super(); @@ -126,6 +129,9 @@ public class Message { if (jsonObject.has(LOCATION_FIELD)) { this.location = new Location(jsonObject.getJSONObject(LOCATION_FIELD)); } + if (jsonObject.has(VOICE_FIELD)) { + this.voice = new Voice(jsonObject.getJSONObject(VOICE_FIELD)); + } if (jsonObject.has(NEWCHATPARTICIPANT_FIELD)) { this.newChatParticipant = new User(jsonObject.getJSONObject(NEWCHATPARTICIPANT_FIELD)); } @@ -342,4 +348,12 @@ public class Message { public boolean hasLocation() { return location != null; } + + public Voice getVoice() { + return voice; + } + + public void setVoice(Voice voice) { + this.voice = voice; + } }