mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 12:00:18 +00:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dec55cfb2d | |||
| 3997af171e | |||
| d963cdae35 | |||
| 8ec209422a | |||
| 8ca86b1e14 | |||
| ffba4e9cef | |||
| 544192ad5f | |||
| 08b0564dba | |||
| 009c49247d | |||
| dd7a3ced4d | |||
| ceff85fcfd | |||
| bb62f9fbd6 | |||
| 7bbbf54775 | |||
| 1b506cb820 | |||
| 3f988d1529 | |||
| 2da28cea01 | |||
| 42e6013d95 | |||
| 3c8dbe70dc | |||
| 4a1989fb79 | |||
| b559dbbe66 | |||
| d72fb6e3e8 | |||
| 092722fad8 | |||
| 63633e8891 | |||
| 61cdfa264e | |||
| 6262b0581a | |||
| 8694b31066 | |||
| 5a541271b8 | |||
|
|
9b14e9079b | ||
| fd26d14380 | |||
| 3ebaef0789 | |||
| 51bb0a021f | |||
| b7c1692efa | |||
| bce5fb658c |
2
.github/workflows/packages_publishing.yml
vendored
2
.github/workflows/packages_publishing.yml
vendored
@@ -20,6 +20,8 @@ jobs:
|
||||
run: ./gradlew ksp
|
||||
- name: Build
|
||||
run: ./gradlew build
|
||||
- name: API compatibility check
|
||||
run: ./gradlew apiCheck
|
||||
- name: Publish to Gitea
|
||||
continue-on-error: true
|
||||
run: ./gradlew publishAllPublicationsToInmoNexusRepository
|
||||
|
||||
37
CHANGELOG.md
37
CHANGELOG.md
@@ -1,5 +1,42 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 11.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS REMOVES OF DEPRECATED THINGS**
|
||||
|
||||
* `Core`:
|
||||
* `MessageId` now is `value class`. `MessageIdentifier` become deprecated
|
||||
* `MessageThreadId` now is `value class`
|
||||
* `InlineQueryIdentifier` now is `value class`
|
||||
* `MediaGroupIdentifier` has been renamed to `MediaGroupId` and now is `value class`
|
||||
* `CallbackQueryIdentifier` has been renamed to `CallbackQueryId` and now is `value class`
|
||||
* `WebAppQueryId` now is `value class`
|
||||
* `PreCheckoutQueryId` now is `value class`
|
||||
* `FileUniqueId` has been renamed to `TgFileUniqueId` and now is `value class`
|
||||
* `UpdateIdentifier` has been renamed to `UpdateId` and now is `value class`
|
||||
* `InlineMessageIdentifier` has been renamed to `InlineMessageId` and now is `value class`
|
||||
* `ShippingQueryIdentifier` has been renamed to `ShippingQueryId` and now is `value class`
|
||||
* `Identifier` has been renamed to `RawChatId` and now is `value class`
|
||||
* `ShippingOptionIdentifier` has been renamed to `ShippingOptionId` and now is `value class`
|
||||
* `PollIdentifier` has been renamed to `PollId` and now is `value class`
|
||||
* `StickerSetName` now is `value class`
|
||||
|
||||
## 10.1.2
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `1.9.22` -> `1.9.23`
|
||||
* `Korlibs`: `5.3.2` -> `5.4.0`
|
||||
* `Ktor`: `2.3.8` -> `2.3.9`
|
||||
* `MicroUtils`: `0.20.37` -> `0.20.39`
|
||||
* `KSLog`: `1.3.2` -> `1.3.3`
|
||||
|
||||
## 10.1.1
|
||||
|
||||
* `Version`:
|
||||
* `Serialization`: `1.6.2` -> `1.6.3`
|
||||
* `MicroUtils`: `0.20.34` -> `0.20.37`
|
||||
* `Korlibs`: `5.3.1` -> `5.3.2`
|
||||
|
||||
## 10.1.0
|
||||
|
||||
**Add support of [Telegram Bots API 7.1](https://core.telegram.org/bots/api-changelog#february-16-2024)**
|
||||
|
||||
@@ -17,6 +17,7 @@ buildscript {
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.dokka)
|
||||
alias(libs.plugins.versions)
|
||||
alias(libs.plugins.validator)
|
||||
}
|
||||
|
||||
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
||||
|
||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=10.1.0
|
||||
library_version=11.0.0
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
[versions]
|
||||
|
||||
kotlin = "1.9.22"
|
||||
kotlin-serialization = "1.6.2"
|
||||
kotlin = "1.9.23"
|
||||
kotlin-serialization = "1.6.3"
|
||||
kotlin-coroutines = "1.8.0"
|
||||
|
||||
javax-activation = "1.1.1"
|
||||
|
||||
korlibs = "5.3.1"
|
||||
korlibs = "5.4.0"
|
||||
uuid = "0.8.2"
|
||||
ktor = "2.3.8"
|
||||
ktor = "2.3.9"
|
||||
|
||||
ksp = "1.9.22-1.0.17"
|
||||
ksp = "1.9.23-1.0.19"
|
||||
kotlin-poet = "1.16.0"
|
||||
|
||||
microutils = "0.20.34"
|
||||
kslog = "1.3.2"
|
||||
microutils = "0.20.39"
|
||||
kslog = "1.3.3"
|
||||
|
||||
versions = "0.51.0"
|
||||
|
||||
github-release-plugin = "2.5.2"
|
||||
dokka = "1.9.10"
|
||||
dokka = "1.9.20"
|
||||
|
||||
validator = "0.14.0"
|
||||
|
||||
[libraries]
|
||||
|
||||
@@ -78,3 +80,4 @@ kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref
|
||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
|
||||
validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "validator" }
|
||||
|
||||
2162
tgbotapi.api/api/tgbotapi.api.api
Normal file
2162
tgbotapi.api/api/tgbotapi.api.api
Normal file
File diff suppressed because it is too large
Load Diff
@@ -27,15 +27,6 @@ suspend fun TelegramBot.deleteMessages(
|
||||
messageIds = messageIds.toList()
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.deleteMessages(
|
||||
chatId: ChatIdentifier,
|
||||
firstMessageId: MessageId,
|
||||
vararg messageIds: MessageId
|
||||
) = deleteMessages(
|
||||
chatId = chatId,
|
||||
messageIds = (listOf(firstMessageId) + messageIds.toList())
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.deleteMessages(
|
||||
messagesMetas: List<Message.MetaInfo>
|
||||
) = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
|
||||
@@ -60,14 +51,6 @@ suspend fun TelegramBot.delete(
|
||||
messageIds: Array<MessageId>
|
||||
) = deleteMessages(chatId = chatId, messageIds = messageIds)
|
||||
|
||||
suspend fun TelegramBot.delete(
|
||||
chatId: ChatIdentifier,
|
||||
firstMessageId: MessageId,
|
||||
secondMessageId: MessageId,
|
||||
vararg messageIds: MessageId
|
||||
) = deleteMessages(chatId = chatId, messageIds = (listOf(firstMessageId, secondMessageId) + messageIds.toList()))
|
||||
|
||||
|
||||
suspend fun TelegramBot.delete(
|
||||
messagesMetas: List<Message.MetaInfo>
|
||||
) = deleteMessages(messagesMetas)
|
||||
|
||||
@@ -48,25 +48,6 @@ suspend fun TelegramBot.forwardMessages(
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.forwardMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
firstMessageId: MessageId,
|
||||
vararg messageIds: MessageId,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
) = forwardMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
messageIds = (listOf(firstMessageId) + messageIds.toList()),
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.forwardMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
messagesMetas: List<Message.MetaInfo>,
|
||||
@@ -139,26 +120,6 @@ suspend fun TelegramBot.forward(
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.forward(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
firstMessageId: MessageId,
|
||||
vararg messageIds: MessageId,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
) = forwardMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
firstMessageId = firstMessageId,
|
||||
messageIds = *messageIds,
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.forward(
|
||||
toChatId: ChatIdentifier,
|
||||
messagesMetas: List<Message.MetaInfo>,
|
||||
|
||||
@@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
|
||||
suspend fun TelegramBot.getUpdates(
|
||||
offset: UpdateIdentifier? = null,
|
||||
offset: UpdateId? = null,
|
||||
limit: Int = getUpdatesLimit.last,
|
||||
timeout: Seconds? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package dev.inmo.tgbotapi.extensions.api
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.GetUpdates
|
||||
import dev.inmo.tgbotapi.requests.GetUpdatesRaw
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
|
||||
suspend fun TelegramBot.getRawUpdates(
|
||||
offset: UpdateIdentifier? = null,
|
||||
offset: UpdateId? = null,
|
||||
limit: Int = getUpdatesLimit.last,
|
||||
timeout: Seconds? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.InternalUtils
|
||||
|
||||
import dev.inmo.tgbotapi.types.MediaGroupIdentifier
|
||||
import dev.inmo.tgbotapi.types.MediaGroupId
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
|
||||
import dev.inmo.tgbotapi.types.update.*
|
||||
@@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.utils.extensions.asMediaGroupMessage
|
||||
*/
|
||||
internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
|
||||
val resultUpdates = mutableListOf<Update>()
|
||||
val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<Pair<BaseSentMessageUpdate, PossiblySentViaBotCommonMessage<MediaGroupPartContent>>>>()
|
||||
val mediaGroups = mutableMapOf<MediaGroupId, MutableList<Pair<BaseSentMessageUpdate, PossiblySentViaBotCommonMessage<MediaGroupPartContent>>>>()
|
||||
|
||||
for (update in this) {
|
||||
val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let {
|
||||
|
||||
@@ -3,10 +3,10 @@ package dev.inmo.tgbotapi.extensions.api.answers
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.answers.AnswerCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
||||
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.CallbackQueryId
|
||||
|
||||
suspend fun TelegramBot.answerCallbackQuery(
|
||||
callbackQueryId: CallbackQueryIdentifier,
|
||||
callbackQueryId: CallbackQueryId,
|
||||
text: String? = null,
|
||||
showAlert: Boolean? = null,
|
||||
url: String? = null,
|
||||
|
||||
@@ -5,10 +5,10 @@ import dev.inmo.tgbotapi.requests.answers.AnswerInlineQuery
|
||||
import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineQueryId
|
||||
|
||||
suspend fun TelegramBot.answerInlineQuery(
|
||||
inlineQueryID: InlineQueryIdentifier,
|
||||
inlineQueryID: InlineQueryId,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
@@ -37,7 +37,7 @@ suspend fun TelegramBot.answer(
|
||||
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
|
||||
|
||||
suspend fun TelegramBot.answerInlineQuery(
|
||||
inlineQueryID: InlineQueryIdentifier,
|
||||
inlineQueryID: InlineQueryId,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
|
||||
@@ -3,12 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.answers.payments
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.answers.payments.AnswerShippingQueryError
|
||||
import dev.inmo.tgbotapi.requests.answers.payments.AnswerShippingQueryOk
|
||||
import dev.inmo.tgbotapi.types.ShippingQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.ShippingQueryId
|
||||
import dev.inmo.tgbotapi.types.payments.ShippingOption
|
||||
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
||||
|
||||
suspend fun TelegramBot.answerShippingQueryOk(
|
||||
id: ShippingQueryIdentifier,
|
||||
id: ShippingQueryId,
|
||||
shippingOptions: List<ShippingOption>
|
||||
) = execute(AnswerShippingQueryOk(id, shippingOptions))
|
||||
suspend fun TelegramBot.answerShippingQueryOk(
|
||||
@@ -17,7 +17,7 @@ suspend fun TelegramBot.answerShippingQueryOk(
|
||||
) = answerShippingQueryOk(shippingQuery.id, shippingOptions)
|
||||
|
||||
suspend fun TelegramBot.answerShippingQueryError(
|
||||
id: ShippingQueryIdentifier,
|
||||
id: ShippingQueryId,
|
||||
error: String
|
||||
) = execute(AnswerShippingQueryError(id, error))
|
||||
suspend fun TelegramBot.answerShippingQueryError(
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.edit
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.TextedWithTextSources
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.caption.editMessageCaption
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.media.editMessageMedia
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.content.*
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.utils.EntitiesBuilderBody
|
||||
@@ -26,7 +20,7 @@ import dev.inmo.tgbotapi.utils.buildEntities
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.edit(
|
||||
messageId: InlineMessageIdentifier,
|
||||
messageId: InlineMessageId,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
horizontalAccuracy: Meters? = null,
|
||||
@@ -40,7 +34,7 @@ suspend fun TelegramBot.edit(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.edit(
|
||||
messageId: InlineMessageIdentifier,
|
||||
messageId: InlineMessageId,
|
||||
location: LiveLocation,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editLiveLocation(
|
||||
@@ -52,7 +46,7 @@ suspend fun TelegramBot.edit(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.edit(
|
||||
messageId: InlineMessageIdentifier,
|
||||
messageId: InlineMessageId,
|
||||
media: TelegramMedia,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageMedia(messageId, media, replyMarkup)
|
||||
@@ -62,7 +56,7 @@ suspend fun TelegramBot.edit(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.edit(
|
||||
messageId: InlineMessageIdentifier,
|
||||
messageId: InlineMessageId,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageReplyMarkup(messageId, replyMarkup)
|
||||
|
||||
@@ -71,7 +65,7 @@ suspend fun TelegramBot.edit(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.edit(
|
||||
messageId: InlineMessageIdentifier,
|
||||
messageId: InlineMessageId,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
@@ -83,7 +77,7 @@ suspend fun TelegramBot.edit(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.edit(
|
||||
messageId: InlineMessageIdentifier,
|
||||
messageId: InlineMessageId,
|
||||
entities: TextSourcesList,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
@@ -94,7 +88,7 @@ suspend fun TelegramBot.edit(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.edit(
|
||||
messageId: InlineMessageIdentifier,
|
||||
messageId: InlineMessageId,
|
||||
separator: TextSource? = null,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@@ -106,7 +100,7 @@ suspend fun TelegramBot.edit(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.edit(
|
||||
messageId: InlineMessageIdentifier,
|
||||
messageId: InlineMessageId,
|
||||
separator: String,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.caption
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineMessageId
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
@@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.editMessageCaption(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
@@ -23,7 +23,7 @@ suspend fun TelegramBot.editMessageCaption(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.editMessageCaption(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
entities: TextSourcesList,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(EditInlineMessageCaption(inlineMessageId, entities, replyMarkup))
|
||||
|
||||
@@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||
|
||||
suspend fun TelegramBot.editLiveLocation(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
horizontalAccuracy: Meters? = null,
|
||||
@@ -20,7 +20,7 @@ suspend fun TelegramBot.editLiveLocation(
|
||||
)
|
||||
)
|
||||
suspend fun TelegramBot.editLiveLocation(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
location: LiveLocation,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.location.live
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineMessageId
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
/**
|
||||
@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.stopLiveLocation(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
StopInlineMessageLiveLocation(
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.media
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.edit.media.EditInlineMessageMedia
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineMessageId
|
||||
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.editMessageMedia(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
media: TelegramMedia,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.reply_markup
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.edit.reply_markup.EditInlineMessageReplyMarkup
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineMessageId
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
/**
|
||||
@@ -10,6 +10,6 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.editMessageReplyMarkup(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup))
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.text
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineMessageId
|
||||
import dev.inmo.tgbotapi.types.LinkPreviewOptions
|
||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||
@@ -16,7 +16,7 @@ import dev.inmo.tgbotapi.utils.buildEntities
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.editMessageText(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
@@ -28,7 +28,7 @@ suspend fun TelegramBot.editMessageText(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.editMessageText(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
entities: TextSourcesList,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
@@ -39,7 +39,7 @@ suspend fun TelegramBot.editMessageText(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.editMessageText(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
separator: TextSource? = null,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@@ -51,7 +51,7 @@ suspend fun TelegramBot.editMessageText(
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.editMessageText(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
separator: String,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
|
||||
@@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
|
||||
suspend fun TelegramBot.getGameScore(
|
||||
userId: UserId,
|
||||
inlineMessageId: InlineMessageIdentifier
|
||||
inlineMessageId: InlineMessageId
|
||||
) = execute(
|
||||
GetGameHighScoresByInlineMessageId(
|
||||
userId, inlineMessageId
|
||||
@@ -16,5 +16,5 @@ suspend fun TelegramBot.getGameScore(
|
||||
|
||||
suspend fun TelegramBot.getGameScore(
|
||||
user: CommonUser,
|
||||
inlineMessageId: InlineMessageIdentifier
|
||||
inlineMessageId: InlineMessageId
|
||||
) = getGameScore(user.id, inlineMessageId)
|
||||
|
||||
@@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
suspend fun TelegramBot.setGameScore(
|
||||
userId: UserId,
|
||||
score: Long,
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
force: Boolean = false,
|
||||
disableEditMessage: Boolean = false
|
||||
) = execute(
|
||||
@@ -20,7 +20,7 @@ suspend fun TelegramBot.setGameScore(
|
||||
suspend fun TelegramBot.setGameScore(
|
||||
user: CommonUser,
|
||||
score: Long,
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
force: Boolean = false,
|
||||
disableEditMessage: Boolean = false
|
||||
) = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage)
|
||||
|
||||
@@ -2,14 +2,21 @@ package dev.inmo.tgbotapi.extensions.api.get
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.get.GetStickerSet
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
|
||||
suspend fun TelegramBot.getStickerSet(
|
||||
name: String
|
||||
name: StickerSetName
|
||||
) = execute(
|
||||
GetStickerSet(name)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.getStickerSet(
|
||||
name: String
|
||||
) = getStickerSet(
|
||||
StickerSetName(name)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.getStickerSetOrNull(
|
||||
sticker: Sticker
|
||||
) = sticker.stickerSetName ?.let {
|
||||
|
||||
@@ -47,25 +47,6 @@ suspend fun TelegramBot.copyMessages(
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.copyMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
firstMessageId: MessageId,
|
||||
vararg messageIds: MessageId,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
) = copyMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
messageIds = (listOf(firstMessageId) + messageIds.toList()),
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.copyMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
messagesMetas: List<Message.MetaInfo>,
|
||||
@@ -138,26 +119,6 @@ suspend fun TelegramBot.copy(
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.copy(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
firstMessageId: MessageId,
|
||||
vararg messageIds: MessageId,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
) = copyMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
firstMessageId = firstMessageId,
|
||||
messageIds = messageIds,
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.copy(
|
||||
toChatId: ChatIdentifier,
|
||||
messagesMetas: List<Message.MetaInfo>,
|
||||
|
||||
@@ -108,15 +108,15 @@ suspend inline fun TelegramBot.sendVoice(
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendVoice(
|
||||
chatId,
|
||||
voice,
|
||||
entities,
|
||||
duration,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyParameters,
|
||||
replyMarkup
|
||||
chatId = chatId,
|
||||
voice = voice,
|
||||
entities = entities,
|
||||
threadId = threadId,
|
||||
duration = duration,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
replyParameters = replyParameters,
|
||||
replyMarkup = replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.stickers.AddStickerToSet
|
||||
import dev.inmo.tgbotapi.requests.stickers.InputSticker
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.StickerType
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
@@ -12,12 +13,18 @@ import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
stickerSetName: StickerSetName,
|
||||
inputSticker: InputSticker
|
||||
) = execute(
|
||||
AddStickerToSet(userId, stickerSetName, inputSticker)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
inputSticker: InputSticker
|
||||
) = addStickerToSet(userId, StickerSetName(stickerSetName), inputSticker)
|
||||
|
||||
suspend fun TelegramBot.addStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSet: StickerSet,
|
||||
|
||||
@@ -62,7 +62,7 @@ suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
stickerSet: StickerSet,
|
||||
thumbnail: FileId
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSet.name, thumbnail
|
||||
user.id, stickerSet, thumbnail
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
@@ -70,5 +70,5 @@ suspend fun TelegramBot.setStickerSetThumbnail(
|
||||
stickerSet: StickerSet,
|
||||
thumbnail: MultipartFile
|
||||
) = setStickerSetThumbnail(
|
||||
user.id, stickerSet.name, thumbnail
|
||||
user.id, stickerSet, thumbnail
|
||||
)
|
||||
|
||||
1379
tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api
Normal file
1379
tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder
|
||||
import dev.inmo.micro_utils.coroutines.*
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.TriggersHolder
|
||||
import dev.inmo.tgbotapi.types.UpdateIdentifier
|
||||
import dev.inmo.tgbotapi.types.UpdateId
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
import dev.inmo.tgbotapi.updateshandlers.*
|
||||
import kotlinx.coroutines.*
|
||||
@@ -72,7 +72,7 @@ class DefaultBehaviourContext(
|
||||
private val additionalUpdatesSharedFlow = MutableSharedFlow<Update>(0, broadcastChannelsSize, onBufferOverflow)
|
||||
override val allUpdatesFlow: Flow<Update> = (additionalUpdatesSharedFlow.asSharedFlow()).let {
|
||||
if (upstreamUpdatesFlow != null) {
|
||||
val handledUpdates = mutableSetOf<UpdateIdentifier>()
|
||||
val handledUpdates = mutableSetOf<UpdateId>()
|
||||
(it + upstreamUpdatesFlow).filter {
|
||||
val passed = handledUpdates.add(it.updateId)
|
||||
(passed).also { passed ->
|
||||
|
||||
@@ -13,131 +13,118 @@ import kotlinx.coroutines.flow.map
|
||||
@RiskFeature(lowLevelRiskFeatureMessage)
|
||||
suspend inline fun <reified O : MessageContent> BehaviourContext.waitEditedContent(
|
||||
initRequest: Request<*>? = null,
|
||||
includeMediaGroups: Boolean = true,
|
||||
noinline errorFactory: NullableRequestBuilder<*> = { null }
|
||||
): Flow<O> = waitEditedContentMessage<O>(initRequest, errorFactory).map { it.content }
|
||||
|
||||
suspend fun BehaviourContext.waitEditedMessageContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = true
|
||||
) = waitEditedContent<MessageContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<MessageContent>(initRequest, errorFactory)
|
||||
|
||||
suspend fun BehaviourContext.waitEditedContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = true
|
||||
) = waitEditedContent<MessageContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<MessageContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedContact(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<ContactContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<ContactContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedDice(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<DiceContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<DiceContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedGame(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<GameContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<GameContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedLocation(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<LocationContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<LocationContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedLiveLocation(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<LiveLocationContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<LiveLocationContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedStaticLocation(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<StaticLocationContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<StaticLocationContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedText(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<TextContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<TextContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedVenue(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<VenueContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<VenueContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedAudioMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = true
|
||||
) = waitEditedContent<AudioMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<AudioMediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedDocumentMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = true
|
||||
) = waitEditedContent<DocumentMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<DocumentMediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedMedia(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContent<MediaContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<MediaContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedAnyMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = true
|
||||
) = waitEditedContent<MediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<MediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedVisualMediaGroupContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = true
|
||||
) = waitEditedContent<VisualMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedTextedMediaContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = true
|
||||
) = waitEditedContent<TextedMediaContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<TextedMediaContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedAnimation(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<AnimationContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<AnimationContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedAudio(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContent<AudioContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<AudioContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedDocument(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContent<DocumentContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<DocumentContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedPhoto(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContent<PhotoContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<PhotoContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedSticker(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<StickerContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<StickerContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedVideo(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContent<VideoContent>(initRequest, includeMediaGroups, errorFactory)
|
||||
) = waitEditedContent<VideoContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedVideoNote(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<VideoNoteContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<VideoNoteContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedVoice(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<VoiceContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<VoiceContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedInvoice(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<InvoiceContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<InvoiceContent>(initRequest, errorFactory)
|
||||
|
||||
suspend fun BehaviourContext.waitEditedGiveawayContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<GiveawayContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<GiveawayContent>(initRequest, errorFactory)
|
||||
|
||||
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<GiveawayPublicResultsContent>(initRequest, false, errorFactory)
|
||||
) = waitEditedContent<GiveawayPublicResultsContent>(initRequest, errorFactory)
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ suspend fun BehaviourContext.waitEditedDocumentMediaGroupContentMessage(
|
||||
suspend fun BehaviourContext.waitEditedMediaMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContentMessage<MediaContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedAnyMediaGroupContentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
@@ -102,17 +101,14 @@ suspend fun BehaviourContext.waitEditedAnimationMessage(
|
||||
suspend fun BehaviourContext.waitEditedAudioMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContentMessage<AudioContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedDocumentMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContentMessage<DocumentContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedPhotoMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContentMessage<PhotoContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedStickerMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
@@ -121,7 +117,6 @@ suspend fun BehaviourContext.waitEditedStickerMessage(
|
||||
suspend fun BehaviourContext.waitEditedVideoMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null },
|
||||
includeMediaGroups: Boolean = false
|
||||
) = waitEditedContentMessage<VideoContent>(initRequest, errorFactory)
|
||||
suspend fun BehaviourContext.waitEditedVideoNoteMessage(
|
||||
initRequest: Request<*>? = null,
|
||||
|
||||
24284
tgbotapi.core/api/tgbotapi.core.api
Normal file
24284
tgbotapi.core/api/tgbotapi.core.api
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,9 +9,3 @@ import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||
interface WithPreviewChat {
|
||||
val chat: PreviewChat
|
||||
}
|
||||
|
||||
/**
|
||||
* All inheritors of this interface have [chat] field and related to this [chat]
|
||||
*/
|
||||
@Deprecated("Renamed", ReplaceWith("WithPreviewChat", "dev.inmo.tgbotapi.abstracts.WithPreviewChat"))
|
||||
typealias WithChat = WithPreviewChat
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.abstracts.types
|
||||
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineMessageId
|
||||
|
||||
interface InlineMessageAction {
|
||||
val inlineMessageId: InlineMessageIdentifier
|
||||
val inlineMessageId: InlineMessageId
|
||||
}
|
||||
|
||||
@@ -7,6 +7,3 @@ interface LinkPreviewOptionsContainer {
|
||||
val disableWebPagePreview: Boolean?
|
||||
get() = linkPreviewOptions ?.isDisabled != true
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("LinkPreviewOptionsContainer", "dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer"))
|
||||
typealias DisableWebPagePreview = LinkPreviewOptionsContainer
|
||||
|
||||
@@ -3,17 +3,11 @@ package dev.inmo.tgbotapi.abstracts.types
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.ReplyParameters
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("WithReplyParameters", "dev.inmo.tgbotapi.abstracts.types.WithReplyParameters"))
|
||||
interface ReplyMessageId {
|
||||
val replyToMessageId: MessageId?
|
||||
val allowSendingWithoutReply: Boolean?
|
||||
}
|
||||
|
||||
interface WithReplyParameters : ReplyMessageId {
|
||||
interface WithReplyParameters {
|
||||
val replyParameters: ReplyParameters?
|
||||
|
||||
override val replyToMessageId: MessageId?
|
||||
val replyToMessageId: MessageId?
|
||||
get() = replyParameters ?.messageId
|
||||
override val allowSendingWithoutReply: Boolean?
|
||||
val allowSendingWithoutReply: Boolean?
|
||||
get() = replyParameters ?.allowSendingWithoutReply
|
||||
}
|
||||
|
||||
@@ -27,25 +27,6 @@ fun ForwardMessages(
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
fun ForwardMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageId,
|
||||
vararg messageIds: MessageId,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
) = ForwardMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
messageIds = (listOf(messageId) + messageIds.toList()),
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ForwardMessages (
|
||||
@SerialName(chatIdField)
|
||||
|
||||
@@ -21,7 +21,7 @@ private val updatesListSerializer = ListSerializer(
|
||||
*/
|
||||
@Serializable
|
||||
data class GetUpdates(
|
||||
override val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
|
||||
override val offset: UpdateId? = null,// set `last update id + 1` to receive next part of updates
|
||||
override val limit: Int = getUpdatesLimit.last,
|
||||
override val timeout: Seconds? = null,
|
||||
override val allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package dev.inmo.tgbotapi.requests
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.ALL_UPDATES_LIST
|
||||
import dev.inmo.tgbotapi.types.Seconds
|
||||
import dev.inmo.tgbotapi.types.UpdateIdentifier
|
||||
import dev.inmo.tgbotapi.types.UpdateId
|
||||
import dev.inmo.tgbotapi.types.getUpdatesLimit
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -16,7 +15,7 @@ import kotlinx.serialization.json.JsonArray
|
||||
*/
|
||||
@Serializable
|
||||
data class GetUpdatesRaw(
|
||||
override val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
|
||||
override val offset: UpdateId? = null,// set `last update id + 1` to receive next part of updates
|
||||
override val limit: Int = getUpdatesLimit.last,
|
||||
override val timeout: Seconds? = null,
|
||||
override val allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package dev.inmo.tgbotapi.requests
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.ALL_UPDATES_LIST
|
||||
import dev.inmo.tgbotapi.types.Seconds
|
||||
import dev.inmo.tgbotapi.types.UpdateIdentifier
|
||||
import dev.inmo.tgbotapi.types.getUpdatesLimit
|
||||
import dev.inmo.tgbotapi.types.UpdateId
|
||||
|
||||
interface GetUpdatesRequest<T : Any> : SimpleRequest<T> {
|
||||
val offset: UpdateIdentifier?
|
||||
val offset: UpdateId?
|
||||
val limit: Int
|
||||
val timeout: Seconds?
|
||||
val allowed_updates: List<String>?
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlinx.serialization.builtins.serializer
|
||||
@Serializable
|
||||
data class AnswerCallbackQuery(
|
||||
@SerialName(callbackQueryIdField)
|
||||
val callbackQueryId: CallbackQueryIdentifier,
|
||||
val callbackQueryId: CallbackQueryId,
|
||||
@SerialName(textField)
|
||||
val text: String? = null,
|
||||
@SerialName(showAlertField)
|
||||
|
||||
@@ -13,7 +13,7 @@ import kotlinx.serialization.builtins.serializer
|
||||
@Serializable
|
||||
data class AnswerInlineQuery(
|
||||
@SerialName(inlineQueryIdField)
|
||||
val inlineQueryID: InlineQueryIdentifier,
|
||||
val inlineQueryID: InlineQueryId,
|
||||
@Serializable(InlineQueryAnswersResultsSerializer::class)
|
||||
@SerialName(resultsField)
|
||||
val results: List<InlineQueryResult> = emptyList(),
|
||||
@@ -27,7 +27,7 @@ data class AnswerInlineQuery(
|
||||
val button: InlineQueryResultsButton? = null,
|
||||
) : SimpleRequest<Boolean> {
|
||||
constructor(
|
||||
inlineQueryID: InlineQueryIdentifier,
|
||||
inlineQueryID: InlineQueryId,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlinx.serialization.builtins.ListSerializer
|
||||
@Serializable
|
||||
data class AnswerShippingQueryOk(
|
||||
@SerialName(shippingQueryIdField)
|
||||
override val shippingQueryId: ShippingQueryIdentifier,
|
||||
override val shippingQueryId: ShippingQueryId,
|
||||
@Serializable(ShippingOptionsSerializer::class)
|
||||
@SerialName(shippingOptionsField)
|
||||
val shippingOptions: List<ShippingOption>
|
||||
@@ -30,7 +30,7 @@ object ShippingOptionsSerializer : KSerializer<List<ShippingOption>> by ListSeri
|
||||
@Serializable
|
||||
data class AnswerShippingQueryError(
|
||||
@SerialName(shippingQueryIdField)
|
||||
override val shippingQueryId: ShippingQueryIdentifier,
|
||||
override val shippingQueryId: ShippingQueryId,
|
||||
@SerialName(errorMessageField)
|
||||
val error: String
|
||||
) : AnswerShippingQuery {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.answers.payments.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.ShippingQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.ShippingQueryId
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@@ -10,6 +10,6 @@ interface AnswerShippingQuery : SimpleRequest<Boolean> {
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
|
||||
val shippingQueryId: ShippingQueryIdentifier
|
||||
val shippingQueryId: ShippingQueryId
|
||||
val isOk: Boolean
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package dev.inmo.tgbotapi.requests.edit.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineMessageId
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
interface EditInlineMessage : SimpleRequest<Boolean> {
|
||||
val inlineMessageId: InlineMessageIdentifier
|
||||
val inlineMessageId: InlineMessageId
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
}
|
||||
@@ -3,6 +3,3 @@ package dev.inmo.tgbotapi.requests.edit.abstracts
|
||||
import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer
|
||||
|
||||
interface EditLinkPreviewOptionsContainer : LinkPreviewOptionsContainer
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("EditLinkPreviewOptionsContainer", "dev.inmo.tgbotapi.requests.edit.abstracts.EditLinkPreviewOptionsContainer"))
|
||||
typealias EditDisableWebPagePreviewMessage = EditLinkPreviewOptionsContainer
|
||||
@@ -13,7 +13,7 @@ import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun EditInlineMessageCaption(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
@@ -26,7 +26,7 @@ fun EditInlineMessageCaption(
|
||||
)
|
||||
|
||||
fun EditInlineMessageCaption(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
entities: TextSourcesList,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = EditInlineMessageCaption(
|
||||
@@ -40,7 +40,7 @@ fun EditInlineMessageCaption(
|
||||
@Serializable
|
||||
data class EditInlineMessageCaption internal constructor(
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
override val inlineMessageId: InlineMessageId,
|
||||
@SerialName(captionField)
|
||||
override val text: String,
|
||||
@SerialName(parseModeField)
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlinx.serialization.*
|
||||
@Serializable
|
||||
data class EditInlineMessageLiveLocation(
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
override val inlineMessageId: InlineMessageId,
|
||||
@SerialName(latitudeField)
|
||||
override val latitude: Double,
|
||||
@SerialName(longitudeField)
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlinx.serialization.*
|
||||
@Serializable
|
||||
data class StopInlineMessageLiveLocation(
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
override val inlineMessageId: InlineMessageId,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : EditInlineMessage, EditReplyMessage {
|
||||
|
||||
@@ -10,7 +10,7 @@ import kotlinx.serialization.*
|
||||
@Serializable
|
||||
data class EditInlineMessageMedia(
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
override val inlineMessageId: InlineMessageId,
|
||||
@SerialName(mediaField)
|
||||
override val media: TelegramMedia,
|
||||
@SerialName(replyMarkupField)
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlinx.serialization.*
|
||||
@Serializable
|
||||
data class EditInlineMessageReplyMarkup(
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
override val inlineMessageId: InlineMessageId,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : EditInlineMessage, EditReplyMessage {
|
||||
|
||||
@@ -13,7 +13,7 @@ import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.*
|
||||
|
||||
fun EditInlineMessageText(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
@@ -28,7 +28,7 @@ fun EditInlineMessageText(
|
||||
)
|
||||
|
||||
fun EditInlineMessageText(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
inlineMessageId: InlineMessageId,
|
||||
entities: TextSourcesList,
|
||||
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
@@ -44,7 +44,7 @@ fun EditInlineMessageText(
|
||||
@Serializable
|
||||
data class EditInlineMessageText internal constructor(
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
override val inlineMessageId: InlineMessageId,
|
||||
@SerialName(textField)
|
||||
override val text: String,
|
||||
@SerialName(parseModeField)
|
||||
|
||||
@@ -10,7 +10,7 @@ data class GetGameHighScoresByInlineMessageId (
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier
|
||||
override val inlineMessageId: InlineMessageId
|
||||
) : GetGameHighScores, InlineMessageAction {
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
@@ -12,7 +12,7 @@ data class SetGameScoreByInlineMessageId (
|
||||
@SerialName(scoreField)
|
||||
override val score: Long,
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
override val inlineMessageId: InlineMessageId,
|
||||
@SerialName(forceField)
|
||||
override val force: Boolean = false,
|
||||
@SerialName(disableEditMessageField)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.requests.get
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.StickerSetName
|
||||
import dev.inmo.tgbotapi.types.nameField
|
||||
import dev.inmo.tgbotapi.types.stickerSetNameField
|
||||
import dev.inmo.tgbotapi.types.stickers.StickerSet
|
||||
@@ -9,7 +10,7 @@ import kotlinx.serialization.*
|
||||
@Serializable
|
||||
data class GetStickerSet(
|
||||
@SerialName(nameField)
|
||||
val name: String
|
||||
val name: StickerSetName
|
||||
): SimpleRequest<StickerSet> {
|
||||
override fun method(): String = "getStickerSet"
|
||||
override val resultDeserializer: DeserializationStrategy<StickerSet>
|
||||
|
||||
@@ -33,25 +33,6 @@ fun CopyMessages(
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
fun CopyMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
messageId: MessageId,
|
||||
vararg messageIds: MessageId,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
) = CopyMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
messageIds = (listOf(messageId) + messageIds.toList()),
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class CopyMessages (
|
||||
@SerialName(chatIdField)
|
||||
|
||||
@@ -8,7 +8,7 @@ import kotlinx.serialization.*
|
||||
|
||||
fun AddStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
stickerSetName: StickerSetName,
|
||||
inputSticker: InputSticker
|
||||
): Request<Boolean> {
|
||||
val data = AddStickerToSetData(userId, stickerSetName, inputSticker)
|
||||
@@ -21,12 +21,22 @@ fun AddStickerToSet(
|
||||
}
|
||||
}
|
||||
|
||||
fun AddStickerToSet(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
inputSticker: InputSticker
|
||||
): Request<Boolean> = AddStickerToSet(
|
||||
userId = userId,
|
||||
stickerSetName = StickerSetName(stickerSetName),
|
||||
inputSticker = inputSticker
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class AddStickerToSetData internal constructor(
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
override val name: StickerSetName,
|
||||
@SerialName(stickerField)
|
||||
override val inputSticker: InputSticker
|
||||
) : StandardStickerSetAction {
|
||||
|
||||
@@ -19,7 +19,7 @@ import kotlinx.serialization.encoding.Encoder
|
||||
*/
|
||||
fun CreateNewStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
name: StickerSetName,
|
||||
title: String,
|
||||
stickersFormat: StickerFormat,
|
||||
stickers: List<InputSticker>,
|
||||
@@ -53,6 +53,28 @@ fun CreateNewStickerSet(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Will create one of [CreateNewStickerSet] types based on the first element of [stickers]
|
||||
*
|
||||
* @param needsRepainting Will be used only if you are creating custom emojis sticker pack (by passing [stickers] with
|
||||
* type [InputSticker.WithKeywords.CustomEmoji])
|
||||
*/
|
||||
fun CreateNewStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
title: String,
|
||||
stickersFormat: StickerFormat,
|
||||
stickers: List<InputSticker>,
|
||||
needsRepainting: Boolean? = null
|
||||
) = CreateNewStickerSet(
|
||||
userId = userId,
|
||||
name = StickerSetName(name),
|
||||
title = title,
|
||||
stickersFormat = stickersFormat,
|
||||
stickers = stickers,
|
||||
needsRepainting = needsRepainting
|
||||
)
|
||||
|
||||
@Serializable(CreateNewStickerSetSerializer::class)
|
||||
sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
val stickerType: StickerType
|
||||
@@ -69,7 +91,7 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
@@ -86,7 +108,7 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
@@ -103,7 +125,7 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
@@ -123,7 +145,7 @@ sealed interface CreateNewStickerSet : CreateStickerSetAction {
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(nameField)
|
||||
override val name: String,
|
||||
override val name: StickerSetName,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(stickerFormatField)
|
||||
|
||||
@@ -8,7 +8,7 @@ import kotlinx.serialization.*
|
||||
|
||||
fun SetStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
stickerSetName: StickerSetName,
|
||||
thumbnail: MultipartFile
|
||||
): Request<Boolean> {
|
||||
return CommonMultipartFileRequest(
|
||||
@@ -17,6 +17,16 @@ fun SetStickerSetThumbnail(
|
||||
)
|
||||
}
|
||||
|
||||
fun SetStickerSetThumbnail(
|
||||
userId: UserId,
|
||||
stickerSetName: String,
|
||||
thumbnail: MultipartFile
|
||||
): Request<Boolean> = SetStickerSetThumbnail(
|
||||
userId = userId,
|
||||
stickerSetName = StickerSetName(stickerSetName),
|
||||
thumbnail = thumbnail
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SetStickerSetThumbnail (
|
||||
@SerialName(userIdField)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class CallbackQueryId(
|
||||
val string: String
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return string
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("CallbackQueryId", "dev.inmo.tgbotapi.types.CallbackQueryId"))
|
||||
typealias CallbackQueryIdentifier = CallbackQueryId
|
||||
@@ -26,13 +26,13 @@ sealed interface ChatIdentifier
|
||||
*/
|
||||
@Serializable(ChatIdentifierSerializer::class)
|
||||
sealed interface IdChatIdentifier : ChatIdentifier {
|
||||
abstract val chatId: Identifier
|
||||
abstract val chatId: RawChatId
|
||||
val threadId: MessageThreadId?
|
||||
get() = null
|
||||
|
||||
companion object {
|
||||
operator fun invoke(chatId: Identifier) = ChatId(chatId)
|
||||
operator fun invoke(chatId: Identifier, threadId: MessageThreadId?) = threadId ?.let {
|
||||
operator fun invoke(chatId: RawChatId) = ChatId(chatId)
|
||||
operator fun invoke(chatId: RawChatId, threadId: MessageThreadId?) = threadId ?.let {
|
||||
ChatIdWithThreadId(chatId, threadId)
|
||||
} ?: ChatId(chatId)
|
||||
}
|
||||
@@ -40,17 +40,17 @@ sealed interface IdChatIdentifier : ChatIdentifier {
|
||||
|
||||
@Serializable(ChatIdentifierSerializer::class)
|
||||
@JvmInline
|
||||
value class ChatId(override val chatId: Identifier) : IdChatIdentifier
|
||||
value class ChatId(override val chatId: RawChatId) : IdChatIdentifier
|
||||
|
||||
@Serializable(ChatIdentifierSerializer::class)
|
||||
@JvmInline
|
||||
value class ChatIdWithThreadId(val chatIdWithThreadId: Pair<Identifier, MessageThreadId>) : IdChatIdentifier {
|
||||
override val chatId: Identifier
|
||||
value class ChatIdWithThreadId(val chatIdWithThreadId: Pair<RawChatId, MessageThreadId>) : IdChatIdentifier {
|
||||
override val chatId: RawChatId
|
||||
get() = chatIdWithThreadId.first
|
||||
override val threadId: MessageThreadId
|
||||
get() = chatIdWithThreadId.second
|
||||
|
||||
constructor(chatId: Identifier, threadId: MessageThreadId): this(chatId to threadId)
|
||||
constructor(chatId: RawChatId, threadId: MessageThreadId): this(chatId to threadId)
|
||||
}
|
||||
|
||||
val ChatIdentifier.threadId: MessageThreadId?
|
||||
@@ -67,7 +67,7 @@ fun IdChatIdentifier.toChatWithThreadId(threadId: MessageThreadId) = IdChatIdent
|
||||
* https://core.telegram.org/bots/api#formatting-options
|
||||
*/
|
||||
@Warning("This API have restrictions in Telegram System")
|
||||
val Identifier.userLink: String
|
||||
val RawChatId.userLink: String
|
||||
get() = "$internalUserLinkBeginning$this"
|
||||
/**
|
||||
* https://core.telegram.org/bots/api#formatting-options
|
||||
@@ -80,23 +80,20 @@ val User.userLink: String
|
||||
|
||||
typealias UserId = ChatId
|
||||
|
||||
fun Identifier.toChatId(): ChatId = ChatId(this)
|
||||
fun Int.toChatId(): IdChatIdentifier = toLong().toChatId()
|
||||
fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId()
|
||||
fun RawChatId.toChatId(): ChatId = ChatId(this)
|
||||
fun Long.toChatId(): ChatId = ChatId(RawChatId(this))
|
||||
fun Int.toChatId(): IdChatIdentifier = RawChatId(toLong()).toChatId()
|
||||
fun Byte.toChatId(): IdChatIdentifier = RawChatId(toLong()).toChatId()
|
||||
|
||||
@Serializable(ChatIdentifierSerializer::class)
|
||||
@JvmInline
|
||||
value class Username(
|
||||
@Deprecated("Renamed", ReplaceWith("full"))
|
||||
val username: String
|
||||
) : ChatIdentifier {
|
||||
val full: String
|
||||
get() = username
|
||||
) : ChatIdentifier {
|
||||
val username: String
|
||||
get() = full
|
||||
val withoutAt
|
||||
get() = full.dropWhile { it == '@' }
|
||||
@Deprecated("Renamed", ReplaceWith("withoutAt"))
|
||||
val usernameWithoutAt
|
||||
get() = withoutAt
|
||||
|
||||
init {
|
||||
if (!full.startsWith("@")) {
|
||||
@@ -119,7 +116,7 @@ object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
|
||||
val id = internalSerializer.deserialize(decoder)
|
||||
|
||||
return id.longOrNull ?.let {
|
||||
ChatId(it)
|
||||
ChatId(RawChatId(it))
|
||||
} ?: id.content.let {
|
||||
if (!it.startsWith("@")) {
|
||||
Username("@$it")
|
||||
@@ -131,7 +128,7 @@ object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
|
||||
|
||||
override fun serialize(encoder: Encoder, value: ChatIdentifier) {
|
||||
when (value) {
|
||||
is IdChatIdentifier -> encoder.encodeLong(value.chatId)
|
||||
is IdChatIdentifier -> encoder.encodeLong(value.chatId.long)
|
||||
is Username -> encoder.encodeString(value.full)
|
||||
}
|
||||
}
|
||||
@@ -145,14 +142,14 @@ object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
|
||||
val id = internalSerializer.deserialize(decoder)
|
||||
|
||||
return id.longOrNull ?.let {
|
||||
ChatId(it)
|
||||
ChatId(RawChatId(it))
|
||||
} ?:let {
|
||||
val splitted = id.content.split("/")
|
||||
if (splitted.size == 2) {
|
||||
val (chatId, threadId) = splitted
|
||||
ChatIdWithThreadId(
|
||||
chatId.toLongOrNull() ?: return@let null,
|
||||
threadId.toLongOrNull() ?: return@let null
|
||||
chatId.toLongOrNull() ?.let(::RawChatId) ?: return@let null,
|
||||
threadId.toLongOrNull() ?.let(::MessageThreadId) ?: return@let null
|
||||
)
|
||||
} else {
|
||||
null
|
||||
@@ -168,7 +165,7 @@ object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
|
||||
|
||||
override fun serialize(encoder: Encoder, value: ChatIdentifier) {
|
||||
when (value) {
|
||||
is ChatId -> encoder.encodeLong(value.chatId)
|
||||
is ChatId -> encoder.encodeLong(value.chatId.long)
|
||||
is ChatIdWithThreadId -> encoder.encodeString("${value.chatId}/${value.threadId}")
|
||||
is Username -> encoder.encodeString(value.full)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ data class ChatPhoto(
|
||||
@SerialName(bigFileIdField)
|
||||
val bigFileId: String,
|
||||
@SerialName(smallFileUniqueIdField)
|
||||
val smallFileUniqueId: FileUniqueId,
|
||||
val smallFileUniqueId: TgFileUniqueId,
|
||||
@SerialName(bigFileUniqueIdField)
|
||||
val bigFileUniqueId: FileUniqueId
|
||||
val bigFileUniqueId: TgFileUniqueId
|
||||
)
|
||||
|
||||
@@ -1,55 +1,19 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import dev.inmo.tgbotapi.utils.BuiltinMimeTypes
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
typealias Identifier = Long
|
||||
typealias MessageId = Long
|
||||
typealias MessageThreadId = Long
|
||||
typealias MessageIdentifier = MessageId
|
||||
typealias InlineQueryIdentifier = String
|
||||
typealias UpdateIdentifier = Long
|
||||
typealias MediaGroupIdentifier = String
|
||||
typealias ForwardSignature = String
|
||||
typealias ForwardSenderName = String
|
||||
typealias AuthorSignature = ForwardSignature
|
||||
typealias CallbackQueryIdentifier = String
|
||||
typealias PaymentQueryIdentifier = String
|
||||
typealias PreCheckoutQueryId = String
|
||||
typealias ShippingQueryIdentifier = String
|
||||
typealias InvoicePayload = String
|
||||
typealias ShippingOptionIdentifier = String
|
||||
typealias StartParameter = String
|
||||
typealias InlineMessageIdentifier = String
|
||||
typealias PollIdentifier = String
|
||||
typealias StickerSetName = String
|
||||
typealias FileUniqueId = String
|
||||
typealias DiceResult = Int
|
||||
typealias FoursquareId = String
|
||||
typealias FoursquareType = String
|
||||
typealias GooglePlaceId = String
|
||||
typealias GooglePlaceType = String
|
||||
typealias MembersLimit = Int
|
||||
typealias WebAppQueryId = String
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class CustomEmojiId(
|
||||
val string: String
|
||||
) {
|
||||
val appLink
|
||||
get() = "${internalTgAppLinksBeginning}emoji?id=$this"
|
||||
}
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class StoryId(
|
||||
val long: Long
|
||||
)
|
||||
|
||||
typealias Seconds = Int
|
||||
typealias MilliSeconds = Long
|
||||
@@ -59,70 +23,6 @@ typealias UnixTimeStamp = LongSeconds
|
||||
typealias Meters = Float
|
||||
typealias Degrees = Int
|
||||
|
||||
@Serializable(StickerType.Serializer::class)
|
||||
sealed interface StickerType {
|
||||
val type: String
|
||||
|
||||
@Serializable
|
||||
object Regular : StickerType { override val type: String = "regular" }
|
||||
@Serializable
|
||||
object Mask : StickerType { override val type: String = "mask" }
|
||||
@Serializable
|
||||
object CustomEmoji : StickerType { override val type: String = "custom_emoji" }
|
||||
@Serializable
|
||||
data class Unknown(override val type: String = "custom_emoji") : StickerType
|
||||
|
||||
object Serializer : KSerializer<StickerType> {
|
||||
override val descriptor: SerialDescriptor = String.serializer().descriptor
|
||||
|
||||
override fun deserialize(decoder: Decoder): StickerType {
|
||||
return when (val type = decoder.decodeString()) {
|
||||
Regular.type -> Regular
|
||||
Mask.type -> Mask
|
||||
CustomEmoji.type -> CustomEmoji
|
||||
else -> Unknown(type)
|
||||
}
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: StickerType) {
|
||||
encoder.encodeString(value.type)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable(StickerFormat.Serializer::class)
|
||||
sealed interface StickerFormat {
|
||||
val type: String
|
||||
|
||||
@Serializable
|
||||
object Static : StickerFormat { override val type: String = "static" }
|
||||
@Serializable
|
||||
object Animated : StickerFormat { override val type: String = "animated" }
|
||||
@Serializable
|
||||
object Video : StickerFormat { override val type: String = "video" }
|
||||
@Serializable
|
||||
data class Unknown(override val type: String = "custom_emoji") : StickerFormat
|
||||
|
||||
object Serializer : KSerializer<StickerFormat> {
|
||||
override val descriptor: SerialDescriptor = String.serializer().descriptor
|
||||
|
||||
override fun deserialize(decoder: Decoder): StickerFormat {
|
||||
return when (val type = decoder.decodeString()) {
|
||||
Static.type -> Static
|
||||
Animated.type -> Animated
|
||||
Video.type -> Video
|
||||
else -> Unknown(type)
|
||||
}
|
||||
}
|
||||
|
||||
override fun serialize(encoder: Encoder, value: StickerFormat) {
|
||||
encoder.encodeString(value.type)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
val usernameRegex = Regex("@[\\w\\d_]+")
|
||||
|
||||
val degreesLimit = 1 .. 360
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class CustomEmojiId(
|
||||
val string: String
|
||||
) {
|
||||
val appLink
|
||||
get() = "${internalTgAppLinksBeginning}emoji?id=$this"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class InlineMessageId(
|
||||
val string: String
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return string
|
||||
}
|
||||
}
|
||||
@Deprecated("Renamed", ReplaceWith("InlineMessageId", "dev.inmo.tgbotapi.types.InlineMessageId"))
|
||||
typealias InlineMessageIdentifier = InlineMessageId
|
||||
@@ -7,9 +7,9 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class BaseChosenInlineResult(
|
||||
override val resultId: InlineQueryIdentifier,
|
||||
override val resultId: InlineQueryId,
|
||||
@SerialName(fromField)
|
||||
override val from: User,
|
||||
override val inlineMessageId: InlineMessageIdentifier?,
|
||||
override val inlineMessageId: InlineMessageId?,
|
||||
override val query: String
|
||||
) : ChosenInlineResult
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.FromUser
|
||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineMessageId
|
||||
import dev.inmo.tgbotapi.types.InlineQueryId
|
||||
|
||||
sealed interface ChosenInlineResult : FromUser {
|
||||
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
|
||||
val inlineMessageId: InlineMessageIdentifier?
|
||||
val resultId: InlineQueryId //chosen temporary, can be changed
|
||||
val inlineMessageId: InlineMessageId?
|
||||
val query: String
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class LocationChosenInlineResult(
|
||||
override val resultId: InlineQueryIdentifier,
|
||||
override val resultId: InlineQueryId,
|
||||
@SerialName(fromField)
|
||||
override val from: User,
|
||||
val location: StaticLocation,
|
||||
override val inlineMessageId: InlineMessageIdentifier?,
|
||||
override val inlineMessageId: InlineMessageId?,
|
||||
override val query: String
|
||||
) : ChosenInlineResult
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
internal data class RawChosenInlineResult(
|
||||
@SerialName(resultIdField)
|
||||
val resultId: InlineQueryIdentifier, //chosen temporary, can be changed
|
||||
val resultId: InlineQueryId, //chosen temporary, can be changed
|
||||
@SerialName(fromField)
|
||||
val user: User,
|
||||
@SerialName(queryField)
|
||||
@@ -17,7 +17,7 @@ internal data class RawChosenInlineResult(
|
||||
@SerialName(locationField)
|
||||
val location: StaticLocation? = null,
|
||||
@SerialName(inlineMessageIdField)
|
||||
val inlineMessageId: InlineMessageIdentifier? = null
|
||||
val inlineMessageId: InlineMessageId? = null
|
||||
) {
|
||||
val asChosenInlineResult: ChosenInlineResult by lazy {
|
||||
location ?.let {
|
||||
|
||||
@@ -10,7 +10,7 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
class InlineQueryResultArticle(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(titleField)
|
||||
override val title: String,
|
||||
@SerialName(inputMessageContentField)
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultAudioCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
@@ -26,7 +26,7 @@ fun InlineQueryResultAudioCachedImpl(
|
||||
) = InlineQueryResultAudioCachedImpl(id, fileId, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultAudioCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
entities: TextSourcesList,
|
||||
replyMarkup: InlineKeyboardMarkup? = null,
|
||||
@@ -44,7 +44,7 @@ fun InlineQueryResultAudioCachedImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultAudioCachedImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(audioFileIdField)
|
||||
override val fileId: FileId,
|
||||
@SerialName(captionField)
|
||||
|
||||
@@ -16,7 +16,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultAudioImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
title: String,
|
||||
performer: String? = null,
|
||||
@@ -28,7 +28,7 @@ fun InlineQueryResultAudioImpl(
|
||||
) = InlineQueryResultAudioImpl(id, url, title, performer, duration, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultAudioImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
title: String,
|
||||
performer: String? = null,
|
||||
@@ -52,7 +52,7 @@ fun InlineQueryResultAudioImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultAudioImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(audioUrlField)
|
||||
override val url: String,
|
||||
@SerialName(titleField)
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class InlineQueryResultContact(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(phoneNumberField)
|
||||
override val phoneNumber: String,
|
||||
@SerialName(firstNameField)
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultDocumentCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String,
|
||||
description: String? = null,
|
||||
@@ -28,7 +28,7 @@ fun InlineQueryResultDocumentCachedImpl(
|
||||
) = InlineQueryResultDocumentCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultDocumentCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String,
|
||||
description: String? = null,
|
||||
@@ -50,7 +50,7 @@ fun InlineQueryResultDocumentCachedImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultDocumentCachedImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(documentFileIdField)
|
||||
override val fileId: FileId,
|
||||
@SerialName(titleField)
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultDocumentImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
title: String,
|
||||
mimeType: MimeType,
|
||||
@@ -32,7 +32,7 @@ fun InlineQueryResultDocumentImpl(
|
||||
) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbnailUrl, thumbnailWidth, thumbnailHeight, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultDocumentImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
title: String,
|
||||
mimeType: MimeType,
|
||||
@@ -62,7 +62,7 @@ fun InlineQueryResultDocumentImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultDocumentImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(documentUrlField)
|
||||
override val url: String,
|
||||
@SerialName(titleField)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
||||
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineQueryId
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.gameShortNameField
|
||||
import kotlinx.serialization.SerialName
|
||||
@@ -9,7 +9,7 @@ import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
class InlineQueryResultGame(
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(gameShortNameField)
|
||||
val gameShortName: String,
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultGifCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String? = null,
|
||||
text: String? = null,
|
||||
@@ -27,7 +27,7 @@ fun InlineQueryResultGifCachedImpl(
|
||||
) = InlineQueryResultGifCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultGifCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String? = null,
|
||||
entities: TextSourcesList,
|
||||
@@ -47,7 +47,7 @@ fun InlineQueryResultGifCachedImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultGifCachedImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(gifFileIdField)
|
||||
override val fileId: FileId,
|
||||
@SerialName(titleField)
|
||||
|
||||
@@ -18,7 +18,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultGifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
@@ -33,7 +33,7 @@ fun InlineQueryResultGifImpl(
|
||||
) = InlineQueryResultGifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultGifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
@@ -61,7 +61,7 @@ fun InlineQueryResultGifImpl(
|
||||
)
|
||||
|
||||
fun InlineQueryResultGifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
gifFile: FileId,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
@@ -76,7 +76,7 @@ fun InlineQueryResultGifImpl(
|
||||
) = InlineQueryResultGifImpl(id, gifFile.fileId, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultGifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
gifFile: FileId,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
@@ -94,7 +94,7 @@ fun InlineQueryResultGifImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultGifImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(gifUrlField)
|
||||
override val url: String,
|
||||
@SerialName(thumbnailUrlField)
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class InlineQueryResultLocation(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(latitudeField)
|
||||
override val latitude: Double,
|
||||
@SerialName(longitudeField)
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultMpeg4GifCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String? = null,
|
||||
text: String? = null,
|
||||
@@ -27,7 +27,7 @@ fun InlineQueryResultMpeg4GifCachedImpl(
|
||||
) = InlineQueryResultMpeg4GifCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultMpeg4GifCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String? = null,
|
||||
entities: TextSourcesList,
|
||||
@@ -47,7 +47,7 @@ fun InlineQueryResultMpeg4GifCachedImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultMpeg4GifCachedImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(mpeg4GifFileIdField)
|
||||
override val fileId: FileId,
|
||||
@SerialName(titleField)
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultMpeg4GifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
@@ -32,7 +32,7 @@ fun InlineQueryResultMpeg4GifImpl(
|
||||
) = InlineQueryResultMpeg4GifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultMpeg4GifImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
thumbnailUrl: String,
|
||||
thumbnailMimeType: MimeType? = null,
|
||||
@@ -62,7 +62,7 @@ fun InlineQueryResultMpeg4GifImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultMpeg4GifImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(mpeg4GifUrlField)
|
||||
override val url: String,
|
||||
@SerialName(thumbnailUrlField)
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultPhotoCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
@@ -28,7 +28,7 @@ fun InlineQueryResultPhotoCachedImpl(
|
||||
) = InlineQueryResultPhotoCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultPhotoCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String? = null,
|
||||
description: String? = null,
|
||||
@@ -50,7 +50,7 @@ fun InlineQueryResultPhotoCachedImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultPhotoCachedImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(photoFileIdField)
|
||||
override val fileId: FileId,
|
||||
@SerialName(titleField)
|
||||
|
||||
@@ -16,7 +16,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultPhotoImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
thumbnailUrl: String,
|
||||
width: Int? = null,
|
||||
@@ -30,7 +30,7 @@ fun InlineQueryResultPhotoImpl(
|
||||
) = InlineQueryResultPhotoImpl(id, url, thumbnailUrl, width, height, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultPhotoImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
thumbnailUrl: String,
|
||||
width: Int? = null,
|
||||
@@ -58,7 +58,7 @@ fun InlineQueryResultPhotoImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultPhotoImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(photoUrlField)
|
||||
override val url: String,
|
||||
@SerialName(thumbnailUrlField)
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class InlineQueryResultStickerCached(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(stickerFileIdField)
|
||||
override val fileId: FileId,
|
||||
@SerialName(replyMarkupField)
|
||||
|
||||
@@ -12,7 +12,7 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class InlineQueryResultVenue(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(latitudeField)
|
||||
override val latitude: Double,
|
||||
@SerialName(longitudeField)
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultVideoCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String,
|
||||
description: String? = null,
|
||||
@@ -28,7 +28,7 @@ fun InlineQueryResultVideoCachedImpl(
|
||||
) = InlineQueryResultVideoCachedImpl(id, fileId, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultVideoCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String,
|
||||
description: String? = null,
|
||||
@@ -50,7 +50,7 @@ fun InlineQueryResultVideoCachedImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultVideoCachedImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(videoFileIdField)
|
||||
override val fileId: FileId,
|
||||
@SerialName(titleField)
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultVideoImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
thumbnailUrl: String,
|
||||
mimeType: MimeType,
|
||||
@@ -33,7 +33,7 @@ fun InlineQueryResultVideoImpl(
|
||||
) = InlineQueryResultVideoImpl(id, url, thumbnailUrl, mimeType, title, width, height, duration, description, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultVideoImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
thumbnailUrl: String,
|
||||
mimeType: MimeType,
|
||||
@@ -65,7 +65,7 @@ fun InlineQueryResultVideoImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultVideoImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(videoUrlField)
|
||||
override val url: String,
|
||||
@SerialName(thumbnailUrlField)
|
||||
|
||||
@@ -17,7 +17,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultVoiceCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String,
|
||||
text: String? = null,
|
||||
@@ -27,7 +27,7 @@ fun InlineQueryResultVoiceCachedImpl(
|
||||
) = InlineQueryResultVoiceCachedImpl(id, fileId, title, text, parseMode, null, replyMarkup, inputMessageContent)
|
||||
|
||||
fun InlineQueryResultVoiceCachedImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
fileId: FileId,
|
||||
title: String,
|
||||
entities: TextSourcesList,
|
||||
@@ -47,7 +47,7 @@ fun InlineQueryResultVoiceCachedImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultVoiceCachedImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(voiceFileIdField)
|
||||
override val fileId: FileId,
|
||||
@SerialName(titleField)
|
||||
|
||||
@@ -16,7 +16,7 @@ import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
fun InlineQueryResultVoiceImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
title: String,
|
||||
duration: Int? = null,
|
||||
@@ -37,7 +37,7 @@ fun InlineQueryResultVoiceImpl(
|
||||
)
|
||||
|
||||
fun InlineQueryResultVoiceImpl(
|
||||
id: InlineQueryIdentifier,
|
||||
id: InlineQueryId,
|
||||
url: String,
|
||||
title: String,
|
||||
duration: Int? = null,
|
||||
@@ -59,7 +59,7 @@ fun InlineQueryResultVoiceImpl(
|
||||
@Serializable
|
||||
data class InlineQueryResultVoiceImpl internal constructor(
|
||||
@SerialName(idField)
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
@SerialName(voiceUrlField)
|
||||
override val url: String,
|
||||
@SerialName(titleField)
|
||||
|
||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
|
||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineQueryId
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -10,6 +10,6 @@ import kotlinx.serialization.Serializable
|
||||
@ClassCastsIncluded(excludeRegex = ".*Impl")
|
||||
interface InlineQueryResult {
|
||||
val type: String
|
||||
val id: InlineQueryIdentifier
|
||||
val id: InlineQueryId
|
||||
val replyMarkup: InlineKeyboardMarkup?
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.query
|
||||
|
||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.InlineQueryId
|
||||
import dev.inmo.tgbotapi.types.chat.ChatType
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
|
||||
data class BaseInlineQuery(
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
override val from: CommonUser,
|
||||
override val query: String,
|
||||
override val offset: String,
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.query
|
||||
|
||||
import dev.inmo.tgbotapi.abstracts.FromUser
|
||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineQueryId
|
||||
import dev.inmo.tgbotapi.types.chat.ChatType
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
|
||||
sealed interface InlineQuery : FromUser {
|
||||
val id: InlineQueryIdentifier
|
||||
val id: InlineQueryId
|
||||
val query: String
|
||||
val offset: String
|
||||
val chatType: ChatType?
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.query
|
||||
|
||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.InlineQueryId
|
||||
import dev.inmo.tgbotapi.types.chat.ChatType
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
|
||||
data class LocationInlineQuery(
|
||||
override val id: InlineQueryIdentifier,
|
||||
override val id: InlineQueryId,
|
||||
override val from: CommonUser,
|
||||
override val query: String,
|
||||
override val offset: String,
|
||||
|
||||
@@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.types.InlineQueries.query
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -10,7 +9,7 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
internal data class RawInlineQuery(
|
||||
@SerialName(idField)
|
||||
val id: InlineQueryIdentifier,
|
||||
val id: InlineQueryId,
|
||||
@SerialName(fromField)
|
||||
val from: CommonUser,
|
||||
@SerialName(queryField)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class InlineQueryId(
|
||||
val string: String
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return string
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("InlineQueryId", "dev.inmo.tgbotapi.types.InlineQueryId"))
|
||||
typealias InlineQueryIdentifier = InlineQueryId
|
||||
@@ -0,0 +1,17 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class MediaGroupId(
|
||||
val string: String
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return string
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("MediaGroupId", "dev.inmo.tgbotapi.types.MediaGroupId"))
|
||||
typealias MediaGroupIdentifier = MediaGroupId
|
||||
@@ -1,24 +1,41 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import kotlinx.serialization.json.*
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
object MessageIdSerializer : KSerializer<MessageId> {
|
||||
override val descriptor: SerialDescriptor = JsonObject.serializer().descriptor
|
||||
|
||||
override fun deserialize(decoder: Decoder): MessageId = JsonObject.serializer().deserialize(decoder)[messageIdField]!!.jsonPrimitive.long
|
||||
override fun deserialize(decoder: Decoder): MessageId = JsonObject.serializer().deserialize(decoder)[messageIdField]!!.jsonPrimitive.long.asTelegramMessageId()
|
||||
|
||||
override fun serialize(encoder: Encoder, value: MessageId) {
|
||||
JsonObject.serializer().serialize(
|
||||
encoder,
|
||||
JsonObject(
|
||||
mapOf(
|
||||
messageIdField to JsonPrimitive(value)
|
||||
messageIdField to JsonPrimitive(value.long)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class MessageId(
|
||||
val long: Long
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return long.toString()
|
||||
}
|
||||
}
|
||||
|
||||
fun Long.asTelegramMessageId() = MessageId(this)
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("MessageId", "dev.inmo.tgbotapi.types.MessageId"))
|
||||
typealias MessageIdentifier = MessageId
|
||||
@@ -0,0 +1,14 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class MessageThreadId(
|
||||
val long: Long
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return long.toString()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class PollId(
|
||||
val string: String
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return string
|
||||
}
|
||||
}
|
||||
@Deprecated("Renamed", ReplaceWith("PollId", "dev.inmo.tgbotapi.types.PollId"))
|
||||
typealias PollIdentifier = String
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user