mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 12:00:18 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8293d6683c | |||
| 7e6e892c45 | |||
| 43ac09a79b | |||
| ee1f115d77 | |||
| 7d85b6fb88 | |||
| 013944c5c9 | |||
| 55ed3e165b | |||
| 9c0106d229 | |||
| 9cd2a6220c | |||
| 033ec8f2da |
64
CHANGELOG.md
64
CHANGELOG.md
@@ -1,5 +1,43 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 0.26.0
|
||||
|
||||
* `Common`:
|
||||
* Versions updates:
|
||||
* `Klock`: `1.10.0` -> `1.10.3`
|
||||
* `TelegramBotAPI`:
|
||||
* Request `SendDice` was added (calling [sendDice](https://core.telegram.org/bots/api#senddice))
|
||||
* Class `Dice` was added (type [dice](https://core.telegram.org/bots/api#dice))
|
||||
* Class `DiceContent` was added (for including it in [message](https://core.telegram.org/bots/api#message) object)
|
||||
* `BotCommand` was added
|
||||
* `GetMyCommands` request was added
|
||||
* `SetMyCommands` request was added
|
||||
* `GetMe` now is object instead of class
|
||||
* `GetMe` was replaced into package `com.github.insanusmokrassar.TelegramBotAPI.requests.bot.GetMe`
|
||||
* `CreateNewStickerSet` renamed to `CreateStaticNewStickerSet`
|
||||
* `CreateNewAnimatedStickerSet` request was added (it handle work with `tgs_sticker`)
|
||||
* `StickerSet#thumb` was added
|
||||
* `AddStickerToSet` renamed to `AddStaticStickerToSet`
|
||||
* `AddAnimatedStickerToSet` request was added
|
||||
* `SetStickerSetThumb` request was added
|
||||
* Most of sticker actions now implements `StandardStickerSetAction` instead of `StickerSetAction`
|
||||
* `getUpdatesLimit` was added to be ensure in get updates limit
|
||||
* `GetUpdates` now will check count of requesting updates and throw exception if it is not in range `1 .. 100`
|
||||
* `GetUpdates#limit` now is not nullable and by default set up to 100
|
||||
* `TelegramBotAPI-extensions-api`:
|
||||
* Extensions `sendDice` was added
|
||||
* Extension `getMyCommands` request was added
|
||||
* Extension `setMyCommands` request was added
|
||||
* Extension `getMe` was replaced into package `com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.GetMeKt.getMe`
|
||||
* **All extensions `createNewStickerSet` was renamed to `createNewStaticStickerSet`**
|
||||
* Extensions `createNewAnimatedStickerSet` was added
|
||||
* **All extensions `addStickerToSet` was renamed to `addStaticStickerToSet`**
|
||||
* Extensions `addAnimatedStickerToSet` was added
|
||||
* Extensions `setStickerSetThumb` was added
|
||||
* Extension `startGettingUpdates` now will drop `SentMediaGroupUpdate` in case if it is the last in updates group
|
||||
and size of retrieved updates is equal to 100 (max count of retrieved updates)
|
||||
* Extensions `getUpdates` now will receive only not nullable `limit` parameter
|
||||
|
||||
## 0.25.0
|
||||
|
||||
* Common:
|
||||
@@ -25,32 +63,6 @@
|
||||
* `FlowsUpdatesFilter` now have two additional flows: `pollAnswerFlow`, `unknownUpdateTypeFlow`
|
||||
* `ExtendedUser` (`typealias`) was added as a `PreviewFeature`
|
||||
|
||||
### 0.25.2
|
||||
|
||||
* `TelegramBotAPI`:
|
||||
* Request `SendDice` was added (calling [sendDice](https://core.telegram.org/bots/api#senddice))
|
||||
* Class `Dice` was added (type [dice](https://core.telegram.org/bots/api#dice))
|
||||
* Class `DiceContent` was added (for including it in [message](https://core.telegram.org/bots/api#message) object)
|
||||
* `BotCommand` was added
|
||||
* `GetMyCommands` request was added
|
||||
* `SetMyCommands` request was added
|
||||
* `GetMe` now is object instead of class
|
||||
* `GetMe` was replaced into package `com.github.insanusmokrassar.TelegramBotAPI.requests.bot.GetMe`
|
||||
* `CreateNewStickerSet` renamed to `CreateStaticNewStickerSet`
|
||||
* `CreateNewAnimatedStickerSet` request was added (it handle work with `tgs_sticker`)
|
||||
* `StickerSet#thumb` was added
|
||||
* `AddStickerToSet` renamed to `AddStaticStickerToSet`
|
||||
* `AddAnimatedStickerToSet` request was added
|
||||
* `TelegramBotAPI-extensions-api`:
|
||||
* Extensions `sendDice` was added
|
||||
* Extension `getMyCommands` request was added
|
||||
* Extension `setMyCommands` request was added
|
||||
* Extension `getMe` was replaced into package `com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.GetMeKt.getMe`
|
||||
* **All extensions `createNewStickerSet` was renamed to `createNewStaticStickerSet`**
|
||||
* Extensions `createNewAnimatedStickerSet` was added
|
||||
* **All extensions `addStickerToSet` was renamed to `addStaticStickerToSet`**
|
||||
* Extensions `addAnimatedStickerToSet` was added
|
||||
|
||||
### 0.25.1
|
||||
|
||||
* Update kotlin: `1.3.70` -> `1.3.71`
|
||||
|
||||
@@ -56,20 +56,46 @@ compile "com.github.insanusmokrassar:TelegramBotAPI-extensions-api:$telegrambota
|
||||
|
||||
## Example of usage and comparison with `TelegramBotAPI`
|
||||
|
||||
As said in [TelegramBotAPI](../TelegramBotAPI/README.md#Requests), it is possible to use next syntax for requests:
|
||||
Here presented review table for comparison of api from original [TelegramBotAPI](../TelegramBotAPI/README.md#Requests)
|
||||
and extensions-api library:
|
||||
|
||||
```kotlin
|
||||
val requestsExecutor: RequestsExecutor = ...
|
||||
requestsExecutor.execute(GetMe())
|
||||
```
|
||||
|
||||
This library offer a little bit another way for this:
|
||||
In all examples supposed that you have created bot with next approximate lines:
|
||||
|
||||
```kotlin
|
||||
val bot: RequestsExecutor = ...
|
||||
bot.getMe()
|
||||
```
|
||||
|
||||
The result type of [GetMe (and getMe extension)](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt)
|
||||
request is
|
||||
[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt).
|
||||
| TelegramBotAPI | TelegramBotAPI-extensions-api |
|
||||
|----------------|-------------------------------|
|
||||
| bot.execute(GetMe) | bot.getMe() |
|
||||
| bot.execute(SendTextMessage(someChatId, text)) | bot.sendTextMessage(chat, text) |
|
||||
|
||||
## Updates
|
||||
|
||||
Usually, it is more comfortable to use filter object to get separated types of updates:
|
||||
|
||||
```kotlin
|
||||
val filter = FlowsUpdatesFilter(100)
|
||||
```
|
||||
|
||||
In this case you will be able:
|
||||
|
||||
* Separate types of incoming updates (even media groups)
|
||||
* Simplify launch of getting updates:
|
||||
```kotlin
|
||||
bot.startGettingOfUpdates(
|
||||
filter,
|
||||
scope = CoroutineScope(Dispatchers.Default)
|
||||
)
|
||||
```
|
||||
* Use `filter` flows to comfortable filter, map and do other operations with the whole
|
||||
getting updates process:
|
||||
```kotlin
|
||||
filter.messageFlow.mapNotNull {
|
||||
it.data as? ContentMessage<*>
|
||||
}.onEach {
|
||||
println(it)
|
||||
}.launchIn(
|
||||
CoroutineScope(Dispatchers.Default)
|
||||
)
|
||||
```
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
||||
|
||||
suspend fun RequestsExecutor.getUpdates(
|
||||
offset: UpdateIdentifier? = null,
|
||||
limit: Int? = null,
|
||||
limit: Int = getUpdatesLimit.last,
|
||||
timeout: Seconds? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
) = execute(
|
||||
@@ -18,7 +18,7 @@ suspend fun RequestsExecutor.getUpdates(
|
||||
|
||||
suspend fun RequestsExecutor.getUpdates(
|
||||
lastUpdate: Update,
|
||||
limit: Int? = null,
|
||||
limit: Int = getUpdatesLimit.last,
|
||||
timeout: Seconds? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
) = getUpdates(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.bot.GetMyCommands
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.bot.SetMyCommands
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.BotCommand
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.thumbs
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.SetStickerSetThumb
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
|
||||
|
||||
suspend fun RequestsExecutor.setStickerSetThumb(
|
||||
userId: UserId,
|
||||
thumbSetName: String,
|
||||
thumb: FileId
|
||||
) = execute(
|
||||
SetStickerSetThumb(userId, thumbSetName, thumb)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setStickerSetThumb(
|
||||
userId: UserId,
|
||||
thumbSetName: String,
|
||||
thumb: MultipartFile
|
||||
) = execute(
|
||||
SetStickerSetThumb(userId, thumbSetName, thumb)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setStickerSetThumb(
|
||||
user: CommonUser,
|
||||
thumbSetName: String,
|
||||
thumb: FileId
|
||||
) = setStickerSetThumb(
|
||||
user.id, thumbSetName, thumb
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setStickerSetThumb(
|
||||
user: CommonUser,
|
||||
thumbSetName: String,
|
||||
thumb: MultipartFile
|
||||
) = setStickerSetThumb(
|
||||
user.id, thumbSetName, thumb
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setStickerSetThumb(
|
||||
userId: UserId,
|
||||
thumbSet: StickerSet,
|
||||
thumb: FileId
|
||||
) = setStickerSetThumb(
|
||||
userId, thumbSet.name, thumb
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setStickerSetThumb(
|
||||
userId: UserId,
|
||||
thumbSet: StickerSet,
|
||||
thumb: MultipartFile
|
||||
) = setStickerSetThumb(
|
||||
userId, thumbSet.name, thumb
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setStickerSetThumb(
|
||||
user: CommonUser,
|
||||
thumbSet: StickerSet,
|
||||
thumb: FileId
|
||||
) = setStickerSetThumb(
|
||||
user.id, thumbSet.name, thumb
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setStickerSetThumb(
|
||||
user: CommonUser,
|
||||
thumbSet: StickerSet,
|
||||
thumb: MultipartFile
|
||||
) = setStickerSetThumb(
|
||||
user.id, thumbSet.name, thumb
|
||||
)
|
||||
|
||||
@@ -5,8 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions.RequestExceptio
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.InternalUtils.convertWithMediaGroupUpdates
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.InternalUtils.lastUpdateIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.getUpdates
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.Seconds
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
||||
@@ -30,7 +29,20 @@ fun RequestsExecutor.startGettingOfUpdates(
|
||||
offset = lastUpdateIdentifier?.plus(1),
|
||||
timeout = timeoutSeconds,
|
||||
allowed_updates = allowedUpdates
|
||||
).convertWithMediaGroupUpdates()
|
||||
).let { originalUpdates ->
|
||||
val converted = originalUpdates.convertWithMediaGroupUpdates()
|
||||
/**
|
||||
* Dirty hack for cases when the media group was retrieved not fully:
|
||||
*
|
||||
* We are throw out the last media group and will reretrieve it again in the next get updates
|
||||
* and it will guarantee that it is full
|
||||
*/
|
||||
if (originalUpdates.size == getUpdatesLimit.last && converted.last() is SentMediaGroupUpdate) {
|
||||
converted - converted.last()
|
||||
} else {
|
||||
converted
|
||||
}
|
||||
}
|
||||
|
||||
supervisorScope {
|
||||
for (update in updates) {
|
||||
|
||||
@@ -12,11 +12,10 @@ moments are describing by official [Telegram Bot API](https://core.telegram.org/
|
||||
|
||||
## Compatibility
|
||||
|
||||
This version compatible with [23th of January 2020 update of TelegramBotAPI (version 4.6)](https://core.telegram.org/bots/api#january-23-2020).
|
||||
There is Telegram Passport API exception of implemented functionality, which was presented in
|
||||
This version compatible with [30th of March 2020 update of TelegramBotAPI (version 4.7)](https://core.telegram.org/bots/api#march-30-2020).
|
||||
There is only one exception of implemented functionality - Telegram Passport API, which was presented in
|
||||
[August 2018 update of TelegramBotAPI](https://core.telegram.org/bots/api-changelog#august-27-2018) update. It will be implemented
|
||||
as soon as possible. All APIs that are not included are presented
|
||||
[wiki](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Not-included-API).
|
||||
as soon as possible.
|
||||
|
||||
## How to implement library?
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ private val updatesListSerializer = ListSerializer(
|
||||
@Serializable
|
||||
data class GetUpdates(
|
||||
val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
|
||||
val limit: Int? = null,
|
||||
val limit: Int = getUpdatesLimit.last,
|
||||
val timeout: Seconds? = null,
|
||||
val allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
): SimpleRequest<List<Update>> {
|
||||
@@ -25,4 +25,10 @@ data class GetUpdates(
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
init {
|
||||
if (limit !in getUpdatesLimit) {
|
||||
error("GetUpdates request can be called only with limit in range $getUpdatesLimit (actual value is $limit)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.bot
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.ListSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
|
||||
@@ -2,10 +2,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun AddAnimatedStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
@@ -35,7 +36,7 @@ data class AddAnimatedStickerToSet internal constructor(
|
||||
val sticker: FileId? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : StickerSetAction {
|
||||
) : StandardStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
|
||||
@@ -2,10 +2,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun AddStaticStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
@@ -53,7 +54,7 @@ data class AddStaticStickerToSet internal constructor(
|
||||
val sticker: FileId? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : StickerSetAction {
|
||||
) : StandardStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
@@ -39,7 +39,7 @@ data class CreateNewAnimatedStickerSet internal constructor(
|
||||
val containsMasks: Boolean? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : StickerSetAction {
|
||||
) : StandardStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StandardStickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.*
|
||||
@@ -54,7 +54,7 @@ data class CreateNewStaticStickerSet internal constructor(
|
||||
val containsMasks: Boolean? = null,
|
||||
@SerialName(maskPositionField)
|
||||
override val maskPosition: MaskPosition? = null
|
||||
) : StickerSetAction {
|
||||
) : StandardStickerSetAction {
|
||||
init {
|
||||
if(emojis.isEmpty()) {
|
||||
throw IllegalArgumentException("Emojis must not be empty")
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun SetStickerSetThumb(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
thumb: MultipartFile
|
||||
): Request<Boolean> {
|
||||
return CommonMultipartFileRequest(
|
||||
SetStickerSetThumb(userId, stickerSetName),
|
||||
mapOf(thumbField to thumb)
|
||||
)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class SetStickerSetThumb (
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: StickerSetName,
|
||||
@SerialName(thumbField)
|
||||
val thumb: FileId? = null
|
||||
) : StickerSetAction {
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
override fun method(): String = "setStickerSetThumb"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
|
||||
interface StandardStickerSetAction : StickerSetAction {
|
||||
val emojis: String // must be more than one
|
||||
val maskPosition: MaskPosition?
|
||||
}
|
||||
@@ -2,15 +2,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
interface StickerSetAction : SimpleRequest<Boolean> {
|
||||
val userId: UserId
|
||||
val name: String
|
||||
val emojis: String // must be more than one
|
||||
val maskPosition: MaskPosition?
|
||||
|
||||
override val resultDeserializer: KSerializer<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
|
||||
@@ -23,6 +23,7 @@ typealias DiceResult = Int
|
||||
|
||||
typealias Seconds = Int
|
||||
|
||||
val getUpdatesLimit = 1 .. 100
|
||||
val callbackQueryAnswerLength = 0 until 200
|
||||
val captionLength = 0 until 1024
|
||||
val textLength = 0 until 4096
|
||||
|
||||
@@ -19,7 +19,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.Success
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.Invoice
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.SuccessfulPayment
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
// TODO:: add PassportData type
|
||||
|
||||
@@ -2,11 +2,11 @@ kotlin.code.style=official
|
||||
kotlin_version=1.3.71
|
||||
kotlin_coroutines_version=1.3.5
|
||||
kotlin_serialisation_runtime_version=0.20.0
|
||||
klock_version=1.10.0
|
||||
klock_version=1.10.3
|
||||
uuid_version=0.1.0
|
||||
ktor_version=1.3.2
|
||||
|
||||
library_group=com.github.insanusmokrassar
|
||||
library_version=0.25.2
|
||||
library_version=0.26.0
|
||||
|
||||
gradle_bintray_plugin_version=1.8.4
|
||||
|
||||
Reference in New Issue
Block a user