mirror of
https://github.com/aNNiMON/Own-Programming-Language-Tutorial.git
synced 2024-09-20 08:44:20 +03:00
20 lines
510 B
Scala
20 lines
510 B
Scala
use ["std", "okhttp"]
|
|
|
|
TOKEN = "your bot token"
|
|
|
|
println okhttp.request()
|
|
.url("https://api.telegram.org/bot" + TOKEN + "/sendVoice")
|
|
.post(MultipartBody.builder()
|
|
.setType(MultipartBody.FORM)
|
|
.addFormData({
|
|
"chat_id": "-1001100000123",
|
|
"caption": "sample text"
|
|
})
|
|
.addFormDataPart("voice", "file.ogg",
|
|
RequestBody.file("audio/ogg", "voice.ogg"))
|
|
.build()
|
|
)
|
|
.newCall(okhttp.client)
|
|
.execute()
|
|
.body()
|
|
.string() |