1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-03 00:15:27 +00:00

dice changes

This commit is contained in:
InsanusMokrassar 2020-05-16 20:46:49 +06:00
parent 7008f312dc
commit 0ec18cbf06
2 changed files with 12 additions and 2 deletions

View File

@ -58,6 +58,9 @@
* `SetWebhook` factories signatures was changed (backward compatibility was not broken) * `SetWebhook` factories signatures was changed (backward compatibility was not broken)
* `executeUnsafe` now working differently * `executeUnsafe` now working differently
* Now it is possible to pass exceptions handler into `executeUnsafe` * Now it is possible to pass exceptions handler into `executeUnsafe`
* `BasketballDiceAnimationType` was added
* `UnknownDiceAnimationType` now is deprecated due to renaming - currently it is typealias for `CustomDiceAnimationType`
* `CustomDiceAnimationType` now is `data` class instead of common class
* `TelegramBotAPI-extensions-api`: * `TelegramBotAPI-extensions-api`:
* Long Polling extensions now are deprecated in this project. It was replaced into `TelegramBotAPI-extensions-utils` * Long Polling extensions now are deprecated in this project. It was replaced into `TelegramBotAPI-extensions-utils`
* Several `telegramBot` functions was renamed into `telegramBotWithCustomClientConfig` * Several `telegramBot` functions was renamed into `telegramBotWithCustomClientConfig`

View File

@ -15,9 +15,15 @@ object DartsDiceAnimationType : DiceAnimationType() {
override val emoji: String = "\uD83C\uDFAF" override val emoji: String = "\uD83C\uDFAF"
} }
@Serializable(DiceAnimationTypeSerializer::class) @Serializable(DiceAnimationTypeSerializer::class)
class UnknownDiceAnimationType( object BasketballDiceAnimationType : DiceAnimationType() {
override val emoji: String = "\uD83C\uDFC0"
}
@Serializable(DiceAnimationTypeSerializer::class)
data class CustomDiceAnimationType(
override val emoji: String override val emoji: String
) : DiceAnimationType() ) : DiceAnimationType()
@Deprecated("Renamed", ReplaceWith("CustomDiceAnimationType"))
typealias UnknownDiceAnimationType = CustomDiceAnimationType
@Serializer(DiceAnimationType::class) @Serializer(DiceAnimationType::class)
internal object DiceAnimationTypeSerializer : KSerializer<DiceAnimationType> { internal object DiceAnimationTypeSerializer : KSerializer<DiceAnimationType> {
@ -26,7 +32,8 @@ internal object DiceAnimationTypeSerializer : KSerializer<DiceAnimationType> {
return when (val type = decoder.decodeString()) { return when (val type = decoder.decodeString()) {
CubeDiceAnimationType.emoji -> CubeDiceAnimationType CubeDiceAnimationType.emoji -> CubeDiceAnimationType
DartsDiceAnimationType.emoji -> DartsDiceAnimationType DartsDiceAnimationType.emoji -> DartsDiceAnimationType
else -> UnknownDiceAnimationType(type) BasketballDiceAnimationType.emoji -> BasketballDiceAnimationType
else -> CustomDiceAnimationType(type)
} }
} }