From 0ec18cbf0642751e63fc7813a1b735219d6a0474 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 16 May 2020 20:46:49 +0600 Subject: [PATCH] dice changes --- CHANGELOG.md | 3 +++ .../TelegramBotAPI/types/dice/DiceAnimationType.kt | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 898141fe75..e4b61a23ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,9 @@ * `SetWebhook` factories signatures was changed (backward compatibility was not broken) * `executeUnsafe` now working differently * 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`: * Long Polling extensions now are deprecated in this project. It was replaced into `TelegramBotAPI-extensions-utils` * Several `telegramBot` functions was renamed into `telegramBotWithCustomClientConfig` diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt index 28b4836d15..0c51776d74 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt +++ b/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt @@ -15,9 +15,15 @@ object DartsDiceAnimationType : DiceAnimationType() { override val emoji: String = "\uD83C\uDFAF" } @Serializable(DiceAnimationTypeSerializer::class) -class UnknownDiceAnimationType( +object BasketballDiceAnimationType : DiceAnimationType() { + override val emoji: String = "\uD83C\uDFC0" +} +@Serializable(DiceAnimationTypeSerializer::class) +data class CustomDiceAnimationType( override val emoji: String ) : DiceAnimationType() +@Deprecated("Renamed", ReplaceWith("CustomDiceAnimationType")) +typealias UnknownDiceAnimationType = CustomDiceAnimationType @Serializer(DiceAnimationType::class) internal object DiceAnimationTypeSerializer : KSerializer { @@ -26,7 +32,8 @@ internal object DiceAnimationTypeSerializer : KSerializer { return when (val type = decoder.decodeString()) { CubeDiceAnimationType.emoji -> CubeDiceAnimationType DartsDiceAnimationType.emoji -> DartsDiceAnimationType - else -> UnknownDiceAnimationType(type) + BasketballDiceAnimationType.emoji -> BasketballDiceAnimationType + else -> CustomDiceAnimationType(type) } }