mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
commit
c22c1bb144
38
CHANGELOG.md
38
CHANGELOG.md
@ -1,5 +1,43 @@
|
|||||||
# TelegramBotAPI changelog
|
# 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
|
## 0.25.0
|
||||||
|
|
||||||
* Common:
|
* Common:
|
||||||
|
@ -56,20 +56,46 @@ compile "com.github.insanusmokrassar:TelegramBotAPI-extensions-api:$telegrambota
|
|||||||
|
|
||||||
## Example of usage and comparison with `TelegramBotAPI`
|
## 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
|
In all examples supposed that you have created bot with next approximate lines:
|
||||||
val requestsExecutor: RequestsExecutor = ...
|
|
||||||
requestsExecutor.execute(GetMe())
|
|
||||||
```
|
|
||||||
|
|
||||||
This library offer a little bit another way for this:
|
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
val bot: RequestsExecutor = ...
|
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)
|
| TelegramBotAPI | TelegramBotAPI-extensions-api |
|
||||||
request is
|
|----------------|-------------------------------|
|
||||||
[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt).
|
| 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)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api
|
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.GetMe
|
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.getMe
|
||||||
|
|
||||||
suspend fun RequestsExecutor.getMe() = execute(GetMe())
|
@Deprecated(
|
||||||
|
"Replaced",
|
||||||
|
ReplaceWith("getMe", "com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.GetMeKt.getMe")
|
||||||
|
)
|
||||||
|
suspend fun RequestsExecutor.getMe() = getMe()
|
@ -7,7 +7,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
|||||||
|
|
||||||
suspend fun RequestsExecutor.getUpdates(
|
suspend fun RequestsExecutor.getUpdates(
|
||||||
offset: UpdateIdentifier? = null,
|
offset: UpdateIdentifier? = null,
|
||||||
limit: Int? = null,
|
limit: Int = getUpdatesLimit.last,
|
||||||
timeout: Seconds? = null,
|
timeout: Seconds? = null,
|
||||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||||
) = execute(
|
) = execute(
|
||||||
@ -18,7 +18,7 @@ suspend fun RequestsExecutor.getUpdates(
|
|||||||
|
|
||||||
suspend fun RequestsExecutor.getUpdates(
|
suspend fun RequestsExecutor.getUpdates(
|
||||||
lastUpdate: Update,
|
lastUpdate: Update,
|
||||||
limit: Int? = null,
|
limit: Int = getUpdatesLimit.last,
|
||||||
timeout: Seconds? = null,
|
timeout: Seconds? = null,
|
||||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||||
) = getUpdates(
|
) = getUpdates(
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.bot.GetMe
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getMe() = execute(GetMe)
|
@ -0,0 +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
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.getMyCommands() = execute(GetMyCommands)
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.bot.SetMyCommands
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.BotCommand
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.setMyCommands(
|
||||||
|
commands: List<BotCommand>
|
||||||
|
) = execute(SetMyCommands(commands))
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendDice
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendDice(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
SendDice(chatId, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.sendDice(
|
||||||
|
chat: Chat,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = sendDice(chat.id, disableNotification, replyToMessageId, replyMarkup)
|
@ -0,0 +1,90 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
|
||||||
|
|
||||||
|
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.AddAnimatedStickerToSet
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addAnimatedStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
AddAnimatedStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addAnimatedStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
AddAnimatedStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addAnimatedStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addAnimatedStickerToSet(
|
||||||
|
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addAnimatedStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addAnimatedStickerToSet(
|
||||||
|
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addAnimatedStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addAnimatedStickerToSet(
|
||||||
|
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addAnimatedStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addAnimatedStickerToSet(
|
||||||
|
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addAnimatedStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addAnimatedStickerToSet(
|
||||||
|
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.addAnimatedStickerToSet(
|
||||||
|
user: CommonUser,
|
||||||
|
stickerSet: StickerSet,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = addAnimatedStickerToSet(
|
||||||
|
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||||
|
)
|
@ -3,88 +3,88 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.AddStickerToSet
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.AddStaticStickerToSet
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
|
||||||
|
|
||||||
suspend fun RequestsExecutor.addStickerToSet(
|
suspend fun RequestsExecutor.addStaticStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSetName: String,
|
stickerSetName: String,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
AddStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
AddStaticStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.addStickerToSet(
|
suspend fun RequestsExecutor.addStaticStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSetName: String,
|
stickerSetName: String,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
AddStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
AddStaticStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.addStickerToSet(
|
suspend fun RequestsExecutor.addStaticStickerToSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSetName: String,
|
stickerSetName: String,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = addStickerToSet(
|
) = addStaticStickerToSet(
|
||||||
user.id, stickerSetName, sticker, emojis, maskPosition
|
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.addStickerToSet(
|
suspend fun RequestsExecutor.addStaticStickerToSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSetName: String,
|
stickerSetName: String,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = addStickerToSet(
|
) = addStaticStickerToSet(
|
||||||
user.id, stickerSetName, sticker, emojis, maskPosition
|
user.id, stickerSetName, sticker, emojis, maskPosition
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.addStickerToSet(
|
suspend fun RequestsExecutor.addStaticStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = addStickerToSet(
|
) = addStaticStickerToSet(
|
||||||
userId, stickerSet.name, sticker, emojis, maskPosition
|
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.addStickerToSet(
|
suspend fun RequestsExecutor.addStaticStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = addStickerToSet(
|
) = addStaticStickerToSet(
|
||||||
userId, stickerSet.name, sticker, emojis, maskPosition
|
userId, stickerSet.name, sticker, emojis, maskPosition
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.addStickerToSet(
|
suspend fun RequestsExecutor.addStaticStickerToSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = addStickerToSet(
|
) = addStaticStickerToSet(
|
||||||
user.id, stickerSet.name, sticker, emojis, maskPosition
|
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.addStickerToSet(
|
suspend fun RequestsExecutor.addStaticStickerToSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
stickerSet: StickerSet,
|
stickerSet: StickerSet,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = addStickerToSet(
|
) = addStaticStickerToSet(
|
||||||
user.id, stickerSet.name, sticker, emojis, maskPosition
|
user.id, stickerSet.name, sticker, emojis, maskPosition
|
||||||
)
|
)
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
|
||||||
|
|
||||||
|
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.CreateNewAnimatedStickerSet
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.createNewAnimatedStickerSet(
|
||||||
|
userId: UserId,
|
||||||
|
name: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
CreateNewAnimatedStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.createNewAnimatedStickerSet(
|
||||||
|
userId: UserId,
|
||||||
|
name: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = execute(
|
||||||
|
CreateNewAnimatedStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.createNewAnimatedStickerSet(
|
||||||
|
user: CommonUser,
|
||||||
|
name: String,
|
||||||
|
sticker: FileId,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = createNewAnimatedStickerSet(
|
||||||
|
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun RequestsExecutor.createNewAnimatedStickerSet(
|
||||||
|
user: CommonUser,
|
||||||
|
name: String,
|
||||||
|
sticker: MultipartFile,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = createNewAnimatedStickerSet(
|
||||||
|
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||||
|
)
|
@ -3,12 +3,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.CreateNewStickerSet
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.CreateNewStaticStickerSet
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
|
|
||||||
suspend fun RequestsExecutor.createNewStickerSet(
|
suspend fun RequestsExecutor.createNewStaticStickerSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
name: String,
|
name: String,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
@ -16,10 +16,10 @@ suspend fun RequestsExecutor.createNewStickerSet(
|
|||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CreateNewStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
CreateNewStaticStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.createNewStickerSet(
|
suspend fun RequestsExecutor.createNewStaticStickerSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
name: String,
|
name: String,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
@ -27,28 +27,28 @@ suspend fun RequestsExecutor.createNewStickerSet(
|
|||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CreateNewStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
CreateNewStaticStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
suspend fun RequestsExecutor.createNewStickerSet(
|
suspend fun RequestsExecutor.createNewStaticStickerSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
name: String,
|
name: String,
|
||||||
sticker: FileId,
|
sticker: FileId,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = createNewStickerSet(
|
) = createNewStaticStickerSet(
|
||||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun RequestsExecutor.createNewStickerSet(
|
suspend fun RequestsExecutor.createNewStaticStickerSet(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
name: String,
|
name: String,
|
||||||
sticker: MultipartFile,
|
sticker: MultipartFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
) = createNewStickerSet(
|
) = createNewStaticStickerSet(
|
||||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||||
)
|
)
|
@ -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.convertWithMediaGroupUpdates
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.InternalUtils.lastUpdateIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.InternalUtils.lastUpdateIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.getUpdates
|
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.getUpdates
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.Seconds
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
||||||
@ -30,7 +29,20 @@ fun RequestsExecutor.startGettingOfUpdates(
|
|||||||
offset = lastUpdateIdentifier?.plus(1),
|
offset = lastUpdateIdentifier?.plus(1),
|
||||||
timeout = timeoutSeconds,
|
timeout = timeoutSeconds,
|
||||||
allowed_updates = allowedUpdates
|
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 {
|
supervisorScope {
|
||||||
for (update in updates) {
|
for (update in updates) {
|
||||||
|
@ -12,11 +12,10 @@ moments are describing by official [Telegram Bot API](https://core.telegram.org/
|
|||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
This version compatible with [23th of January 2020 update of TelegramBotAPI (version 4.6)](https://core.telegram.org/bots/api#january-23-2020).
|
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 Telegram Passport API exception of implemented functionality, which was presented in
|
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
|
[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
|
as soon as possible.
|
||||||
[wiki](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Not-included-API).
|
|
||||||
|
|
||||||
## How to implement library?
|
## How to implement library?
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.bot.GetMe
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ExtendedBot
|
|
||||||
import kotlinx.serialization.*
|
|
||||||
|
|
||||||
@Serializable
|
@Deprecated(
|
||||||
class GetMe : SimpleRequest<ExtendedBot> {
|
"Replaced",
|
||||||
override fun method(): String = "getMe"
|
ReplaceWith(
|
||||||
override val resultDeserializer: DeserializationStrategy<ExtendedBot>
|
"GetMe", "com.github.insanusmokrassar.TelegramBotAPI.requests.bot.GetMe"
|
||||||
get() = ExtendedBot.serializer()
|
)
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
)
|
||||||
get() = serializer()
|
typealias GetMe = GetMe
|
||||||
}
|
|
||||||
|
@ -14,7 +14,7 @@ private val updatesListSerializer = ListSerializer(
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class GetUpdates(
|
data class GetUpdates(
|
||||||
val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
|
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 timeout: Seconds? = null,
|
||||||
val allowed_updates: List<String>? = ALL_UPDATES_LIST
|
val allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||||
): SimpleRequest<List<Update>> {
|
): SimpleRequest<List<Update>> {
|
||||||
@ -25,4 +25,10 @@ data class GetUpdates(
|
|||||||
|
|
||||||
override val requestSerializer: SerializationStrategy<*>
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
get() = serializer()
|
get() = serializer()
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (limit !in getUpdatesLimit) {
|
||||||
|
error("GetUpdates request can be called only with limit in range $getUpdatesLimit (actual value is $limit)")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.bot
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ExtendedBot
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
object GetMe : SimpleRequest<ExtendedBot> {
|
||||||
|
override fun method(): String = "getMe"
|
||||||
|
override val resultDeserializer: DeserializationStrategy<ExtendedBot>
|
||||||
|
get() = ExtendedBot.serializer()
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.bot
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.BotCommand
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.ListSerializer
|
||||||
|
|
||||||
|
private val getMyCommandsSerializer = ListSerializer(BotCommand.serializer())
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
object GetMyCommands : SimpleRequest<List<BotCommand>> {
|
||||||
|
override fun method(): String = "getMyCommands"
|
||||||
|
override val resultDeserializer: DeserializationStrategy<List<BotCommand>>
|
||||||
|
get() = getMyCommandsSerializer
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
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.serializer
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class SetMyCommands(
|
||||||
|
@SerialName(botCommandsField)
|
||||||
|
val commands: List<BotCommand>
|
||||||
|
) : SimpleRequest<Boolean> {
|
||||||
|
override fun method(): String = "setMyCommands"
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
get() = Boolean.serializer()
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (commands.size !in botCommandsLimit) {
|
||||||
|
error("Bot commands list size able to be in range $botCommandsLimit, but incoming size is ${commands.size}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.requests.send
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.DisableNotification
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMessageId
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.DiceContent
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
internal val DiceContentMessageResultDeserializer: DeserializationStrategy<ContentMessage<DiceContent>>
|
||||||
|
= TelegramBotAPIMessageDeserializationStrategyClass()
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class SendDice(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(disableNotificationField)
|
||||||
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(replyToMessageIdField)
|
||||||
|
override val replyToMessageId: MessageIdentifier? = null,
|
||||||
|
@SerialName(replyMarkupField)
|
||||||
|
override val replyMarkup: KeyboardMarkup? = null
|
||||||
|
) : ReplyingMarkupSendMessageRequest<ContentMessage<DiceContent>>, ReplyMessageId, DisableNotification {
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
|
||||||
|
override fun method(): String = "sendDice"
|
||||||
|
|
||||||
|
override val resultDeserializer: DeserializationStrategy<ContentMessage<DiceContent>>
|
||||||
|
get() = DiceContentMessageResultDeserializer
|
||||||
|
}
|
@ -2,19 +2,19 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
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.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
fun AddStickerToSet(
|
fun AddAnimatedStickerToSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
stickerSetName: String,
|
stickerSetName: String,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
emojis: String,
|
emojis: String,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
): Request<Boolean> {
|
): Request<Boolean> {
|
||||||
val data = AddStickerToSet(userId, stickerSetName, emojis, sticker as? FileId, maskPosition)
|
val data = AddAnimatedStickerToSet(userId, stickerSetName, emojis, sticker as? FileId, maskPosition)
|
||||||
return when (sticker) {
|
return when (sticker) {
|
||||||
is MultipartFile -> CommonMultipartFileRequest(
|
is MultipartFile -> CommonMultipartFileRequest(
|
||||||
data,
|
data,
|
||||||
@ -25,18 +25,18 @@ fun AddStickerToSet(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AddStickerToSet internal constructor(
|
data class AddAnimatedStickerToSet internal constructor(
|
||||||
@SerialName(userIdField)
|
@SerialName(userIdField)
|
||||||
override val userId: UserId,
|
override val userId: UserId,
|
||||||
@SerialName(nameField)
|
@SerialName(nameField)
|
||||||
override val name: String,
|
override val name: String,
|
||||||
@SerialName(emojisField)
|
@SerialName(emojisField)
|
||||||
override val emojis: String,
|
override val emojis: String,
|
||||||
@SerialName(pngStickerField)
|
@SerialName(tgsStickerField)
|
||||||
val sticker: FileId? = null,
|
val sticker: FileId? = null,
|
||||||
@SerialName(maskPositionField)
|
@SerialName(maskPositionField)
|
||||||
override val maskPosition: MaskPosition? = null
|
override val maskPosition: MaskPosition? = null
|
||||||
) : StickerSetAction {
|
) : StandardStickerSetAction {
|
||||||
init {
|
init {
|
||||||
if(emojis.isEmpty()) {
|
if(emojis.isEmpty()) {
|
||||||
throw IllegalArgumentException("Emojis must not be empty")
|
throw IllegalArgumentException("Emojis must not be empty")
|
@ -0,0 +1,68 @@
|
|||||||
|
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.StandardStickerSetAction
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
fun AddStaticStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: InputFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
): Request<Boolean> {
|
||||||
|
val data = AddStaticStickerToSet(userId, stickerSetName, emojis, sticker as? FileId, maskPosition)
|
||||||
|
return when (sticker) {
|
||||||
|
is MultipartFile -> CommonMultipartFileRequest(
|
||||||
|
data,
|
||||||
|
mapOf(pngStickerField to sticker)
|
||||||
|
)
|
||||||
|
is FileId -> data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated(
|
||||||
|
"Renamed",
|
||||||
|
ReplaceWith("AddStaticStickerToSet", "com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.AddStaticStickerToSet")
|
||||||
|
)
|
||||||
|
fun AddStickerToSet(
|
||||||
|
userId: UserId,
|
||||||
|
stickerSetName: String,
|
||||||
|
sticker: InputFile,
|
||||||
|
emojis: String,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
) = AddStaticStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition)
|
||||||
|
|
||||||
|
@Deprecated(
|
||||||
|
"Renamed",
|
||||||
|
ReplaceWith("AddStaticStickerToSet", "com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.AddStaticStickerToSet")
|
||||||
|
)
|
||||||
|
typealias AddStickerToSet = AddStaticStickerToSet
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class AddStaticStickerToSet internal constructor(
|
||||||
|
@SerialName(userIdField)
|
||||||
|
override val userId: UserId,
|
||||||
|
@SerialName(nameField)
|
||||||
|
override val name: String,
|
||||||
|
@SerialName(emojisField)
|
||||||
|
override val emojis: String,
|
||||||
|
@SerialName(pngStickerField)
|
||||||
|
val sticker: FileId? = null,
|
||||||
|
@SerialName(maskPositionField)
|
||||||
|
override val maskPosition: MaskPosition? = null
|
||||||
|
) : StandardStickerSetAction {
|
||||||
|
init {
|
||||||
|
if(emojis.isEmpty()) {
|
||||||
|
throw IllegalArgumentException("Emojis must not be empty")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
|
||||||
|
override fun method(): String = "addStickerToSet"
|
||||||
|
}
|
@ -2,12 +2,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
|
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.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
fun CreateNewStickerSet(
|
fun CreateNewAnimatedStickerSet(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
name: String,
|
name: String,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
@ -15,7 +15,7 @@ fun CreateNewStickerSet(
|
|||||||
containsMasks: Boolean? = null,
|
containsMasks: Boolean? = null,
|
||||||
maskPosition: MaskPosition? = null
|
maskPosition: MaskPosition? = null
|
||||||
): Request<Boolean> {
|
): Request<Boolean> {
|
||||||
val data = CreateNewStickerSet(userId, name, emojis, sticker as? FileId, containsMasks, maskPosition)
|
val data = CreateNewAnimatedStickerSet(userId, name, emojis, sticker as? FileId, containsMasks, maskPosition)
|
||||||
return when (sticker) {
|
return when (sticker) {
|
||||||
is MultipartFile -> CommonMultipartFileRequest(
|
is MultipartFile -> CommonMultipartFileRequest(
|
||||||
data,
|
data,
|
||||||
@ -26,20 +26,20 @@ fun CreateNewStickerSet(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class CreateNewStickerSet internal constructor(
|
data class CreateNewAnimatedStickerSet internal constructor(
|
||||||
@SerialName(userIdField)
|
@SerialName(userIdField)
|
||||||
override val userId: UserId,
|
override val userId: UserId,
|
||||||
@SerialName(nameField)
|
@SerialName(nameField)
|
||||||
override val name: String,
|
override val name: String,
|
||||||
@SerialName(emojisField)
|
@SerialName(emojisField)
|
||||||
override val emojis: String,
|
override val emojis: String,
|
||||||
@SerialName(pngStickerField)
|
@SerialName(tgsStickerField)
|
||||||
val sticker: FileId? = null,
|
val sticker: FileId? = null,
|
||||||
@SerialName(containsMasksField)
|
@SerialName(containsMasksField)
|
||||||
val containsMasks: Boolean? = null,
|
val containsMasks: Boolean? = null,
|
||||||
@SerialName(maskPositionField)
|
@SerialName(maskPositionField)
|
||||||
override val maskPosition: MaskPosition? = null
|
override val maskPosition: MaskPosition? = null
|
||||||
) : StickerSetAction {
|
) : StandardStickerSetAction {
|
||||||
init {
|
init {
|
||||||
if(emojis.isEmpty()) {
|
if(emojis.isEmpty()) {
|
||||||
throw IllegalArgumentException("Emojis must not be empty")
|
throw IllegalArgumentException("Emojis must not be empty")
|
@ -0,0 +1,68 @@
|
|||||||
|
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.StandardStickerSetAction
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
fun CreateNewStaticStickerSet(
|
||||||
|
userId: UserId,
|
||||||
|
name: String,
|
||||||
|
sticker: InputFile,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
): Request<Boolean> {
|
||||||
|
val data = CreateNewStaticStickerSet(userId, name, emojis, sticker as? FileId, containsMasks, maskPosition)
|
||||||
|
return when (sticker) {
|
||||||
|
is MultipartFile -> CommonMultipartFileRequest(
|
||||||
|
data,
|
||||||
|
mapOf(pngStickerField to sticker)
|
||||||
|
)
|
||||||
|
is FileId -> data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun CreateNewStickerSet(
|
||||||
|
userId: UserId,
|
||||||
|
name: String,
|
||||||
|
sticker: InputFile,
|
||||||
|
emojis: String,
|
||||||
|
containsMasks: Boolean? = null,
|
||||||
|
maskPosition: MaskPosition? = null
|
||||||
|
): Request<Boolean> = CreateNewStaticStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
||||||
|
|
||||||
|
@Deprecated(
|
||||||
|
"Renamed",
|
||||||
|
ReplaceWith("CreateNewStaticStickerSet", "com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.CreateNewStaticStickerSet")
|
||||||
|
)
|
||||||
|
typealias CreateNewStickerSet = CreateNewStaticStickerSet
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class CreateNewStaticStickerSet internal constructor(
|
||||||
|
@SerialName(userIdField)
|
||||||
|
override val userId: UserId,
|
||||||
|
@SerialName(nameField)
|
||||||
|
override val name: String,
|
||||||
|
@SerialName(emojisField)
|
||||||
|
override val emojis: String,
|
||||||
|
@SerialName(pngStickerField)
|
||||||
|
val sticker: FileId? = null,
|
||||||
|
@SerialName(containsMasksField)
|
||||||
|
val containsMasks: Boolean? = null,
|
||||||
|
@SerialName(maskPositionField)
|
||||||
|
override val maskPosition: MaskPosition? = null
|
||||||
|
) : StandardStickerSetAction {
|
||||||
|
init {
|
||||||
|
if(emojis.isEmpty()) {
|
||||||
|
throw IllegalArgumentException("Emojis must not be empty")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
|
||||||
|
override fun method(): String = "createNewStickerSet"
|
||||||
|
}
|
@ -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.requests.abstracts.SimpleRequest
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.builtins.serializer
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
interface StickerSetAction : SimpleRequest<Boolean> {
|
interface StickerSetAction : SimpleRequest<Boolean> {
|
||||||
val userId: UserId
|
val userId: UserId
|
||||||
val name: String
|
val name: String
|
||||||
val emojis: String // must be more than one
|
|
||||||
val maskPosition: MaskPosition?
|
|
||||||
|
|
||||||
override val resultDeserializer: KSerializer<Boolean>
|
override val resultDeserializer: KSerializer<Boolean>
|
||||||
get() = Boolean.serializer()
|
get() = Boolean.serializer()
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BotCommand(
|
||||||
|
@SerialName(botCommandField)
|
||||||
|
val command: String,
|
||||||
|
@SerialName(descriptionField)
|
||||||
|
val description: String
|
||||||
|
)
|
@ -19,9 +19,11 @@ typealias InlineMessageIdentifier = String
|
|||||||
typealias PollIdentifier = String
|
typealias PollIdentifier = String
|
||||||
typealias StickerSetName = String
|
typealias StickerSetName = String
|
||||||
typealias FileUniqueId = String
|
typealias FileUniqueId = String
|
||||||
|
typealias DiceResult = Int
|
||||||
|
|
||||||
typealias Seconds = Int
|
typealias Seconds = Int
|
||||||
|
|
||||||
|
val getUpdatesLimit = 1 .. 100
|
||||||
val callbackQueryAnswerLength = 0 until 200
|
val callbackQueryAnswerLength = 0 until 200
|
||||||
val captionLength = 0 until 1024
|
val captionLength = 0 until 1024
|
||||||
val textLength = 0 until 4096
|
val textLength = 0 until 4096
|
||||||
@ -45,6 +47,12 @@ val inlineQueryAnswerResultsLimit = 0 .. 50
|
|||||||
|
|
||||||
val customTitleLength = 0 .. 16
|
val customTitleLength = 0 .. 16
|
||||||
|
|
||||||
|
val diceResultLimit = 1 .. 6
|
||||||
|
|
||||||
|
val botCommandLimit = 1 .. 32
|
||||||
|
val botCommandDescriptionLimit = 3 .. 256
|
||||||
|
val botCommandsLimit = 0 .. 100
|
||||||
|
|
||||||
const val chatIdField = "chat_id"
|
const val chatIdField = "chat_id"
|
||||||
const val messageIdField = "message_id"
|
const val messageIdField = "message_id"
|
||||||
const val updateIdField = "update_id"
|
const val updateIdField = "update_id"
|
||||||
@ -164,6 +172,8 @@ const val thumbHeightField = "thumb_height"
|
|||||||
const val inputMessageContentField = "input_message_content"
|
const val inputMessageContentField = "input_message_content"
|
||||||
const val hideUrlField = "hide_url"
|
const val hideUrlField = "hide_url"
|
||||||
|
|
||||||
|
const val botCommandField = "command"
|
||||||
|
const val botCommandsField = "commands"
|
||||||
|
|
||||||
const val isMemberField = "is_member"
|
const val isMemberField = "is_member"
|
||||||
const val canSendMessagesField = "can_send_messages"
|
const val canSendMessagesField = "can_send_messages"
|
||||||
@ -183,6 +193,7 @@ const val canRestrictMembersField = "can_restrict_members"
|
|||||||
const val canPinMessagesField = "can_pin_messages"
|
const val canPinMessagesField = "can_pin_messages"
|
||||||
const val canPromoteMembersField = "can_promote_members"
|
const val canPromoteMembersField = "can_promote_members"
|
||||||
const val pngStickerField = "png_sticker"
|
const val pngStickerField = "png_sticker"
|
||||||
|
const val tgsStickerField = "tgs_sticker"
|
||||||
|
|
||||||
const val okField = "ok"
|
const val okField = "ok"
|
||||||
const val captionField = "caption"
|
const val captionField = "caption"
|
||||||
@ -230,6 +241,7 @@ const val optionsField = "options"
|
|||||||
const val payField = "pay"
|
const val payField = "pay"
|
||||||
const val permissionsField = "permissions"
|
const val permissionsField = "permissions"
|
||||||
const val typeField = "type"
|
const val typeField = "type"
|
||||||
|
const val valueField = "value"
|
||||||
|
|
||||||
const val pointField = "point"
|
const val pointField = "point"
|
||||||
const val xShiftField = "x_shift"
|
const val xShiftField = "x_shift"
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Dice(
|
||||||
|
@SerialName(valueField)
|
||||||
|
val value: DiceResult
|
||||||
|
)
|
@ -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.Invoice
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.SuccessfulPayment
|
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.SuccessfulPayment
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
// TODO:: add PassportData type
|
// TODO:: add PassportData type
|
||||||
@ -74,6 +75,7 @@ internal data class RawMessage(
|
|||||||
private val migrate_from_chat_id: ChatIdentifier? = null,
|
private val migrate_from_chat_id: ChatIdentifier? = null,
|
||||||
private val pinned_message: RawMessage? = null,
|
private val pinned_message: RawMessage? = null,
|
||||||
private val invoice: Invoice? = null,
|
private val invoice: Invoice? = null,
|
||||||
|
private val dice: Dice? = null,
|
||||||
private val successful_payment: SuccessfulPayment? = null,
|
private val successful_payment: SuccessfulPayment? = null,
|
||||||
|
|
||||||
// login property
|
// login property
|
||||||
@ -123,6 +125,7 @@ internal data class RawMessage(
|
|||||||
adaptedCaptionEntities
|
adaptedCaptionEntities
|
||||||
)
|
)
|
||||||
sticker != null -> StickerContent(sticker)
|
sticker != null -> StickerContent(sticker)
|
||||||
|
dice != null -> DiceContent(dice)
|
||||||
game != null -> GameContent(game.asGame)
|
game != null -> GameContent(game.asGame)
|
||||||
video_note != null -> VideoNoteContent(video_note)
|
video_note != null -> VideoNoteContent(video_note)
|
||||||
contact != null -> ContactContent(contact)
|
contact != null -> ContactContent(contact)
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendDice
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||||
|
|
||||||
|
data class DiceContent(
|
||||||
|
val dice: Dice
|
||||||
|
) : MessageContent {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<ContentMessage<DiceContent>> = SendDice(chatId, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.stickers
|
package com.github.insanusmokrassar.TelegramBotAPI.types.stickers
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
@ -16,5 +17,7 @@ data class StickerSet(
|
|||||||
@SerialName(isAnimatedField)
|
@SerialName(isAnimatedField)
|
||||||
val isAnimated: Boolean = false,
|
val isAnimated: Boolean = false,
|
||||||
@SerialName(containsMasksField)
|
@SerialName(containsMasksField)
|
||||||
val containsMasks: Boolean = false
|
val containsMasks: Boolean = false,
|
||||||
|
@SerialName(thumbField)
|
||||||
|
val thumb: PhotoSize? = null
|
||||||
)
|
)
|
||||||
|
@ -2,11 +2,11 @@ kotlin.code.style=official
|
|||||||
kotlin_version=1.3.71
|
kotlin_version=1.3.71
|
||||||
kotlin_coroutines_version=1.3.5
|
kotlin_coroutines_version=1.3.5
|
||||||
kotlin_serialisation_runtime_version=0.20.0
|
kotlin_serialisation_runtime_version=0.20.0
|
||||||
klock_version=1.10.0
|
klock_version=1.10.3
|
||||||
uuid_version=0.1.0
|
uuid_version=0.1.0
|
||||||
ktor_version=1.3.2
|
ktor_version=1.3.2
|
||||||
|
|
||||||
library_group=com.github.insanusmokrassar
|
library_group=com.github.insanusmokrassar
|
||||||
library_version=0.25.1
|
library_version=0.26.0
|
||||||
|
|
||||||
gradle_bintray_plugin_version=1.8.4
|
gradle_bintray_plugin_version=1.8.4
|
||||||
|
Loading…
Reference in New Issue
Block a user