committed by
Rubenlagus
4 changed files with 140 additions and 6 deletions
@ -0,0 +1,69 @@ |
|||||
|
package org.telegram.api; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import org.json.JSONObject; |
||||
|
|
||||
|
/** |
||||
|
* @author Ruben Bermudez |
||||
|
* @version 1.0 |
||||
|
* @brief This object represents a voice note |
||||
|
* @date 16 of July of 2015 |
||||
|
*/ |
||||
|
public class Voice { |
||||
|
public static final String FILEID_FIELD = "file_id"; |
||||
|
@JsonProperty(FILEID_FIELD) |
||||
|
private String fileId; ///< Unique identifier for this file
|
||||
|
public static final String DURATION_FIELD = "duration"; |
||||
|
@JsonProperty(DURATION_FIELD) |
||||
|
private Integer duration; ///< Integer Duration of the audio in seconds as defined by sender
|
||||
|
public static final String MIMETYPE_FIELD = "mime_type"; |
||||
|
@JsonProperty(MIMETYPE_FIELD) |
||||
|
private String mimeType; ///< Optional. MIME type of the file as defined by sender
|
||||
|
public static final String FILESIZE_FIELD = "file_size"; |
||||
|
@JsonProperty(FILESIZE_FIELD) |
||||
|
private Integer fileSize; ///< Optional. File size
|
||||
|
|
||||
|
public Voice() { |
||||
|
super(); |
||||
|
} |
||||
|
|
||||
|
public Voice(JSONObject jsonObject) { |
||||
|
super(); |
||||
|
this.fileId = jsonObject.getString(FILEID_FIELD); |
||||
|
this.duration = jsonObject.getInt(DURATION_FIELD); |
||||
|
this.mimeType = jsonObject.optString(MIMETYPE_FIELD, ""); |
||||
|
this.fileSize = jsonObject.optInt(FILESIZE_FIELD, 0); |
||||
|
} |
||||
|
|
||||
|
public String getFileId() { |
||||
|
return fileId; |
||||
|
} |
||||
|
|
||||
|
public void setFileId(String fileId) { |
||||
|
this.fileId = fileId; |
||||
|
} |
||||
|
|
||||
|
public Integer getDuration() { |
||||
|
return duration; |
||||
|
} |
||||
|
|
||||
|
public void setDuration(Integer duration) { |
||||
|
this.duration = duration; |
||||
|
} |
||||
|
|
||||
|
public String getMimeType() { |
||||
|
return mimeType; |
||||
|
} |
||||
|
|
||||
|
public void setMimeType(String mimeType) { |
||||
|
this.mimeType = mimeType; |
||||
|
} |
||||
|
|
||||
|
public Integer getFileSize() { |
||||
|
return fileSize; |
||||
|
} |
||||
|
|
||||
|
public void setFileSize(Integer fileSize) { |
||||
|
this.fileSize = fileSize; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package org.telegram.methods; |
||||
|
|
||||
|
import org.telegram.api.ReplyKeyboard; |
||||
|
|
||||
|
/** |
||||
|
* @author Ruben Bermudez |
||||
|
* @version 1.0 |
||||
|
* @brief Use this method to send voice notes, if you want Telegram clients to display |
||||
|
* the file as a playable voice message. |
||||
|
* For this to work, your audio must be in an .ogg file encoded with OPUS |
||||
|
* (other formats may be sent as Audio or Document). |
||||
|
* @date 16 of July of 2015 |
||||
|
*/ |
||||
|
public class SendVoice { |
||||
|
public static final String PATH = "sendvoice"; |
||||
|
|
||||
|
public static final String CHATID_FIELD = "chat_id"; |
||||
|
private Integer chatId; ///< Unique identifier for the message recepient — User or GroupChat id
|
||||
|
public static final String AUDIO_FIELD = "audio"; |
||||
|
private String audio; ///< Audio file to send. file_id as String to resend an audio that is already on the Telegram servers
|
||||
|
public static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; |
||||
|
private Integer replayToMessageId; ///< Optional. If the message is a reply, ID of the original message
|
||||
|
public static final String REPLYMARKUP_FIELD = "reply_markup"; |
||||
|
private ReplyKeyboard replayMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
|
||||
|
public static final String DURATION_FIELD = "duration"; |
||||
|
private Integer duration; ///< Optional. Duration of sent audio in seconds
|
||||
|
|
||||
|
public SendVoice() { |
||||
|
super(); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue