add conversations between AudioFile and VoiceFile

This commit is contained in:
InsanusMokrassar 2020-10-04 20:00:43 +06:00
parent 2378237fc5
commit 800d14561e
3 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,8 @@
* Now in forward info you can get `ForwardFromSupergroupInfo`
* **BREAKING CHANGE** `SendVoice` factory function has changed its signature: now it have now `thumb`
(according to the [documentation](https://core.telegram.org/bots/api#sendvoice))
* `AudioFile` now can be converted to `VoiceFile`
* `VoiceFile` now can be converted to `AudioFile`
* `TelegramBotAPI-extensions-api`:
* ALL REQUESTS EXECUTOR USAGES WERE REPLACED WITH `TelegramBot` TYPEALIAS. It should not bring any break changes
* Internal changes of `sendRegularPoll` and `sendQuizPoll` extensions

View File

@ -24,3 +24,5 @@ data class AudioFile(
override val fileSize: Long? = null,
override val thumb: PhotoSize? = null
) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, TitledMediaFile, Performerable
fun AudioFile.asVoiceFile() = VoiceFile(fileId, fileUniqueId, duration, mimeType, fileSize)

View File

@ -20,3 +20,8 @@ data class VoiceFile(
@SerialName(fileSizeField)
override val fileSize: Long? = null
) : TelegramMediaFile, MimedMediaFile, PlayableMediaFile
fun VoiceFile.asAudioFile(
performer: String? = null,
title: String? = null
) = AudioFile(fileId, fileUniqueId, duration, performer, title, mimeType, fileSize)