mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-16 05:40:32 +00:00
DiceAnimationType#valueLimits
This commit is contained in:
@@ -52,10 +52,14 @@ val inlineQueryAnswerResultsLimit = 0 .. 50
|
||||
|
||||
val customTitleLength = 0 .. 16
|
||||
|
||||
val commonDiceResultLimit = 1 .. 6
|
||||
@Deprecated("Renamed", ReplaceWith("commonDiceResultLimit", "dev.inmo.tgbotapi.types.commonDiceResultLimit"))
|
||||
val dartsAndCubeDiceResultLimit = 1 .. 6
|
||||
@Deprecated("Renamed", ReplaceWith("dartsAndCubeDiceResultLimit", "dev.inmo.tgbotapi.types.dartsAndCubeDiceResultLimit"))
|
||||
val commonDiceResultLimit
|
||||
get() = dartsAndCubeDiceResultLimit
|
||||
@Deprecated("Renamed", ReplaceWith("dartsAndCubeDiceResultLimit", "dev.inmo.tgbotapi.types.dartsAndCubeDiceResultLimit"))
|
||||
val diceResultLimit
|
||||
get() = commonDiceResultLimit
|
||||
get() = dartsAndCubeDiceResultLimit
|
||||
val basketballAndFootballDiceResultLimit = 1 .. 5
|
||||
val slotMachineDiceResultLimit = 1 .. 64
|
||||
|
||||
val botCommandLengthLimit = 1 .. 32
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package dev.inmo.tgbotapi.types.dice
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
@@ -8,31 +9,45 @@ import kotlinx.serialization.encoding.Encoder
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
sealed class DiceAnimationType {
|
||||
abstract val emoji: String
|
||||
abstract val valueLimits: IntRange
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object CubeDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "\uD83C\uDFB2"
|
||||
override val valueLimits: IntRange
|
||||
get() = dartsAndCubeDiceResultLimit
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object DartsDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "\uD83C\uDFAF"
|
||||
override val valueLimits: IntRange
|
||||
get() = dartsAndCubeDiceResultLimit
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object BasketballDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "\uD83C\uDFC0"
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object SlotMachineDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "\uD83C\uDFB0"
|
||||
override val valueLimits: IntRange
|
||||
get() = basketballAndFootballDiceResultLimit
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object FootballDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "⚽"
|
||||
override val valueLimits: IntRange
|
||||
get() = basketballAndFootballDiceResultLimit
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
object SlotMachineDiceAnimationType : DiceAnimationType() {
|
||||
override val emoji: String = "\uD83C\uDFB0"
|
||||
override val valueLimits: IntRange
|
||||
get() = slotMachineDiceResultLimit
|
||||
}
|
||||
@Serializable(DiceAnimationTypeSerializer::class)
|
||||
data class CustomDiceAnimationType(
|
||||
override val emoji: String
|
||||
) : DiceAnimationType()
|
||||
) : DiceAnimationType() {
|
||||
override val valueLimits: IntRange
|
||||
get() = error("Custom dice animation type have unknown value limits")
|
||||
}
|
||||
|
||||
@Serializer(DiceAnimationType::class)
|
||||
internal object DiceAnimationTypeSerializer : KSerializer<DiceAnimationType> {
|
||||
|
Reference in New Issue
Block a user