1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-10-31 21:43:48 +00:00

try to fix problem with arguments in InputMedia

This commit is contained in:
InsanusMokrassar 2020-08-20 15:58:11 +06:00
parent 1019fd4d19
commit c3978f2dab
3 changed files with 9 additions and 7 deletions

View File

@ -27,8 +27,7 @@ data class InputMediaPhoto(
}
@Transient
@Deprecated("Marked as deprecated for removal in future updates", level = DeprecationLevel.ERROR)
override val arguments: Map<String, Any?> = error("Unsupported operation")
override val arguments: Map<String, Any?> = buildArguments(serializer())
}
fun PhotoSize.toInputMediaPhoto(

View File

@ -31,6 +31,5 @@ data class InputMediaVideo(
}
@Transient
@Deprecated("Marked as deprecated for removal in future updates", level = DeprecationLevel.ERROR)
override val arguments: Map<String, Any?> = error("Unsupported operation")
override val arguments: Map<String, Any?> = buildArguments(serializer())
}

View File

@ -1,12 +1,16 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedOutput
import kotlinx.serialization.Serializable
import kotlinx.serialization.StringFormat
import kotlinx.serialization.*
import kotlinx.serialization.properties.Properties
internal fun <T> T.buildArguments(withSerializer: SerializationStrategy<T>) = Properties.encodeToMap(
withSerializer,
this
)
@Serializable(MediaGroupMemberInputMediaSerializer::class)
interface MediaGroupMemberInputMedia : InputMedia, CaptionedOutput {
fun serialize(format: StringFormat): String
@Deprecated("Marked as deprecated for removal in future updates", level = DeprecationLevel.ERROR)
val arguments: Map<String, Any?>
}