mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
logout and close
This commit is contained in:
parent
dd4d5cd15d
commit
6d6c544aaf
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## 0.30.0 Bot API 5.0
|
## 0.30.0 Bot API 5.0
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Support of `logOut` method (`LogOut` object as a `Request`)
|
||||||
|
* Support of `close` method (`Close` object as a `Request`)
|
||||||
|
|
||||||
## 0.29.4
|
## 0.29.4
|
||||||
|
|
||||||
* `Core`:
|
* `Core`:
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.local
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import kotlinx.serialization.DeserializationStrategy
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.SerializationStrategy
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this method to close the bot instance before moving it from one local server to another. You need to delete the
|
||||||
|
* webhook before calling this method to ensure that the bot isn't launched again after server restart. The method will
|
||||||
|
* return error 429 in the first 10 minutes after the bot is launched.
|
||||||
|
*
|
||||||
|
* @see io.ktor.client.features.ClientRequestException
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
object Close : SimpleRequest<Boolean> {
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = LogOut.serializer()
|
||||||
|
|
||||||
|
override fun method(): String = "close"
|
||||||
|
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
get() = Boolean.serializer()
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.local
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this method to log out from the cloud Bot API server before launching the bot locally. You **must** log out the bot
|
||||||
|
* before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful
|
||||||
|
* call, you will not be able to log in again using the same token for 10 minutes
|
||||||
|
*/
|
||||||
|
@Serializable
|
||||||
|
object LogOut : SimpleRequest<Boolean> {
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
|
||||||
|
override fun method(): String = "logOut"
|
||||||
|
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
get() = Boolean.serializer()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user