Class SendAudio
- java.lang.Object
-
- org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod<Message>
-
- org.telegram.telegrambots.meta.api.methods.send.SendAudio
-
- All Implemented Interfaces:
Validable
public class SendAudio extends PartialBotApiMethod<Message>
- Version:
- 1.0 Use this method to send audio files, Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in an .mp3 format. On success, the sent Message is returned. Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
- Author:
- Ruben Bermudez
-
-
Field Summary
Fields Modifier and Type Field Description static StringAUDIO_FIELDstatic StringCAPTION_FIELDstatic StringCHATID_FIELDstatic StringDISABLENOTIFICATION_FIELDstatic StringDURATION_FIELDstatic StringPARSEMODE_FIELDstatic StringPATHstatic StringPERFOMER_FIELDstatic StringREPLYMARKUP_FIELDstatic StringREPLYTOMESSAGEID_FIELDstatic StringTHUMB_FIELDstatic StringTITLE_FIELD-
Fields inherited from class org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod
OBJECT_MAPPER
-
-
Constructor Summary
Constructors Constructor Description SendAudio()
-
Method Summary
-
-
-
Field Detail
-
PATH
public static final String PATH
- See Also:
- Constant Field Values
-
DURATION_FIELD
public static final String DURATION_FIELD
- See Also:
- Constant Field Values
-
CHATID_FIELD
public static final String CHATID_FIELD
- See Also:
- Constant Field Values
-
AUDIO_FIELD
public static final String AUDIO_FIELD
- See Also:
- Constant Field Values
-
REPLYTOMESSAGEID_FIELD
public static final String REPLYTOMESSAGEID_FIELD
- See Also:
- Constant Field Values
-
DISABLENOTIFICATION_FIELD
public static final String DISABLENOTIFICATION_FIELD
- See Also:
- Constant Field Values
-
REPLYMARKUP_FIELD
public static final String REPLYMARKUP_FIELD
- See Also:
- Constant Field Values
-
PERFOMER_FIELD
public static final String PERFOMER_FIELD
- See Also:
- Constant Field Values
-
TITLE_FIELD
public static final String TITLE_FIELD
- See Also:
- Constant Field Values
-
CAPTION_FIELD
public static final String CAPTION_FIELD
- See Also:
- Constant Field Values
-
PARSEMODE_FIELD
public static final String PARSEMODE_FIELD
- See Also:
- Constant Field Values
-
THUMB_FIELD
public static final String THUMB_FIELD
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDuration
public Integer getDuration()
-
getChatId
public String getChatId()
-
getAudio
public InputFile getAudio()
-
setAudio
public SendAudio setAudio(String audio)
Use this method to set the audio to an audio existing in Telegram system- Parameters:
audio- File_id of the audio to send
-
setAudio
public SendAudio setAudio(File file)
Use this method to set the audio to a new file- Parameters:
file- New audio file
-
setAudio
public SendAudio setAudio(String audioName, InputStream inputStream)
-
getReplyToMessageId
public Integer getReplyToMessageId()
-
getReplyMarkup
public ReplyKeyboard getReplyMarkup()
-
setReplyMarkup
public SendAudio setReplyMarkup(ReplyKeyboard replyMarkup)
-
getPerformer
public String getPerformer()
-
getTitle
public String getTitle()
-
getDisableNotification
public Boolean getDisableNotification()
-
enableNotification
public SendAudio enableNotification()
-
disableNotification
public SendAudio disableNotification()
-
getCaption
public String getCaption()
-
getParseMode
public String getParseMode()
-
getThumb
public InputFile getThumb()
-
deserializeResponse
public Message deserializeResponse(String answer) throws TelegramApiRequestException
Description copied from class:PartialBotApiMethodDeserialize a json answer to the response type to a method- Specified by:
deserializeResponsein classPartialBotApiMethod<Message>- Parameters:
answer- Json answer received- Returns:
- Answer for the method
- Throws:
TelegramApiRequestException
-
validate
public void validate() throws TelegramApiValidationExceptionDescription copied from interface:ValidableValidates that mandatory fields are filled and optional objects- Throws:
TelegramApiValidationException- If any mandatory field is empty
-
-