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