2020-10-04 11:06:30 +00:00
|
|
|
package dev.inmo.tgbotapi.types
|
2019-02-05 04:51:52 +00:00
|
|
|
|
2023-05-27 12:19:14 +00:00
|
|
|
import korlibs.time.DateTime
|
2019-02-05 04:51:52 +00:00
|
|
|
|
|
|
|
sealed class RequestError
|
|
|
|
|
|
|
|
data class RetryAfterError(
|
2020-11-11 04:23:20 +00:00
|
|
|
val seconds: Seconds,
|
2019-02-05 04:51:52 +00:00
|
|
|
val startCountingMillis: Long
|
|
|
|
) : RequestError() {
|
2019-12-03 05:07:25 +00:00
|
|
|
val canContinue = (seconds * 1000L) + startCountingMillis
|
2019-02-05 04:55:46 +00:00
|
|
|
val leftToRetry: Long
|
2019-12-03 05:07:25 +00:00
|
|
|
get() = canContinue - DateTime.nowUnixLong()
|
2019-02-05 04:51:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
data class MigrateChatId(
|
2022-11-10 09:56:38 +00:00
|
|
|
val newChatId: IdChatIdentifier
|
2019-02-05 04:51:52 +00:00
|
|
|
) : RequestError()
|
|
|
|
|
|
|
|
|