AudioMessage¶
The AudioMessage class builder is designed for sending audio files.
Examples:
import space.zoommax.view.AudioMessage;
public class example {
public static void main(String[] args) {
AudioMessage audioMessage = AudioMessage.builder()
.chatId(123456789)
.audioAsUrl("https://example.com/audio.mp3")
/*optional
.audioAsFile(new File("path/to/audio.mp3"))
.audioAsBytes(new byte[]{1,2,3,4,5})
*/
.keyboard(Keyboard.builder()
.chatId(123456789)
.code("{Google;https://google.ru}{Yandex;https://ya.ru}\n" +
"{Start;strt}")
.build())
.caption("Hello")
.onMessageFlag("start")
.notify(false)
.build();
audioMessage.run();
}
}
Parameters:
chatId- the chat IDaudioAsUrl- the URL of the audio fileaudioAsFile- the audio fileaudioAsBytes- the bytes of the audio filecaption- the caption for the audio filekeyboard- the keyboardKeyboardonMessageFlag- the flag used for message processingnotify- indicates whether the message is a notification. Default isfalse.
It can be returned as a ViewMessage or executed using the run() method.