1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-27 08:29:19 +00:00

Compare commits

..

64 Commits

Author SHA1 Message Date
3ebaef0789 update korlibs 2024-03-01 23:19:05 +06:00
51bb0a021f update dependencies 2024-03-01 23:15:42 +06:00
b7c1692efa start 10.1.1 2024-03-01 23:09:12 +06:00
bce5fb658c Merge pull request #827 from InsanusMokrassar/10.1.0
10.1.0
2024-02-17 01:57:17 +06:00
b9bc40187f fixes in changelog and readme 2024-02-17 01:53:00 +06:00
3da4ee4808 make Story to be data class 2024-02-17 01:46:26 +06:00
6571e8f592 update dependencies 2024-02-16 23:29:29 +06:00
5c13047a0b add support of custom_emoji_sticker_set_name 2024-02-16 21:59:10 +06:00
4908bb2cfe add support of unrestrict_boost_count 2024-02-16 21:57:03 +06:00
a01ca43837 add support of Story content and reply_to_story field 2024-02-16 21:54:13 +06:00
a9a01e3154 add support of sender_boost_count 2024-02-16 21:38:28 +06:00
468c54a30f add support of ChatBoostAdded 2024-02-16 21:13:37 +06:00
9177e01910 start 10.1.0 2024-02-16 19:39:20 +06:00
417f72af4a Merge pull request #825 from InsanusMokrassar/10.0.1
10.0.1
2024-02-10 22:04:37 +06:00
df6d70b20d update dependencies 2024-02-10 17:31:20 +06:00
0b12df14db start 10.0.1 2024-02-06 22:49:15 +06:00
1590e1eef2 Merge pull request #818 from InsanusMokrassar/10.0.0
10.0.0 hotfix: add support of 'sender' chat type
2024-01-12 14:21:55 +06:00
6896bc0772 add support of 'sender' chat type 2024-01-12 14:21:06 +06:00
ce1abb0ae2 Merge pull request #814 from InsanusMokrassar/10.0.0
10.0.0
2024-01-12 12:45:49 +06:00
ac63d52b14 add notes about telegram bots api 7.0 support 2024-01-12 02:44:30 +06:00
e902f85b36 fixes in build 2024-01-12 02:21:22 +06:00
225fedde3a several more fixes 2024-01-12 02:14:46 +06:00
66e31e5d0c fixes in AccessibleMessage -> Message in several old parts 2024-01-12 01:53:40 +06:00
852065ad38 get back LinksFormatting for Message 2024-01-12 01:44:56 +06:00
d88fc2c9c0 rename replyInChat -> replyInChatId; replace AccessibleMessage by Message in Reply parts 2024-01-12 01:18:33 +06:00
4d92588390 update changelog 2024-01-12 01:11:57 +06:00
89524290c5 improve users shared DSLs 2024-01-10 23:05:54 +06:00
86c86dfb8a fixes in LinkPreviewOptions 2024-01-10 16:46:36 +06:00
bdae774c62 add EncodeDefault for required fields in LinkPreviewOptions 2024-01-10 14:59:41 +06:00
d70c7fdbdf fixes related to UsersShared 2024-01-09 18:21:20 +06:00
f14885a541 fix in LinkPreviewOptions.Surrogate 2024-01-09 18:05:03 +06:00
0013e91f6e fix of build and add annotation to all fields with one 2024-01-09 17:52:13 +06:00
aa315f6fec rename LinkPreviewOptions.Medium to LinkPreviewOptions.Default 2024-01-09 17:34:07 +06:00
9425380002 imrovements in copy/delete/forward messages 2024-01-09 17:03:47 +06:00
0f5bce592b replace username to full 2024-01-09 11:45:12 +06:00
294f80032c rename ScheduledGiveaway -> Giveaway 2024-01-09 11:43:04 +06:00
a4064a15ec add trigger for ChatMessageReactionsCountUpdated 2024-01-09 11:33:26 +06:00
7e5064ba3c fix in LinkPreviewOptions surrogate 2024-01-08 19:22:26 +06:00
eac45b86a6 fixes in LinkPreviewOptions 2024-01-08 19:16:17 +06:00
f0448485c8 add defaults to setMessageReaction 2024-01-08 18:56:21 +06:00
f2308f0312 update setMessageReaction 2024-01-08 18:49:04 +06:00
76a2cfd1a0 Merge pull request #817 from mefilt/master
Fixed incorrect link at readme
2024-01-08 16:34:38 +06:00
Mefilt
edca5494d4 Fixed incorrect link at readme 2024-01-08 18:29:59 +08:00
d480c9efd6 fixes in replies with chats and messages 2024-01-08 15:43:11 +06:00
a106068af4 fixes in reactions 2024-01-08 15:13:51 +06:00
d55253a81b improvements in replies 2024-01-08 15:02:39 +06:00
adede330fb fix of testSources in TextQuote 2024-01-08 13:55:41 +06:00
f2f370e40e update all updates list 2024-01-08 10:11:39 +06:00
86bb87bb37 make allowSendingWithoutReply nullable 2024-01-08 10:05:41 +06:00
bb80eb43fd build fixes 2024-01-08 00:42:24 +06:00
a692ed65f3 almost add reply parameters 2024-01-07 22:42:46 +06:00
60e50f9492 improvements in Username 2024-01-07 21:56:31 +06:00
e28f3492ef add ReplyParameters 2024-01-07 21:54:56 +06:00
f637b480b1 add TextQuote 2024-01-07 20:51:29 +06:00
955e9ca871 fix of #816 2024-01-07 20:05:05 +06:00
8df72edd52 fixes of build 2024-01-07 20:00:07 +06:00
f3b05bbffd add support of external_reply in RawMessage 2024-01-07 19:38:22 +06:00
95011e2b3e add MessageOrigin serializer 2024-01-07 19:19:59 +06:00
cad0bf8a95 add ExternalReplyInfo 2024-01-07 19:04:23 +06:00
f760e60089 fixes in typing of giveaways 2024-01-07 17:40:41 +06:00
6c76e1c47a add support of MessageOrigin 2024-01-07 17:12:37 +06:00
b5f4219635 fixes in inaccessible message support 2024-01-07 15:52:49 +06:00
5190f7b856 add support of inaccessible message 2024-01-07 15:21:32 +06:00
14756fd6e8 add support of has_visible_history field 2024-01-07 15:16:33 +06:00
197 changed files with 3768 additions and 2126 deletions

View File

@@ -1,11 +1,47 @@
# TelegramBotAPI changelog
## 10.1.1
* `Version`:
* `Serialization`: `1.6.2` -> `1.6.3`
* `MicroUtils`: `0.20.34` -> `0.20.37`
* `Korlibs`: `5.3.1` -> `5.3.2`
## 10.1.0
**Add support of [Telegram Bots API 7.1](https://core.telegram.org/bots/api-changelog#february-16-2024)**
* `Version`:
* `Coroutines`: `1.7.3` -> `1.8.0`
* `MicroUtils`: `0.20.32` -> `0.20.34`
## 10.0.1
* `Version`:
* `Ktor`: `2.3.7` -> `2.3.8`
* `MicroUtils`: `0.20.26` -> `0.20.32`
* `Korlibs`: `5.3.0` -> `5.3.1`
* `KSLog`: `1.3.1` -> `1.3.2`
## 10.0.0
**Add support of [Telegram Bots API 7.0](https://core.telegram.org/bots/api-changelog#december-29-2023)**
**IN THIS UPDATE KLOCK DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-time` UP TO 5.3.0 VERSION**
**IN THIS UPDATE KRYPTO DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-crypto` UP TO 5.3.0 VERSION**
* `Version`:
* `MicroUtils`: `0.20.23` -> `0.20.26`
* `Korlibs`: `4.0.10` -> `5.3.0`
* `Core`:
* `Message` now inherited by two variants: `AccessibleMessage` and `InaccessibleMessage`
* `Common`:
* In most places `disableWebPagePreview` has been replaced by new `LinkPreviewOptions`
* In most places arguments `replyToMessageId` and `allowSendingWithoutReply` has been replaced with
`ReplyParameters`
* In `reply` extension two parameters have been added: `replyInChatId` and `replyInThreadId`
## 9.4.3
**IetfLanguageCode has been renamed to IetfLang in MicroUtils**

View File

@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-6.9-blue)](https://core.telegram.org/bots/api-changelog#september-22-2023)
# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-7.1-blue)](https://core.telegram.org/bots/api-changelog#february-16-2024)
| Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
@@ -118,5 +118,5 @@ suspend fun main() {
### More examples
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
always welcome in our [bookstack](https://bookstack.inmo.dev/books/telegrambotapi) and
always welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and
[chat](https://t.me/InMoTelegramBotAPIChat).

View File

@@ -54,13 +54,13 @@ if (new File(projectDir, "secret.gradle").exists()) {
githubRelease {
token "${project.property('GITHUB_RELEASE_TOKEN')}"
owner "InsanusMokrassar"
repo "TelegramBotAPI"
owner = "InsanusMokrassar"
repo = "TelegramBotAPI"
tagName "v$library_version"
releaseName "$library_version"
targetCommitish "$library_version"
tagName = "v$library_version"
releaseName = "$library_version"
targetCommitish = "$library_version"
body getCurrentVersionChangelog()
body = getCurrentVersionChangelog()
}
}

View File

@@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true
library_group=dev.inmo
library_version=10.0.0
library_version=10.1.1

View File

@@ -1,24 +1,24 @@
[versions]
kotlin = "1.9.22"
kotlin-serialization = "1.6.2"
kotlin-coroutines = "1.7.3"
kotlin-serialization = "1.6.3"
kotlin-coroutines = "1.8.0"
javax-activation = "1.1.1"
korlibs = "5.3.0"
korlibs = "5.3.2"
uuid = "0.8.2"
ktor = "2.3.7"
ktor = "2.3.8"
ksp = "1.9.22-1.0.16"
kotlin-poet = "1.15.3"
ksp = "1.9.22-1.0.18"
kotlin-poet = "1.16.0"
microutils = "0.20.25"
kslog = "1.3.1"
microutils = "0.20.37"
kslog = "1.3.2"
versions = "0.50.0"
versions = "0.51.0"
github-release-plugin = "2.4.1"
github-release-plugin = "2.5.2"
dokka = "1.9.10"
[libraries]

View File

@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip

View File

@@ -16,6 +16,9 @@ kotlin {
api project(":tgbotapi.core")
}
}
configureEach {
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
}
}
}

View File

@@ -6,9 +6,8 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
suspend fun TelegramBot.deleteMessage(
chatId: ChatIdentifier,
@@ -23,7 +22,7 @@ suspend fun TelegramBot.deleteMessage(
) = deleteMessage(chat.id, messageId)
suspend fun TelegramBot.deleteMessage(
message: Message
message: AccessibleMessage
): Boolean {
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
if (mediaGroupContent == null) {
@@ -46,9 +45,9 @@ suspend fun TelegramBot.delete(
) = deleteMessage(chat, messageId)
suspend fun TelegramBot.delete(
message: Message
message: AccessibleMessage
) = deleteMessage(message)
suspend fun Message.delete(
suspend fun AccessibleMessage.delete(
requestsExecutor: TelegramBot
) = requestsExecutor.deleteMessage(this)

View File

@@ -1,11 +1,11 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.DeleteMessage
import dev.inmo.tgbotapi.requests.DeleteMessages
import dev.inmo.tgbotapi.requests.ForwardMessages
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import kotlin.jvm.JvmName
suspend fun TelegramBot.deleteMessages(
chatId: ChatIdentifier,
@@ -37,14 +37,19 @@ suspend fun TelegramBot.deleteMessages(
)
suspend fun TelegramBot.deleteMessages(
messages: List<Message>
) = messages.groupBy { it.chat }.map { (chat, messages) ->
messagesMetas: List<Message.MetaInfo>
) = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
deleteMessages(
chatId = chat.id,
chatId = chatId,
messageIds = messages.map { it.messageId }
)
}.all { it }
@JvmName("deleteMessagesWithMessages")
suspend fun TelegramBot.deleteMessages(
messages: List<AccessibleMessage>
) = deleteMessages(messages.map { it.metaInfo })
suspend fun TelegramBot.delete(
chatId: ChatIdentifier,
messageIds: List<MessageId>
@@ -62,6 +67,12 @@ suspend fun TelegramBot.delete(
vararg messageIds: MessageId
) = deleteMessages(chatId = chatId, messageIds = (listOf(firstMessageId, secondMessageId) + messageIds.toList()))
suspend fun TelegramBot.delete(
messages: List<Message>
messagesMetas: List<Message.MetaInfo>
) = deleteMessages(messagesMetas)
@JvmName("deleteWithMessages")
suspend fun TelegramBot.delete(
messages: List<AccessibleMessage>
) = deleteMessages(messages)

View File

@@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.threadId
suspend fun TelegramBot.forwardMessage(
@@ -49,7 +49,7 @@ suspend fun TelegramBot.forwardMessage(
suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier,
message: Message,
message: AccessibleMessage,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false
@@ -57,7 +57,7 @@ suspend fun TelegramBot.forwardMessage(
suspend fun TelegramBot.forwardMessage(
toChat: Chat,
message: Message,
message: AccessibleMessage,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false

View File

@@ -1,9 +1,12 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.send.copyMessages
import dev.inmo.tgbotapi.requests.ForwardMessages
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import kotlin.jvm.JvmName
suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier,
@@ -66,15 +69,15 @@ suspend fun TelegramBot.forwardMessages(
suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier,
messages: List<Message>,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = messages.groupBy { it.chat }.flatMap { (chat, messages) ->
) = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) ->
forwardMessages(
toChatId = toChatId,
fromChatId = chat.id,
fromChatId = chatId,
messageIds = messages.map { it.messageId },
threadId = threadId,
disableNotification = disableNotification,
@@ -83,6 +86,23 @@ suspend fun TelegramBot.forwardMessages(
)
}
@JvmName("forwardMessagesWithMessages")
suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = forwardMessages(
toChatId = toChatId,
messagesMetas = messages.map { it.metaInfo },
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.forward(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
@@ -141,7 +161,24 @@ suspend fun TelegramBot.forward(
suspend fun TelegramBot.forward(
toChatId: ChatIdentifier,
messages: List<Message>,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = forwardMessages(
toChatId = toChatId,
messagesMetas = messagesMetas,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
@JvmName("forwardWithMessages")
suspend fun TelegramBot.forward(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,

View File

@@ -44,8 +44,7 @@ suspend fun TelegramBot.handleLiveLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
) {
var currentLiveLocationMessage: ContentMessage<LocationContent>? = null
@@ -71,8 +70,7 @@ suspend fun TelegramBot.handleLiveLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
it.replyMarkup
).also {
sentMessageFlow ?.emit(it)
@@ -106,8 +104,7 @@ suspend fun TelegramBot.handleLiveLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
) {
handleLiveLocation(
@@ -126,8 +123,7 @@ suspend fun TelegramBot.handleLiveLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
sentMessageFlow
)
}
@@ -145,8 +141,7 @@ suspend fun TelegramBot.handleLiveLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
) {
handleLiveLocation(
@@ -161,8 +156,7 @@ suspend fun TelegramBot.handleLiveLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
sentMessageFlow
)
}

View File

@@ -2,39 +2,24 @@ package dev.inmo.tgbotapi.extensions.api
import korlibs.time.DateTime
import korlibs.time.TimeSpan
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.edit
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
import dev.inmo.tgbotapi.extensions.api.send.send
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.location.LiveLocation
import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.location.StaticLocation
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.content.LocationContent
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
import io.ktor.utils.io.core.Closeable
import korlibs.time.millisecondsLong
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlin.js.JsName
import kotlin.jvm.JvmName
import kotlin.math.ceil
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
@@ -111,8 +96,7 @@ suspend fun TelegramBot.startLiveLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider {
val liveTimeAsDouble = liveTimeMillis.toDouble()
@@ -128,8 +112,7 @@ suspend fun TelegramBot.startLiveLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -158,8 +141,7 @@ suspend fun TelegramBot.startLiveLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
@@ -173,8 +155,7 @@ suspend fun TelegramBot.startLiveLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -193,8 +174,7 @@ suspend fun TelegramBot.startLiveLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
@@ -208,8 +188,7 @@ suspend fun TelegramBot.startLiveLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -228,8 +207,7 @@ suspend fun TelegramBot.startLiveLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
@@ -243,8 +221,7 @@ suspend fun TelegramBot.startLiveLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -253,7 +230,7 @@ suspend fun TelegramBot.startLiveLocation(
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.replyWithLiveLocation(
to: Message,
to: AccessibleMessage,
scope: CoroutineScope,
latitude: Double,
longitude: Double,
@@ -278,8 +255,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
threadId,
disableNotification,
protectContent,
to.messageId,
allowSendingWithoutReply,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup
)
@@ -288,7 +264,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.replyWithLiveLocation(
to: Message,
to: AccessibleMessage,
scope: CoroutineScope,
location: StaticLocation,
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
@@ -311,7 +287,6 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
threadId,
disableNotification,
protectContent,
to.messageId,
allowSendingWithoutReply,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup
)

View File

@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.StopPoll
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -35,7 +35,7 @@ suspend fun TelegramBot.stopPoll(
*/
suspend fun TelegramBot.stopPoll(
chatId: IdChatIdentifier,
message: Message,
message: AccessibleMessage,
replyMarkup: InlineKeyboardMarkup? = null
) = stopPoll(chatId, message.messageId, replyMarkup)
@@ -45,6 +45,6 @@ suspend fun TelegramBot.stopPoll(
*/
suspend fun TelegramBot.stopPoll(
chat: Chat,
message: Message,
message: AccessibleMessage,
replyMarkup: InlineKeyboardMarkup? = null
) = stopPoll(chat.id, message.messageId, replyMarkup)

View File

@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.chat.modify.PinChatMessage
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
suspend fun TelegramBot.pinChatMessage(
chatId: ChatIdentifier,
@@ -20,6 +20,6 @@ suspend fun TelegramBot.pinChatMessage(
) = pinChatMessage(chat.id, messageId, disableNotification)
suspend fun TelegramBot.pinChatMessage(
message: Message,
message: AccessibleMessage,
disableNotification: Boolean = false
) = pinChatMessage(message.chat.id, message.messageId, disableNotification)

View File

@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.chat.modify.UnpinChatMessage
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
suspend fun TelegramBot.unpinChatMessage(
chatId: ChatIdentifier,
@@ -18,5 +18,5 @@ suspend fun TelegramBot.unpinChatMessage(
) = unpinChatMessage(chat.id, messageId)
suspend fun TelegramBot.unpinChatMessage(
message: Message
message: AccessibleMessage
) = unpinChatMessage(message.chat.id, message.messageId)

View File

@@ -14,7 +14,7 @@ import dev.inmo.tgbotapi.types.location.LiveLocation
import dev.inmo.tgbotapi.types.media.TelegramMedia
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
@@ -181,7 +181,7 @@ suspend fun TelegramBot.edit(
* as a builder for that
*/
suspend fun TelegramBot.edit(
message: Message,
message: AccessibleMessage,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(message, replyMarkup)

View File

@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.content.MediaContent
import dev.inmo.tgbotapi.utils.RiskFeature
@@ -98,7 +98,7 @@ suspend fun <T> TelegramBot.editMessageCaption(
*/
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not media message this method will throw an exception")
suspend fun <T> TelegramBot.editMessageCaption(
message: Message,
message: AccessibleMessage,
entities: List<TextSource>,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {

View File

@@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -35,7 +35,7 @@ suspend fun TelegramBot.editMessageReplyMarkup(
* as a builder for that
*/
suspend fun TelegramBot.editMessageReplyMarkup(
message: Message,
message: AccessibleMessage,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)

View File

@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.utils.*
@@ -174,7 +174,7 @@ suspend fun TelegramBot.editMessageText(
*/
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
suspend fun TelegramBot.editMessageText(
message: Message,
message: AccessibleMessage,
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null
@@ -186,7 +186,7 @@ suspend fun TelegramBot.editMessageText(
*/
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
suspend fun TelegramBot.editMessageText(
message: Message,
message: AccessibleMessage,
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,
@@ -199,7 +199,7 @@ suspend fun TelegramBot.editMessageText(
*/
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
suspend fun TelegramBot.editMessageText(
message: Message,
message: AccessibleMessage,
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null,

View File

@@ -2,15 +2,12 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.CopyMessage
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.threadId
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -25,8 +22,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
CopyMessage(
@@ -38,8 +34,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -57,10 +52,9 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -75,10 +69,9 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -93,10 +86,9 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -111,8 +103,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
CopyMessage(
@@ -123,8 +114,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -141,10 +131,9 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChatId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(fromChat.id, messageId, toChatId, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -158,10 +147,9 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(fromChatId, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -175,10 +163,9 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(fromChat.id, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -186,16 +173,15 @@ suspend inline fun TelegramBot.copyMessage(
*/
suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
message: Message,
message: AccessibleMessage,
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -203,16 +189,15 @@ suspend inline fun TelegramBot.copyMessage(
*/
suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
message: Message,
message: AccessibleMessage,
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -220,15 +205,14 @@ suspend inline fun TelegramBot.copyMessage(
*/
suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
message: Message,
message: AccessibleMessage,
entities: TextSourcesList,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChatId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(message.chat, message.messageId, toChatId, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -236,15 +220,14 @@ suspend inline fun TelegramBot.copyMessage(
*/
suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
message: Message,
message: AccessibleMessage,
entities: TextSourcesList,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChat, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = copyMessage(message.chat, message.messageId, toChat, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -259,8 +242,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
CopyMessage(
@@ -272,8 +254,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -291,8 +272,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(
toChatId,
@@ -303,8 +283,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -321,8 +300,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(
toChat.id,
@@ -333,8 +311,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -351,8 +328,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(
toChat.id,
@@ -363,8 +339,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -381,8 +356,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
CopyMessage(
@@ -393,8 +367,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -411,8 +384,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(
toChatId,
@@ -422,8 +394,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -439,8 +410,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(
toChat.id,
@@ -450,8 +420,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -467,8 +436,7 @@ suspend inline fun TelegramBot.copyMessage(
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(
toChat.id,
@@ -478,7 +446,6 @@ suspend inline fun TelegramBot.copyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)

View File

@@ -3,7 +3,9 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.CopyMessages
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import kotlin.jvm.JvmName
suspend fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
@@ -66,15 +68,15 @@ suspend fun TelegramBot.copyMessages(
suspend fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
messages: List<Message>,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = messages.groupBy { it.chat }.flatMap { (chat, messages) ->
) = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) ->
copyMessages(
toChatId = toChatId,
fromChatId = chat.id,
fromChatId = chatId,
messageIds = messages.map { it.messageId },
threadId = threadId,
disableNotification = disableNotification,
@@ -82,3 +84,109 @@ suspend fun TelegramBot.copyMessages(
removeCaption = removeCaption
)
}
@JvmName("copyMessagesWithMessages")
suspend fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
messagesMetas = messages.map { it.metaInfo },
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
messageIds: List<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
fromChatId = fromChatId,
messageIds = messageIds,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
messageIds: Array<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
fromChatId = fromChatId,
messageIds = messageIds,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
firstMessageId: MessageId,
vararg messageIds: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
fromChatId = fromChatId,
firstMessageId = firstMessageId,
messageIds = messageIds,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
messagesMetas = messagesMetas,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
@JvmName("copyWithMessages")
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
messages = messages,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)

View File

@@ -1,14 +1,11 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.MessageContent
import dev.inmo.tgbotapi.types.threadId
/**
* This method will send [content] to the [chatId] as is
@@ -19,8 +16,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
content.createResend(
@@ -28,8 +24,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
) as ContentMessage<T>
@@ -43,8 +38,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = resend(
chatId = chat.id,
@@ -52,8 +46,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -68,8 +61,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = resend(
chatId = chatId,
@@ -77,8 +69,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -93,8 +84,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = resend(
chatId = chat.id,
@@ -102,7 +92,6 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -18,12 +18,11 @@ suspend fun TelegramBot.sendContact(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendContact(
chatId, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
)
@@ -37,12 +36,11 @@ suspend fun TelegramBot.sendContact(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendContact(
chatId, contact, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, contact, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
)
@@ -58,11 +56,10 @@ suspend fun TelegramBot.sendContact(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendContact(
chat.id, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -75,9 +72,8 @@ suspend fun TelegramBot.sendContact(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendContact(
chat.id, contact, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, contact, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)

View File

@@ -2,13 +2,10 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendDice
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.dice.DiceAnimationType
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -20,11 +17,10 @@ suspend fun TelegramBot.sendDice(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendDice(chatId, animationType, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
SendDice(chatId, animationType, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
)
/**
@@ -37,7 +33,6 @@ suspend fun TelegramBot.sendDice(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendDice(chat.id, animationType, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendDice(chat.id, animationType, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -22,8 +22,7 @@ suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendLiveLocation(
@@ -37,8 +36,7 @@ suspend fun TelegramBot.sendLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -57,8 +55,7 @@ suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
chatId,
@@ -71,8 +68,7 @@ suspend fun TelegramBot.sendLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -91,8 +87,7 @@ suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
chat.id,
@@ -105,8 +100,7 @@ suspend fun TelegramBot.sendLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -124,8 +118,7 @@ suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
chat.id,
@@ -138,8 +131,7 @@ suspend fun TelegramBot.sendLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -158,10 +150,9 @@ suspend fun TelegramBot.sendLiveLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -177,10 +168,9 @@ suspend fun TelegramBot.sendLiveLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -197,10 +187,9 @@ suspend fun TelegramBot.sendLiveLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -216,7 +205,6 @@ suspend fun TelegramBot.sendLiveLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -23,8 +23,7 @@ suspend fun TelegramBot.sendMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendTextMessage(
@@ -35,8 +34,7 @@ suspend fun TelegramBot.sendMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -53,11 +51,10 @@ suspend fun TelegramBot.sendTextMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendMessage(
chatId, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -72,10 +69,9 @@ suspend fun TelegramBot.sendTextMessage(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendTextMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendTextMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -90,10 +86,9 @@ suspend fun TelegramBot.sendMessage(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -106,11 +101,10 @@ suspend fun TelegramBot.sendMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendTextMessage(chatId, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
SendTextMessage(chatId, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
)
/**
@@ -124,11 +118,10 @@ suspend fun TelegramBot.sendMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -142,11 +135,10 @@ suspend fun TelegramBot.sendMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -159,11 +151,10 @@ suspend fun TelegramBot.sendTextMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendMessage(
chatId, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -177,11 +168,10 @@ suspend fun TelegramBot.sendTextMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -195,11 +185,10 @@ suspend fun TelegramBot.sendTextMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -212,10 +201,9 @@ suspend fun TelegramBot.sendMessage(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendMessage(chat.id, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendMessage(chat.id, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -228,11 +216,10 @@ suspend fun TelegramBot.sendMessage(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -246,11 +233,10 @@ suspend fun TelegramBot.sendMessage(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -264,10 +250,9 @@ suspend fun TelegramBot.sendTextMessage(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendTextMessage(chat.id, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendTextMessage(chat.id, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -280,11 +265,10 @@ suspend fun TelegramBot.sendTextMessage(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -298,8 +282,7 @@ suspend fun TelegramBot.sendTextMessage(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -2,13 +2,10 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendStaticLocation
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -21,8 +18,7 @@ suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendStaticLocation(
@@ -32,8 +28,7 @@ suspend fun TelegramBot.sendLocation(
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
allowSendingWithoutReply = allowSendingWithoutReply,
replyToMessageId = replyToMessageId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -48,8 +43,7 @@ suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
chatId,
@@ -58,8 +52,7 @@ suspend fun TelegramBot.sendLocation(
threadId,
disableNotification,
protectContent,
allowSendingWithoutReply,
replyToMessageId,
replyParameters,
replyMarkup
)
@@ -74,8 +67,7 @@ suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
chat.id,
@@ -84,8 +76,7 @@ suspend fun TelegramBot.sendLocation(
threadId,
disableNotification,
protectContent,
allowSendingWithoutReply,
replyToMessageId,
replyParameters,
replyMarkup
)
@@ -99,8 +90,7 @@ suspend fun TelegramBot.sendLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
chat.id,
@@ -109,8 +99,7 @@ suspend fun TelegramBot.sendLocation(
threadId,
disableNotification,
protectContent,
allowSendingWithoutReply,
replyToMessageId,
replyParameters,
replyMarkup
)
@@ -125,10 +114,9 @@ suspend fun TelegramBot.sendStaticLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
) = sendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -140,10 +128,9 @@ suspend fun TelegramBot.sendStaticLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, location.latitude, location.longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
) = sendLocation(chatId, location.latitude, location.longitude, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -156,10 +143,9 @@ suspend fun TelegramBot.sendStaticLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, latitude, longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
) = sendLocation(chat.id, latitude, longitude, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -171,7 +157,6 @@ suspend fun TelegramBot.sendStaticLocation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, location.latitude, location.longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
) = sendLocation(chat.id, location.latitude, location.longitude, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -25,8 +25,7 @@ suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVenue(
@@ -42,8 +41,7 @@ suspend fun TelegramBot.sendVenue(
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -65,8 +63,7 @@ suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chatId = chat.id,
@@ -81,8 +78,7 @@ suspend fun TelegramBot.sendVenue(
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -102,8 +98,7 @@ suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chatId = chatId,
@@ -118,8 +113,7 @@ suspend fun TelegramBot.sendVenue(
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -139,8 +133,7 @@ suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chatId = chat.id,
@@ -155,8 +148,7 @@ suspend fun TelegramBot.sendVenue(
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -170,8 +162,7 @@ suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVenue(
@@ -180,8 +171,7 @@ suspend fun TelegramBot.sendVenue(
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -196,8 +186,7 @@ suspend fun TelegramBot.sendVenue(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chatId = chat.id,
@@ -205,7 +194,6 @@ suspend fun TelegramBot.sendVenue(
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -1,21 +1,20 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendAction
import dev.inmo.tgbotapi.requests.send.SetMessageReactions
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.actions.*
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.reactions.Reaction
import dev.inmo.tgbotapi.types.threadId
import kotlin.js.JsName
import kotlin.jvm.JvmName
suspend fun TelegramBot.setMessageReactions(
chatId: ChatIdentifier,
messageId: MessageId,
reactions: List<Reaction>,
reactions: List<Reaction> = emptyList(),
big: Boolean = false
) = execute(
SetMessageReactions(chatId, messageId, reactions, big)
@@ -24,32 +23,100 @@ suspend fun TelegramBot.setMessageReactions(
suspend fun TelegramBot.setMessageReaction(
chatId: ChatIdentifier,
messageId: MessageId,
reaction: Reaction?,
reaction: Reaction? = null,
big: Boolean = false
) = setMessageReactions(chatId, messageId, listOfNotNull(reaction), big)
suspend fun TelegramBot.setMessageReactions(
chat: Chat,
messageId: MessageId,
reactions: List<Reaction>,
reactions: List<Reaction> = emptyList(),
big: Boolean = false
) = setMessageReactions(chat.id, messageId, reactions, big)
suspend fun TelegramBot.setMessageReaction(
chat: Chat,
messageId: MessageId,
reaction: Reaction?,
reaction: Reaction? = null,
big: Boolean = false
) = setMessageReaction(chat.id, messageId, reaction, big)
suspend fun TelegramBot.setMessageReactions(
message: Message,
reactions: List<Reaction>,
meta: Message.MetaInfo,
reactions: List<Reaction> = emptyList(),
big: Boolean = false
) = setMessageReactions(message.chat, message.messageId, reactions, big)
) = setMessageReactions(meta.chatId, meta.messageId, reactions, big)
suspend fun TelegramBot.setMessageReaction(
message: Message,
reaction: Reaction?,
meta: Message.MetaInfo,
reaction: Reaction? = null,
big: Boolean = false
) = setMessageReaction(message.chat, message.messageId, reaction, big)
) = setMessageReaction(meta.chatId, meta.messageId, reaction, big)
suspend fun TelegramBot.setMessageReactions(
message: AccessibleMessage,
reactions: List<Reaction> = emptyList(),
big: Boolean = false
) = setMessageReactions(message.metaInfo, reactions, big)
suspend fun TelegramBot.setMessageReaction(
message: AccessibleMessage,
reaction: Reaction? = null,
big: Boolean = false
) = setMessageReaction(message.metaInfo, reaction, big)
@JvmName("setMessageReactionsStrings")
suspend fun TelegramBot.setMessageReactions(
chatId: ChatIdentifier,
messageId: MessageId,
emojis: List<String>,
big: Boolean = false
) = setMessageReactions(chatId, messageId, emojis.map { Reaction.Emoji(it) }, big)
suspend fun TelegramBot.setMessageReaction(
chatId: ChatIdentifier,
messageId: MessageId,
emoji: String?,
big: Boolean = false
) = setMessageReaction(chatId, messageId, emoji ?.let { Reaction.Emoji(it) }, big)
@JvmName("setMessageReactionsStrings")
suspend fun TelegramBot.setMessageReactions(
chat: Chat,
messageId: MessageId,
emojis: List<String>,
big: Boolean = false
) = setMessageReactions(chat, messageId, emojis.map { Reaction.Emoji(it) }, big)
suspend fun TelegramBot.setMessageReaction(
chat: Chat,
messageId: MessageId,
emoji: String?,
big: Boolean = false
) = setMessageReaction(chat, messageId, emoji ?.let { Reaction.Emoji(it) }, big)
@JvmName("setMessageReactionsStrings")
suspend fun TelegramBot.setMessageReactions(
meta: Message.MetaInfo,
emojis: List<String>,
big: Boolean = false
) = setMessageReactions(meta, emojis.map { Reaction.Emoji(it) }, big)
suspend fun TelegramBot.setMessageReaction(
meta: Message.MetaInfo,
emoji: String?,
big: Boolean = false
) = setMessageReaction(meta, emoji ?.let { Reaction.Emoji(it) }, big)
@JvmName("setMessageReactionsStrings")
suspend fun TelegramBot.setMessageReactions(
message: AccessibleMessage,
emojis: List<String>,
big: Boolean = false
) = setMessageReactions(message, emojis.map { Reaction.Emoji(it) }, big)
suspend fun TelegramBot.setMessageReaction(
message: AccessibleMessage,
emoji: String?,
big: Boolean = false
) = setMessageReaction(message, emoji ?.let { Reaction.Emoji(it) }, big)

View File

@@ -2,13 +2,10 @@ package dev.inmo.tgbotapi.extensions.api.send.games
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.games.SendGame
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.games.Game
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -20,12 +17,11 @@ suspend fun TelegramBot.sendGame(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendGame(
chatId, gameShortName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, gameShortName, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
)
@@ -39,11 +35,10 @@ suspend fun TelegramBot.sendGame(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendGame(
chat.id, gameShortName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, gameShortName, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -56,11 +51,10 @@ suspend fun TelegramBot.sendGame(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendGame(
chatId, game.title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, game.title, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -73,9 +67,8 @@ suspend fun TelegramBot.sendGame(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendGame(
chat.id, game.title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, game.title, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)

View File

@@ -3,15 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendAnimation
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.AnimationFile
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -30,8 +27,7 @@ suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendAnimation(
@@ -47,8 +43,7 @@ suspend fun TelegramBot.sendAnimation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -69,11 +64,10 @@ suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation.fileId, animation.thumbnail ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, animation.fileId, animation.thumbnail ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -93,10 +87,9 @@ suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat.id, animation, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -114,10 +107,9 @@ suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat.id, animation, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -136,8 +128,7 @@ suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendAnimation(
@@ -152,8 +143,7 @@ suspend fun TelegramBot.sendAnimation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -173,11 +163,10 @@ suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation.fileId, animation.thumbnail ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, animation.fileId, animation.thumbnail ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -196,10 +185,9 @@ suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat.id, animation, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -216,7 +204,6 @@ suspend fun TelegramBot.sendAnimation(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAnimation(chat.id, animation, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -3,15 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendAudio
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.AudioFile
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -29,8 +26,7 @@ suspend fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendAudio(
@@ -45,8 +41,7 @@ suspend fun TelegramBot.sendAudio(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -67,10 +62,9 @@ suspend fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -85,10 +79,9 @@ suspend fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -103,10 +96,9 @@ suspend fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, text, parseMode, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAudio(chat.id, audio, text, parseMode, title, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -124,8 +116,7 @@ suspend inline fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendAudio(
@@ -139,8 +130,7 @@ suspend inline fun TelegramBot.sendAudio(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -160,10 +150,9 @@ suspend inline fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -177,10 +166,9 @@ suspend inline fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, entities, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, entities, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -194,7 +182,6 @@ suspend inline fun TelegramBot.sendAudio(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, entities, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendAudio(chat.id, audio, entities, title, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -3,15 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendDocument
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.DocumentFile
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -26,8 +23,7 @@ suspend fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = execute(
@@ -40,8 +36,7 @@ suspend fun TelegramBot.sendDocument(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup,
disableContentTypeDetection
)
@@ -60,11 +55,10 @@ suspend fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, thumb, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
) = sendDocument(chat.id, document, thumb, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup, disableContentTypeDetection)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -78,12 +72,11 @@ suspend fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(
chatId, document.fileId, document.thumbnail ?.fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
chatId, document.fileId, document.thumbnail ?.fileId, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup, disableContentTypeDetection
)
/**
@@ -98,11 +91,10 @@ suspend fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
) = sendDocument(chat.id, document, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup, disableContentTypeDetection)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -116,8 +108,7 @@ suspend inline fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = execute(
@@ -129,8 +120,7 @@ suspend inline fun TelegramBot.sendDocument(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup,
disableContentTypeDetection
)
@@ -148,11 +138,10 @@ suspend inline fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, thumb, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
) = sendDocument(chat.id, document, thumb, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup, disableContentTypeDetection)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -165,12 +154,11 @@ suspend inline fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(
chatId, document.fileId, document.thumbnail ?.fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
chatId, document.fileId, document.thumbnail ?.fileId, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup, disableContentTypeDetection
)
/**
@@ -184,8 +172,7 @@ suspend inline fun TelegramBot.sendDocument(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
) = sendDocument(chat.id, document, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup, disableContentTypeDetection)

View File

@@ -2,16 +2,13 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.media.*
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.media.*
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.AudioContent
import dev.inmo.tgbotapi.types.message.content.DocumentContent
import dev.inmo.tgbotapi.types.threadId
import dev.inmo.tgbotapi.utils.RiskFeature
import kotlin.jvm.JvmName
@@ -25,11 +22,10 @@ suspend fun TelegramBot.sendMediaGroup(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = execute(
SendMediaGroup<MediaGroupPartContent>(
chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chatId, media, threadId, disableNotification, protectContent, replyParameters
)
)
@@ -43,10 +39,9 @@ suspend fun TelegramBot.sendMediaGroup(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendMediaGroup(
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chat.id, media, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -60,10 +55,9 @@ suspend fun TelegramBot.sendMediaGroup(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendMediaGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -77,10 +71,9 @@ suspend fun TelegramBot.sendMediaGroup(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendMediaGroup(
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chat.id, media, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -92,11 +85,10 @@ suspend fun TelegramBot.sendPlaylist(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = execute(
SendPlaylist(
chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chatId, media, threadId, disableNotification, protectContent, replyParameters
)
)
@@ -109,10 +101,9 @@ suspend fun TelegramBot.sendPlaylist(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendPlaylist(
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chat.id, media, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -125,10 +116,9 @@ suspend fun TelegramBot.sendPlaylist(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendPlaylist(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -141,10 +131,9 @@ suspend fun TelegramBot.sendPlaylist(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendPlaylist(
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chat.id, media, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -156,11 +145,10 @@ suspend fun TelegramBot.sendDocumentsGroup(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = execute(
SendDocumentsGroup(
chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chatId, media, threadId, disableNotification, protectContent, replyParameters
)
)
@@ -173,10 +161,9 @@ suspend fun TelegramBot.sendDocumentsGroup(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendDocumentsGroup(
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chat.id, media, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -189,10 +176,9 @@ suspend fun TelegramBot.sendDocumentsGroup(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendDocumentsGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -205,10 +191,9 @@ suspend fun TelegramBot.sendDocumentsGroup(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendDocumentsGroup(
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chat.id, media, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -220,11 +205,10 @@ suspend fun TelegramBot.sendVisualMediaGroup(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = execute(
SendVisualMediaGroup(
chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chatId, media, threadId, disableNotification, protectContent, replyParameters
)
)
@@ -237,10 +221,9 @@ suspend fun TelegramBot.sendVisualMediaGroup(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendVisualMediaGroup(
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chat.id, media, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -253,10 +236,9 @@ suspend fun TelegramBot.sendVisualMediaGroup(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendVisualMediaGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyParameters
)
/**
@@ -269,8 +251,7 @@ suspend fun TelegramBot.sendVisualMediaGroup(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
replyParameters: ReplyParameters? = null
) = sendVisualMediaGroup(
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
chat.id, media, threadId, disableNotification, protectContent, replyParameters
)

View File

@@ -3,15 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendPhoto
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.*
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -26,8 +23,7 @@ suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendPhoto(
@@ -39,8 +35,7 @@ suspend fun TelegramBot.sendPhoto(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -58,10 +53,9 @@ suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -76,10 +70,9 @@ suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -94,10 +87,9 @@ suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, photo, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -112,10 +104,9 @@ suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize.fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photoSize.fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -130,10 +121,9 @@ suspend fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photoSize, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, photoSize, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -148,8 +138,7 @@ suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendPhoto(
@@ -160,8 +149,7 @@ suspend inline fun TelegramBot.sendPhoto(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -178,10 +166,9 @@ suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, fileId, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -195,10 +182,9 @@ suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -212,10 +198,9 @@ suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, photo, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -229,10 +214,9 @@ suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize.fileId, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chatId, photoSize.fileId, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -246,7 +230,6 @@ suspend inline fun TelegramBot.sendPhoto(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photoSize, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendPhoto(chat.id, photoSize, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -3,13 +3,10 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendSticker
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.Sticker
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -22,11 +19,10 @@ suspend fun TelegramBot.sendSticker(
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendSticker(chatId, sticker, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
SendSticker(chatId, sticker, threadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup)
)
/**
@@ -40,10 +36,9 @@ suspend fun TelegramBot.sendSticker(
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat.id, sticker, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendSticker(chat.id, sticker, threadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -56,10 +51,9 @@ suspend fun TelegramBot.sendSticker(
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendSticker(chatId, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendSticker(chatId, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -72,7 +66,6 @@ suspend fun TelegramBot.sendSticker(
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendSticker(chat, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -3,15 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVideo
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.VideoFile
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -30,8 +27,7 @@ suspend fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVideo(
@@ -48,8 +44,7 @@ suspend fun TelegramBot.sendVideo(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -67,10 +62,9 @@ suspend fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -89,10 +83,9 @@ suspend fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat.id, video, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -108,10 +101,9 @@ suspend fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat.id, video, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -129,8 +121,7 @@ suspend inline fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVideo(
@@ -146,8 +137,7 @@ suspend inline fun TelegramBot.sendVideo(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -164,10 +154,9 @@ suspend inline fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -185,10 +174,9 @@ suspend inline fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat.id, video, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -203,7 +191,6 @@ suspend inline fun TelegramBot.sendVideo(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideo(chat.id, video, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -3,13 +3,10 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVideoNote
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.VideoNoteFile
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -24,8 +21,7 @@ suspend fun TelegramBot.sendVideoNote(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVideoNote(
@@ -37,8 +33,7 @@ suspend fun TelegramBot.sendVideoNote(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -53,11 +48,10 @@ suspend fun TelegramBot.sendVideoNote(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(
chatId, videoNote.fileId, videoNote.thumbnail ?.fileId, videoNote.duration, videoNote.width, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, videoNote.fileId, videoNote.thumbnail ?.fileId, videoNote.duration, videoNote.width, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -73,10 +67,9 @@ suspend fun TelegramBot.sendVideoNote(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(chat.id, videoNote, thumb, duration, size, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideoNote(chat.id, videoNote, thumb, duration, size, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -88,7 +81,6 @@ suspend fun TelegramBot.sendVideoNote(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(chat.id, videoNote, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVideoNote(chat.id, videoNote, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -3,15 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVoice
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.VoiceFile
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -26,8 +23,7 @@ suspend fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVoice(
@@ -39,8 +35,7 @@ suspend fun TelegramBot.sendVoice(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -58,10 +53,9 @@ suspend fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, text, parseMode, duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVoice(chat.id, voice, text, parseMode, duration, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -75,11 +69,10 @@ suspend fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(
chatId, voice.fileId, text, parseMode, voice.duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, voice.fileId, text, parseMode, voice.duration, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -94,10 +87,9 @@ suspend fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVoice(chat.id, voice, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
@@ -112,8 +104,7 @@ suspend inline fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVoice(
@@ -124,8 +115,7 @@ suspend inline fun TelegramBot.sendVoice(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
)
@@ -142,10 +132,9 @@ suspend inline fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, entities, duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVoice(chat.id, voice, entities, duration, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -158,11 +147,10 @@ suspend inline fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(
chatId, voice.fileId, entities, voice.duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, voice.fileId, entities, voice.duration, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -175,7 +163,6 @@ suspend inline fun TelegramBot.sendVoice(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendVoice(chat.id, voice, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -34,11 +34,10 @@ suspend fun TelegramBot.sendInvoice(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
SendInvoice(chatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
SendInvoice(chatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
)
/**
@@ -66,7 +65,6 @@ suspend fun TelegramBot.sendInvoice(
priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, null, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, null, disableNotification, protectContent, replyParameters, replyMarkup)

View File

@@ -3,15 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.send.polls
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.polls.SendQuizPoll
import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.polls.*
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -28,12 +25,11 @@ suspend fun TelegramBot.sendRegularPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendRegularPoll(
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
)
/**
@@ -52,10 +48,9 @@ suspend fun TelegramBot.sendRegularPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -72,11 +67,10 @@ suspend fun TelegramBot.sendRegularPoll(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -95,11 +89,10 @@ suspend fun TelegramBot.sendRegularPoll(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
@@ -120,12 +113,11 @@ suspend fun TelegramBot.sendQuizPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
)
@@ -146,11 +138,10 @@ suspend fun TelegramBot.sendQuizPoll(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -171,11 +162,10 @@ suspend fun TelegramBot.sendQuizPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -196,11 +186,10 @@ suspend fun TelegramBot.sendQuizPoll(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
@@ -220,12 +209,11 @@ suspend inline fun TelegramBot.sendQuizPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
)
@@ -245,11 +233,10 @@ suspend inline fun TelegramBot.sendQuizPoll(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -269,11 +256,10 @@ suspend inline fun TelegramBot.sendQuizPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)
/**
@@ -293,9 +279,8 @@ suspend inline fun TelegramBot.sendQuizPoll(
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
)

View File

@@ -138,3 +138,13 @@ suspend fun BehaviourContext.waitMediaContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContent(initRequest, errorFactory).mapContent<MediaContent>()
suspend fun BehaviourContext.waitGiveawayContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContent(initRequest, errorFactory).mapContent<GiveawayContent>()
suspend fun BehaviourContext.waitGiveawayPublicResultsContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContent(initRequest, errorFactory).mapContent<GiveawayPublicResultsContent>()

View File

@@ -2,9 +2,7 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import dev.inmo.tgbotapi.extensions.utils.withContent
import dev.inmo.tgbotapi.extensions.utils.withContentOrNull
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
@@ -13,7 +11,6 @@ import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.mapNotNull
typealias CommonMessageToCommonMessageMapper<T> = suspend CommonMessage<T>.() -> CommonMessage<T>?
@@ -152,3 +149,13 @@ suspend fun BehaviourContext.waitMediaContentMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContentMessage(initRequest, errorFactory).mapWithContent<MediaContent>()
suspend fun BehaviourContext.waitGiveawayContentMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContentMessage(initRequest, errorFactory).mapWithContent<GiveawayContent>()
suspend fun BehaviourContext.waitGiveawayPublicResultsContentMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitContentMessage(initRequest, errorFactory).mapWithContent<GiveawayPublicResultsContent>()

View File

@@ -130,3 +130,14 @@ suspend fun BehaviourContext.waitEditedInvoice(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<InvoiceContent>(initRequest, false, errorFactory)
suspend fun BehaviourContext.waitEditedGiveawayContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<GiveawayContent>(initRequest, false, errorFactory)
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContent(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContent<GiveawayPublicResultsContent>(initRequest, false, errorFactory)

View File

@@ -3,7 +3,6 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import dev.inmo.tgbotapi.extensions.utils.baseEditMessageUpdateOrNull
import dev.inmo.tgbotapi.extensions.utils.commonMessageOrNull
import dev.inmo.tgbotapi.extensions.utils.withContent
import dev.inmo.tgbotapi.requests.abstracts.Request
@@ -136,3 +135,14 @@ suspend fun BehaviourContext.waitEditedInvoiceMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<InvoiceContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedGiveawayContentMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<GiveawayContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContentMessage(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<GiveawayPublicResultsContent>(initRequest, errorFactory)

View File

@@ -23,6 +23,7 @@ import dev.inmo.tgbotapi.types.request.UsersShared
import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter
typealias EventMessageToEventMapper<T> = suspend ChatEventMessage<T>.() -> T?
@@ -199,12 +200,22 @@ suspend fun BehaviourContext.waitChatSharedRequest(
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<ChatSharedRequest>(initRequest, errorFactory)
suspend fun BehaviourContext.waitUserShared(
suspend fun BehaviourContext.waitUsersShared(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<UsersShared>(initRequest, errorFactory)
suspend fun BehaviourContext.waitUserShared(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitUsersShared(initRequest, errorFactory).filter { it.userIds.size == 1 }
suspend fun BehaviourContext.waitChatShared(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<ChatShared>(initRequest, errorFactory)
suspend fun BehaviourContext.waitChatBoostAdded(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<ChatBoostAdded>(initRequest, errorFactory)

View File

@@ -23,6 +23,7 @@ import dev.inmo.tgbotapi.types.request.UsersShared
import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter
@RiskFeature(lowLevelRiskFeatureMessage)
suspend inline fun <reified O : ChatEvent> BehaviourContext.waitEventsMessages(
@@ -193,12 +194,22 @@ suspend fun BehaviourContext.waitChatSharedRequestEventsMessages(
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<ChatSharedRequest>(initRequest, errorFactory)
suspend fun BehaviourContext.waitUserSharedEventsMessages(
suspend fun BehaviourContext.waitUsersSharedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<UsersShared>(initRequest, errorFactory)
suspend fun BehaviourContext.waitUserSharedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitUsersSharedEventsMessages(initRequest, errorFactory).filter { it.chatEvent.userIds.size == 1 }
suspend fun BehaviourContext.waitChatSharedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<ChatShared>(initRequest, errorFactory)
suspend fun BehaviourContext.waitChatBoostAddedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<ChatBoostAdded>(initRequest, errorFactory)

View File

@@ -6,24 +6,24 @@ import dev.inmo.tgbotapi.extensions.utils.extensions.sourceUser
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
import dev.inmo.tgbotapi.types.payments.ShippingQuery
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
import dev.inmo.tgbotapi.types.update.abstracts.Update
/**
* Allow only events from the same chat as base [Message]
* Allow only events from the same chat as base [AccessibleMessage]
*/
val MessageFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, Message, Update> = { message, update ->
val MessageFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, AccessibleMessage, Update> = { message, update ->
update.sourceChat() ?.let {
it.id == message.chat.id
} != false
}
/**
* Allow only events from the same chat as base [List] of [Message]
* Allow only events from the same chat as base [List] of [AccessibleMessage]
*/
val MessagesFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, List<Message>, Update> = { messages, update ->
val MessagesFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, List<AccessibleMessage>, Update> = { messages, update ->
val sourceChatId = update.sourceChat() ?.id
sourceChatId != null && messages.all { sourceChatId == it.chat.id }
}

View File

@@ -1,15 +1,13 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
import dev.inmo.tgbotapi.types.message.content.MediaGroupMessage
import dev.inmo.tgbotapi.types.update.abstracts.Update
/**
* Allow only messages which are not [MediaGroupMessage]
*/
val CommonMessageFilterExcludeMediaGroups = SimpleFilter<Message> {
val CommonMessageFilterExcludeMediaGroups = SimpleFilter<AccessibleMessage> {
it !is CommonMessage<*> || it.content !is MediaGroupContent<*>
}

View File

@@ -7,6 +7,6 @@ import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
/**
* Allow only messages which are not in some forum
*/
val MessageFilterForums = SimpleFilter<Message> {
val MessageFilterForums = SimpleFilter<AccessibleMessage> {
it.threadIdOrNull == null
}

View File

@@ -0,0 +1,38 @@
@file:Suppress("unused")
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatIdChatMessageReactionUpdatedMarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatIdChatMessageReactionsCountUpdatedMarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByIdPollMarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
import dev.inmo.tgbotapi.extensions.utils.chatMessageReactionUpdatedUpdateOrNull
import dev.inmo.tgbotapi.extensions.utils.chatMessageReactionsCountUpdatedUpdateOrNull
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionsCountUpdated
import dev.inmo.tgbotapi.types.polls.*
import dev.inmo.tgbotapi.types.update.abstracts.Update
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onChatMessageReactionsCountUpdated(
initialFilter: SimpleFilter<ChatMessageReactionsCountUpdated>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatMessageReactionsCountUpdated, Update>? = null,
markerFactory: MarkerFactory<ChatMessageReactionsCountUpdated, Any> = ByChatIdChatMessageReactionsCountUpdatedMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatMessageReactionsCountUpdated>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
(it.chatMessageReactionsCountUpdatedUpdateOrNull() ?.data) ?.let(::listOfNotNull)
}

View File

@@ -703,3 +703,52 @@ suspend fun <BC : BehaviourContext> BC.onMediaContent(
markerFactory,
scenarioReceiver
)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onGiveawayContent(
initialFilter: CommonMessageFilter<GiveawayContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ScheduledGiveawayContentMessage, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ScheduledGiveawayContentMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ScheduledGiveawayContentMessage>
) = onContentMessageWithType(
initialFilter,
subcontextUpdatesFilter,
markerFactory,
scenarioReceiver
)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onGiveawayPublicResultsContent(
initialFilter: CommonMessageFilter<GiveawayPublicResultsContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, GiveawayPublicResultsContentMessage, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in GiveawayPublicResultsContentMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, GiveawayPublicResultsContentMessage>
) = onContentMessageWithType(
initialFilter,
subcontextUpdatesFilter,
markerFactory,
scenarioReceiver
)

View File

@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessageFilterByCha
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMessageMarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times
import dev.inmo.tgbotapi.extensions.utils.baseSentMessageUpdateOrNull
import dev.inmo.tgbotapi.extensions.utils.chatEventMessageOrNull
import dev.inmo.tgbotapi.types.message.ChatEvents.*
@@ -775,7 +776,7 @@ suspend fun <BC : BehaviourContext> BC.onChatSharedRequest(
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onUserShared(
suspend fun <BC : BehaviourContext> BC.onUsersShared(
initialFilter: SimpleFilter<PrivateEventMessage<UsersShared>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PrivateEventMessage<UsersShared>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<UsersShared>, Any> = ByChatMessageMarkerFactory,
@@ -783,6 +784,26 @@ suspend fun <BC : BehaviourContext> BC.onUserShared(
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onUserShared(
initialFilter: SimpleFilter<PrivateEventMessage<UsersShared>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PrivateEventMessage<UsersShared>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<UsersShared>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<UsersShared>>
) = onUsersShared(initialFilter * { it.chatEvent.userIds.size == 1 }, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
@@ -802,3 +823,24 @@ suspend fun <BC : BehaviourContext> BC.onChatShared(
markerFactory: MarkerFactory<in ChatEventMessage<ChatShared>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<ChatShared>>
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
* to combinate several filters
* @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
* data
*/
suspend fun <BC : BehaviourContext> BC.onChatBoostAdded(
initialFilter: SimpleFilter<ChatEventMessage<ChatBoostAdded>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<ChatBoostAdded>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<ChatBoostAdded>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<ChatBoostAdded>>
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)

View File

@@ -0,0 +1,8 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionsCountUpdated
object ByChatIdChatMessageReactionsCountUpdatedMarkerFactory : MarkerFactory<ChatMessageReactionsCountUpdated, Any> {
override suspend fun invoke(data: ChatMessageReactionsCountUpdated) = data.chat.id
}

View File

@@ -2,12 +2,12 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
import dev.inmo.tgbotapi.types.message.abstracts.*
object ByChatMessageMarkerFactory : MarkerFactory<Message, Any> {
override suspend fun invoke(data: Message) = data.chat
object ByChatMessageMarkerFactory : MarkerFactory<AccessibleMessage, Any> {
override suspend fun invoke(data: AccessibleMessage) = data.chat
}
object ByUserMessageMarkerFactory : MarkerFactory<Message, Any> {
override suspend fun invoke(data: Message) = when (data) {
object ByUserMessageMarkerFactory : MarkerFactory<AccessibleMessage, Any> {
override suspend fun invoke(data: AccessibleMessage) = when (data) {
is FromUserMessage -> data.user
is FromChannelGroupContentMessage<*> -> data.channel
else -> data.chat // including anonymous

View File

@@ -1,8 +0,0 @@
package dev.inmo.tgbotapi.abstracts.types
import dev.inmo.tgbotapi.types.MessageId
interface ReplyMessageId {
val replyToMessageId: MessageId?
val allowSendingWithoutReply: Boolean?
}

View File

@@ -0,0 +1,19 @@
package dev.inmo.tgbotapi.abstracts.types
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.ReplyParameters
@Deprecated("Renamed", ReplaceWith("WithReplyParameters", "dev.inmo.tgbotapi.abstracts.types.WithReplyParameters"))
interface ReplyMessageId {
val replyToMessageId: MessageId?
val allowSendingWithoutReply: Boolean?
}
interface WithReplyParameters : ReplyMessageId {
val replyParameters: ReplyParameters?
override val replyToMessageId: MessageId?
get() = replyParameters ?.messageId
override val allowSendingWithoutReply: Boolean?
get() = replyParameters ?.allowSendingWithoutReply
}

View File

@@ -9,6 +9,7 @@ import dev.inmo.tgbotapi.bot.exceptions.newRequestException
import dev.inmo.tgbotapi.requests.GetUpdatesRequest
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.Response
import dev.inmo.tgbotapi.types.message.textsources.pre
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
import io.ktor.client.HttpClient
@@ -16,6 +17,7 @@ import io.ktor.client.plugins.timeout
import io.ktor.client.request.*
import io.ktor.client.statement.bodyAsText
import io.ktor.http.ContentType
import io.ktor.http.content.*
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import kotlin.collections.set
@@ -33,7 +35,14 @@ abstract class AbstractRequestCallFactory(
jsonFormatter: Json
): T? {
val preparedBody = prepareCallBody(client, urlsKeeper, request) ?: return null
logger.v { "Prepared body for $request: $preparedBody" }
logger.v {
val bodyValue = if (preparedBody is TextContent) {
preparedBody.text
} else {
preparedBody.toString()
}
"Prepared body for $request: $bodyValue"
}
client.post {
url(

View File

@@ -1,6 +1,5 @@
package dev.inmo.tgbotapi.requests
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.types.update.abstracts.UpdateSerializerWithoutSerialization
@@ -15,7 +14,7 @@ private val updatesListSerializer = ListSerializer(
* Request updates from Telegram Bot API system. It is important, that the result updates WILL NOT include
* [dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MediaGroupUpdate] objects due to the fact,
* that it is internal abstraction and in fact any [dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage]
* is just a common [dev.inmo.tgbotapi.types.message.abstracts.Message]
* is just a common [dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage]
*
* @see dev.inmo.tgbotapi.extensions.utils.updates.retrieving.updateHandlerWithMediaGroupsAdaptation
* @see dev.inmo.tgbotapi.utils.convertWithMediaGroupUpdates

View File

@@ -98,6 +98,7 @@ data class MultipartFile (
private val inputSource: () -> Input
) : InputFile() {
@Required
@EncodeDefault
override val fileId: String = "${uuid4()}.${filename.fileExtension}"
val input: Input
get() = inputSource()

View File

@@ -112,6 +112,7 @@ data class CreateChatInviteLinkWithJoinRequest(
override val expirationUnixTimeStamp: TelegramDate? = null,
) : CreateChatInviteLink<ChatInviteLinkWithJoinRequest>, WithJoinRequestChatInviteLinkRequest {
@Required
@EncodeDefault
@SerialName(createsJoinRequestField)
private val createsJoinRequest: Boolean = true

View File

@@ -126,6 +126,7 @@ data class EditChatInviteLinkWithJoinRequest(
) : EditChatInviteLink<ChatInviteLinkWithJoinRequest>,
WithJoinRequestChatInviteLinkRequest {
@Required
@EncodeDefault
@SerialName(createsJoinRequestField)
private val createsJoinRequest: Boolean = true

View File

@@ -30,8 +30,7 @@ fun CopyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
@@ -43,8 +42,7 @@ fun CopyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -56,8 +54,7 @@ fun CopyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
@@ -69,8 +66,7 @@ fun CopyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -83,8 +79,7 @@ fun CopyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
@@ -96,8 +91,7 @@ fun CopyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -109,8 +103,7 @@ fun CopyMessage(
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
@@ -122,8 +115,7 @@ fun CopyMessage(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -147,10 +139,8 @@ data class CopyMessage internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
): SimpleRequest<MessageId>,

View File

@@ -28,10 +28,8 @@ data class SendContact(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<ContactContent>>,
@@ -43,8 +41,7 @@ data class SendContact(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): this(
chatId,
@@ -54,8 +51,7 @@ data class SendContact(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -71,8 +67,7 @@ fun Contact.toRequest(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): SendContact = SendContact(
chatId,
@@ -80,7 +75,6 @@ fun Contact.toRequest(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)

View File

@@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.abstracts.types.DisableNotification
import dev.inmo.tgbotapi.abstracts.types.ReplyMessageId
import dev.inmo.tgbotapi.abstracts.types.WithReplyParameters
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
@@ -26,13 +26,11 @@ data class SendDice(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : ReplyingMarkupSendMessageRequest<ContentMessage<DiceContent>>, ReplyMessageId, DisableNotification {
) : ReplyingMarkupSendMessageRequest<ContentMessage<DiceContent>>, WithReplyParameters, DisableNotification {
override val requestSerializer: SerializationStrategy<*>
get() = serializer()

View File

@@ -21,8 +21,7 @@ fun SendLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendLocation(
chatId,
@@ -35,8 +34,7 @@ fun SendLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -47,10 +45,9 @@ fun SendStaticLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) = SendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
fun SendLiveLocation(
chatId: ChatIdentifier,
@@ -63,8 +60,7 @@ fun SendLiveLocation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendLocation(
chatId,
@@ -77,8 +73,7 @@ fun SendLiveLocation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -104,10 +99,8 @@ data class SendLocation internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<LocationContent>>,

View File

@@ -28,8 +28,7 @@ fun SendTextMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendTextMessage(
chatId,
@@ -40,8 +39,7 @@ fun SendTextMessage(
linkPreviewOptions,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -52,8 +50,7 @@ fun SendTextMessage(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendTextMessage(
chatId,
@@ -64,8 +61,7 @@ fun SendTextMessage(
linkPreviewOptions,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -87,10 +83,8 @@ data class SendTextMessage internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<TextContent>>,

View File

@@ -38,10 +38,8 @@ data class SendVenue(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<VenueContent>>,
@@ -55,8 +53,7 @@ data class SendVenue(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): this(
chatId = chatId,
@@ -71,8 +68,7 @@ data class SendVenue(
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -88,8 +84,7 @@ fun Venue.toRequest(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): SendVenue = SendVenue(
chatId,
@@ -97,7 +92,6 @@ fun Venue.toRequest(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)

View File

@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.abstracts.types.*
interface SendMessageRequest<T: Any> : SendChatMessageRequest<T>,
ReplyMessageId,
WithReplyParameters,
DisableNotification,
ProtectContent,
OptionallyMessageThreadRequest

View File

@@ -24,10 +24,8 @@ data class SendGame (
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<GameContent>>,

View File

@@ -33,8 +33,7 @@ fun SendAnimation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AnimationContent>> {
val animationAsFile = animation as? MultipartFile
@@ -54,8 +53,7 @@ fun SendAnimation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -81,8 +79,7 @@ fun SendAnimation(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AnimationContent>> {
val animationAsFile = animation as? MultipartFile
@@ -102,8 +99,7 @@ fun SendAnimation(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -148,10 +144,8 @@ data class SendAnimationData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<AnimationContent>>,

View File

@@ -33,8 +33,7 @@ fun SendAudio(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AudioContent>> {
val audioAsFile = audio as? MultipartFile
@@ -53,8 +52,7 @@ fun SendAudio(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -79,8 +77,7 @@ fun SendAudio(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<AudioContent>> {
val audioAsFile = audio as? MultipartFile
@@ -99,8 +96,7 @@ fun SendAudio(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -143,10 +139,8 @@ data class SendAudioData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<AudioContent>>,

View File

@@ -38,8 +38,7 @@ fun SendDocument(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): Request<ContentMessage<DocumentContent>> {
@@ -56,8 +55,7 @@ fun SendDocument(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup,
disableContentTypeDetection
)
@@ -89,8 +87,7 @@ fun SendDocument(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): Request<ContentMessage<DocumentContent>> {
@@ -107,8 +104,7 @@ fun SendDocument(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup,
disableContentTypeDetection
)
@@ -155,10 +151,8 @@ data class SendDocumentData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null,
@SerialName(disableContentTypeDetectionField)

View File

@@ -22,10 +22,7 @@ import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.buildJsonArray
import kotlinx.serialization.json.jsonPrimitive
const val rawSendingMediaGroupsWarning = "Media groups contains restrictions related to combinations of media" +
" types. Currently it is possible to combine photo + video OR audio OR documents"
@@ -37,7 +34,7 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null
): Request<ContentMessage<MediaGroupContent<T>>> {
if (media.size !in mediaCountInMediaGroup) {
@@ -61,8 +58,7 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply
replyParameters
)
return (if (files.isEmpty()) {
@@ -87,9 +83,9 @@ inline fun SendPlaylist(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<AudioContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
) = SendMediaGroup<AudioContent>(chatId, media, threadId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply)
/**
* Use this method to be sure that you are correctly sending documents media group
@@ -103,9 +99,9 @@ inline fun SendDocumentsGroup(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<DocumentContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
) = SendMediaGroup<DocumentContent>(chatId, media, threadId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply)
/**
* Use this method to be sure that you are correctly sending visual media group
@@ -120,9 +116,9 @@ inline fun SendVisualMediaGroup(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<VisualMediaGroupPartContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
) = SendMediaGroup<VisualMediaGroupPartContent>(chatId, media, threadId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply)
private object MessagesListSerializer: KSerializer<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> {
private val serializer = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass<PossiblySentViaBotCommonMessage<MediaGroupPartContent>>())
@@ -150,10 +146,8 @@ data class SendMediaGroupData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
) : DataRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>>,
SendMessageRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> {
@SerialName(mediaField)

View File

@@ -28,8 +28,7 @@ fun SendPhoto(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> {
val data = SendPhotoData(
@@ -42,8 +41,7 @@ fun SendPhoto(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
return if (photo is MultipartFile) {
@@ -64,8 +62,7 @@ fun SendPhoto(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<PhotoContent>> {
val data = SendPhotoData(
@@ -78,8 +75,7 @@ fun SendPhoto(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -116,10 +112,8 @@ data class SendPhotoData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<PhotoContent>>,

View File

@@ -9,13 +9,7 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.StickerContent
import dev.inmo.tgbotapi.utils.mapOfNotNull
import dev.inmo.tgbotapi.utils.toJsonWithoutNulls
import kotlinx.serialization.*
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.put
fun SendSticker(
chatId: ChatIdentifier,
@@ -24,8 +18,7 @@ fun SendSticker(
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<StickerContent>> = SendStickerByFileId(
chatId,
@@ -33,8 +26,7 @@ fun SendSticker(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
).let {
when (sticker) {
@@ -61,10 +53,8 @@ data class SendStickerByFileId internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<StickerContent>>, ReplyingMarkupSendMessageRequest<ContentMessage<StickerContent>> {

View File

@@ -34,8 +34,7 @@ fun SendVideo(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoContent>> {
val videoAsFile = video as? MultipartFile
@@ -56,8 +55,7 @@ fun SendVideo(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -84,8 +82,7 @@ fun SendVideo(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoContent>> {
val videoAsFile = video as? MultipartFile
@@ -106,8 +103,7 @@ fun SendVideo(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -154,10 +150,8 @@ data class SendVideoData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<VideoContent>>,

View File

@@ -21,8 +21,7 @@ fun SendVideoNote(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VideoNoteContent>> {
val videoNoteAsFile = videoNote as? MultipartFile
@@ -37,8 +36,7 @@ fun SendVideoNote(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -73,10 +71,8 @@ data class SendVideoNoteData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<VideoNoteContent>>,

View File

@@ -29,8 +29,7 @@ fun SendVoice(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VoiceContent>> {
val voiceAsFile = voice as? MultipartFile
@@ -45,8 +44,7 @@ fun SendVoice(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -68,8 +66,7 @@ fun SendVoice(
duration: Long? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): Request<ContentMessage<VoiceContent>> {
val voiceAsFile = voice as? MultipartFile
@@ -84,8 +81,7 @@ fun SendVoice(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -122,10 +118,8 @@ data class SendVoiceData internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<VoiceContent>>,

View File

@@ -64,16 +64,14 @@ data class SendInvoice(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null
) : CommonSendInvoiceData,
ChatRequest,
DisableNotification,
ReplyMessageId,
WithReplyParameters,
WithReplyMarkup,
SendMessageRequest<ContentMessage<InvoiceContent>> {
override fun method(): String = "sendInvoice"

View File

@@ -53,8 +53,7 @@ fun SendPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendRegularPoll(
chatId,
@@ -64,9 +63,8 @@ fun SendPoll(
isClosed,
threadId = threadId,
protectContent = protectContent,
allowSendingWithoutReply = allowSendingWithoutReply,
disableNotification = disableNotification,
replyToMessageId = replyToMessageId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -79,8 +77,7 @@ fun Poll.createRequest(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = when (this) {
is RegularPoll -> SendRegularPoll(
@@ -94,8 +91,7 @@ fun Poll.createRequest(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
is QuizPoll -> correctOptionId ?.let { correctOptionId ->
@@ -111,8 +107,7 @@ fun Poll.createRequest(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
} ?: SendRegularPoll(
@@ -126,8 +121,7 @@ fun Poll.createRequest(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
is UnknownPollType -> SendRegularPoll(
@@ -141,8 +135,7 @@ fun Poll.createRequest(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
}
@@ -209,10 +202,8 @@ data class SendRegularPoll(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendPoll() {
@@ -237,8 +228,7 @@ fun SendRegularPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendRegularPoll(
chatId,
@@ -252,8 +242,7 @@ fun SendRegularPoll(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -270,8 +259,7 @@ fun SendQuizPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendQuizPoll(
chatId,
@@ -287,8 +275,7 @@ fun SendQuizPoll(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -304,8 +291,7 @@ fun SendQuizPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendQuizPoll(
chatId,
@@ -321,8 +307,7 @@ fun SendQuizPoll(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -340,8 +325,7 @@ internal fun SendQuizPoll(
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = SendQuizPoll(
chatId,
@@ -358,8 +342,7 @@ internal fun SendQuizPoll(
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyParameters,
replyMarkup
)
@@ -393,10 +376,8 @@ data class SendQuizPoll internal constructor(
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
override val protectContent: Boolean = false,
@SerialName(replyToMessageIdField)
override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null,
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendPoll(), TextedOutput {

View File

@@ -85,17 +85,28 @@ fun Int.toChatId(): IdChatIdentifier = toLong().toChatId()
fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId()
@Serializable(ChatIdentifierSerializer::class)
data class Username(
@JvmInline
value class Username(
@Deprecated("Renamed", ReplaceWith("full"))
val username: String
) : ChatIdentifier {
val full: String
get() = username
val withoutAt
get() = full.dropWhile { it == '@' }
@Deprecated("Renamed", ReplaceWith("withoutAt"))
val usernameWithoutAt
get() = username.dropWhile { it == '@' }
get() = withoutAt
init {
if (!username.startsWith("@")) {
if (!full.startsWith("@")) {
throw IllegalArgumentException("Username must starts with `@`")
}
}
override fun toString(): String {
return full
}
}
fun String.toUsername(): Username = Username(this)
@@ -121,7 +132,7 @@ object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
override fun serialize(encoder: Encoder, value: ChatIdentifier) {
when (value) {
is IdChatIdentifier -> encoder.encodeLong(value.chatId)
is Username -> encoder.encodeString(value.username)
is Username -> encoder.encodeString(value.full)
}
}
}
@@ -159,7 +170,7 @@ object FullChatIdentifierSerializer : KSerializer<ChatIdentifier> {
when (value) {
is ChatId -> encoder.encodeLong(value.chatId)
is ChatIdWithThreadId -> encoder.encodeString("${value.chatId}/${value.threadId}")
is Username -> encoder.encodeString(value.username)
is Username -> encoder.encodeString(value.full)
}
}
}

View File

@@ -45,6 +45,11 @@ value class CustomEmojiId(
val appLink
get() = "${internalTgAppLinksBeginning}emoji?id=$this"
}
@Serializable
@JvmInline
value class StoryId(
val long: Long
)
typealias Seconds = Int
typealias MilliSeconds = Long
@@ -201,6 +206,10 @@ const val tgWebAppStartParamField = "tgWebAppStartParam"
const val chatIdField = "chat_id"
const val senderChatIdField = "sender_chat_id"
const val senderChatField = "sender_chat"
const val authorSignatureField = "author_signature"
const val senderUserField = "sender_user"
const val senderUserNameField = "sender_user_name"
const val messageIdField = "message_id"
const val giveawayMessageIdField = "giveaway_message_id"
const val messageIdsField = "message_ids"
@@ -215,7 +224,12 @@ const val disableNotificationField = "disable_notification"
const val protectContentField = "protect_content"
const val removeCaptionField = "remove_caption"
const val replyToMessageIdField = "reply_to_message_id"
const val replyParametersField = "reply_parameters"
const val allowSendingWithoutReplyField = "allow_sending_without_reply"
const val quoteField = "quote"
const val quoteParseModeField = "quote_parse_mode"
const val quoteEntitiesField = "quote_entities"
const val quotePositionField = "quote_position"
const val replyMarkupField = "reply_markup"
const val disableContentTypeDetectionField = "disable_content_type_detection"
const val supportStreamingField = "support_streaming"
@@ -236,6 +250,9 @@ const val accentColorIdField = "accent_color_id"
const val profileAccentColorIdField = "profile_accent_color_id"
const val backgroundCustomEmojiIdField = "background_custom_emoji_id"
const val profileBackgroundCustomEmojiIdField = "profile_background_custom_emoji_id"
const val hasVisibleHistoryField = "has_visible_history"
const val unrestrictBoostsCountField = "unrestrict_boost_count"
const val customEmojiStickerSetNameField = "custom_emoji_sticker_set_name"
const val iconCustomEmojiIdField = "icon_custom_emoji_id"
const val canJoinGroupsField = "can_join_groups"
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
@@ -486,6 +503,7 @@ const val isBigField = "is_big"
const val oldReactionField = "old_reaction"
const val newReactionField = "new_reaction"
const val chatField = "chat"
const val originField = "origin"
const val chatsField = "chats"
const val usernameField = "username"
const val bioField = "bio"
@@ -645,6 +663,7 @@ const val menuButtonField = "menu_button"
const val boostIdField = "boost_id"
const val boostField = "boost"
const val boostCountField = "boost_count"
const val addDateField = "add_date"
const val expirationDateField = "expiration_date"
const val removeDateField = "remove_date"
@@ -659,3 +678,4 @@ const val winnersField = "winners"
const val additionalChatCountField = "additional_chat_count"
const val unclaimedPrizeCountField = "unclaimed_prize_count"
const val wasRefundedField = "was_refunded"
const val isManualField = "is_manual"

View File

@@ -16,4 +16,4 @@ data class Contact(
val userId: UserId? = null,
@SerialName(vcardField)
override val vcard: String? = null
) : CommonContactData
) : CommonContactData, ReplyInfo.External.ContentVariant

View File

@@ -1,10 +1,11 @@
package dev.inmo.tgbotapi.types
import kotlinx.serialization.Required
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
@Serializable
@Serializable(LinkPreviewOptions.Companion::class)
sealed interface LinkPreviewOptions {
val isDisabled: Boolean
val url: String?
@@ -12,9 +13,10 @@ sealed interface LinkPreviewOptions {
val preferLargeMedia: Boolean
val showAboveText: Boolean
@Serializable
@Serializable(LinkPreviewOptions.Companion::class)
data object Disabled : LinkPreviewOptions {
@Required
@EncodeDefault
@SerialName(isDisabledField)
override val isDisabled: Boolean = true
override val url: String?
@@ -27,7 +29,7 @@ sealed interface LinkPreviewOptions {
get() = false
}
@Serializable
@Serializable(LinkPreviewOptions.Companion::class)
data class Large(
@SerialName(urlField)
override val url: String?,
@@ -35,16 +37,18 @@ sealed interface LinkPreviewOptions {
override val showAboveText: Boolean
) : LinkPreviewOptions {
@Required
@EncodeDefault
@SerialName(isDisabledField)
override val isDisabled: Boolean = false
@Required
@EncodeDefault
@SerialName(preferLargeMediaField)
override val preferLargeMedia: Boolean = true
override val preferSmallMedia: Boolean
get() = false
}
@Serializable
@Serializable(LinkPreviewOptions.Companion::class)
data class Small(
@SerialName(urlField)
override val url: String?,
@@ -52,23 +56,26 @@ sealed interface LinkPreviewOptions {
override val showAboveText: Boolean
) : LinkPreviewOptions {
@Required
@EncodeDefault
@SerialName(isDisabledField)
override val isDisabled: Boolean = false
@Required
@EncodeDefault
@SerialName(preferSmallMediaField)
override val preferSmallMedia: Boolean = true
override val preferLargeMedia: Boolean
get() = false
}
@Serializable
data class Medium(
@Serializable(LinkPreviewOptions.Companion::class)
data class Default(
@SerialName(urlField)
override val url: String?,
@SerialName(showAboveTextField)
override val showAboveText: Boolean
) : LinkPreviewOptions {
@Required
@EncodeDefault
@SerialName(isDisabledField)
override val isDisabled: Boolean = false
override val preferSmallMedia: Boolean
@@ -76,4 +83,47 @@ sealed interface LinkPreviewOptions {
override val preferLargeMedia: Boolean
get() = false
}
@Serializable
private data class Surrogate(
@SerialName(isDisabledField)
val isDisabled: Boolean = false,
@SerialName(urlField)
val url: String? = null,
@SerialName(preferSmallMediaField)
val preferSmallMedia: Boolean = false,
@SerialName(preferLargeMediaField)
val preferLargeMedia: Boolean = false,
@SerialName(showAboveTextField)
val showAboveText: Boolean = false,
)
companion object : KSerializer<LinkPreviewOptions> {
override val descriptor: SerialDescriptor
get() = Surrogate.serializer().descriptor
override fun deserialize(decoder: Decoder): LinkPreviewOptions {
val surrogate = Surrogate.serializer().deserialize(decoder)
return when {
surrogate.isDisabled -> Disabled
surrogate.preferLargeMedia -> Large(surrogate.url, surrogate.showAboveText)
surrogate.preferSmallMedia -> Small(surrogate.url, surrogate.showAboveText)
else -> Default(surrogate.url, surrogate.showAboveText)
}
}
override fun serialize(encoder: Encoder, value: LinkPreviewOptions) {
Surrogate.serializer().serialize(
encoder,
Surrogate(
isDisabled = value.isDisabled,
url = value.url,
preferSmallMedia = value.preferSmallMedia,
preferLargeMedia = value.preferLargeMedia,
showAboveText = value.showAboveText
)
)
}
}
}

View File

@@ -9,13 +9,15 @@ import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.*
@Serializable(MenuButtonSerializer::class)
@OptIn(ExperimentalSerializationApi::class)
sealed interface MenuButton {
@Required
@EncodeDefault
val type: String
@Serializable
object Commands : MenuButton {
@Required
@EncodeDefault
override val type: String
get() = "commands"
}
@@ -27,6 +29,7 @@ sealed interface MenuButton {
val webApp: WebAppInfo
) : MenuButton {
@Required
@EncodeDefault
override val type: String
get() = Companion.type
@@ -39,6 +42,7 @@ sealed interface MenuButton {
@Serializable
object Default : MenuButton {
@Required
@EncodeDefault
override val type: String
get() = "default"
}

View File

@@ -0,0 +1,182 @@
package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.abstracts.SpoilerableData
import dev.inmo.tgbotapi.types.chat.SuperPublicChat
import dev.inmo.tgbotapi.types.dice.Dice
import dev.inmo.tgbotapi.types.files.*
import dev.inmo.tgbotapi.types.games.RawGame
import dev.inmo.tgbotapi.types.giveaway.GiveawayPublicResults
import dev.inmo.tgbotapi.types.giveaway.Giveaway
import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.message.MessageOrigin
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.payments.Invoice
import dev.inmo.tgbotapi.types.polls.Poll
import dev.inmo.tgbotapi.types.stories.Story
import dev.inmo.tgbotapi.types.venue.Venue
import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
@ClassCastsIncluded
sealed interface ReplyInfo {
val messageMeta: Message.MetaInfo?
data class Internal(
val message: Message
): ReplyInfo {
override val messageMeta: Message.MetaInfo
get() = message.metaInfo
}
@Serializable
data class ToStory(
val story: Story
): ReplyInfo {
override val messageMeta: Message.MetaInfo?
get() = null
}
@Serializable(External.Companion::class)
sealed interface External : ReplyInfo {
val origin: MessageOrigin
val chat: SuperPublicChat?
interface ContentVariant
@Serializable
data class Text(
override val origin: MessageOrigin,
override val chat: SuperPublicChat?,
override val messageMeta: Message.MetaInfo?,
val linkPreviewOptions: LinkPreviewOptions?
) : External
@Serializable(External.Companion::class)
sealed interface Content : External {
val content: ContentVariant
@Serializable
data class Simple(
override val origin: MessageOrigin,
override val chat: SuperPublicChat?,
override val messageMeta: Message.MetaInfo?,
override val content: ContentVariant
) : Content
@Serializable
data class Media(
override val origin: MessageOrigin,
override val chat: SuperPublicChat?,
override val messageMeta: Message.MetaInfo?,
override val spoilered: Boolean,
override val content: MediaContentVariant
) : Content, SpoilerableData
}
@Serializable
private data class Surrogate(
val origin: MessageOrigin,
val chat: SuperPublicChat? = null,
val message_id: MessageId? = null,
val link_preview_options: LinkPreviewOptions? = null,
val has_media_spoiler: Boolean? = null,
private val story: Story? = null,
private val audio: AudioFile? = null,
private val document: DocumentFile? = null,
private val animation: AnimationFile? = null,
private val game: RawGame? = null,
@Serializable(PhotoSerializer::class)
private val photo: Photo? = null,
private val sticker: Sticker? = null,
private val video: VideoFile? = null,
private val voice: VoiceFile? = null,
private val video_note: VideoNoteFile? = null,
private val contact: Contact? = null,
private val location: Location? = null,
private val venue: Venue? = null,
private val poll: Poll? = null,
private val invoice: Invoice? = null,
private val dice: Dice? = null,
private val giveaway: Giveaway? = null,
private val giveaway_winners: GiveawayPublicResults? = null,
) {
val asExternalReplyInfo: External
get() {
val messageMeta = chat ?.let {
message_id ?.let {
Message.MetaInfo(
chat.id,
message_id
)
}
}
val content: ContentVariant? = when {
story != null -> story
audio != null -> audio
video != null -> video
video_note != null -> video_note
animation != null -> animation
document != null -> document
voice != null -> voice
photo != null -> photo
sticker != null -> sticker
dice != null -> dice
game != null -> game.asGame
contact != null -> contact
location != null -> location
venue != null -> venue
poll != null -> poll
invoice != null -> invoice
giveaway != null -> giveaway
giveaway_winners != null -> giveaway_winners
else -> null
}
return content ?.let {
when (it) {
is MediaContentVariant -> {
Content.Media(
origin,
chat,
messageMeta,
has_media_spoiler == true,
it
)
}
else -> Content.Simple(
origin,
chat,
messageMeta,
it
)
}
} ?: Text(
origin,
chat,
messageMeta,
link_preview_options
)
}
}
@RiskFeature("This serializer currently support only deserialization, but not serialization")
companion object : KSerializer<External> {
override val descriptor: SerialDescriptor
get() = Surrogate.serializer().descriptor
override fun deserialize(decoder: Decoder): External {
return Surrogate.serializer().deserialize(decoder).asExternalReplyInfo
}
override fun serialize(encoder: Encoder, value: External) {
}
}
}
}

View File

@@ -0,0 +1,153 @@
package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.abstracts.TextedInput
import dev.inmo.tgbotapi.abstracts.WithMessageId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.RawMessageEntity
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.asTextSources
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import dev.inmo.tgbotapi.utils.extensions.makeSourceString
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class ReplyParameters internal constructor(
@SerialName(chatIdField)
val chatIdentifier: ChatIdentifier,
@SerialName(messageIdField)
override val messageId: MessageId,
@SerialName(allowSendingWithoutReplyField)
val allowSendingWithoutReply: Boolean? = null,
@SerialName(quoteField)
val quote: String? = null,
@SerialName(quoteParseModeField)
val quoteParseMode: ParseMode? = null,
@SerialName(quoteEntitiesField)
private val quoteEntities: List<RawMessageEntity>? = null,
@SerialName(quotePositionField)
val quotePosition: Int?
) : WithMessageId, TextedInput {
override val text: String?
get() = quote
override val textSources: List<TextSource> by lazy {
quoteEntities ?.asTextSources(quote ?: return@lazy emptyList()) ?: emptyList()
}
constructor(
chatIdentifier: ChatIdentifier,
messageId: MessageId,
entities: TextSourcesList,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null
) : this(
chatIdentifier,
messageId,
allowSendingWithoutReply,
entities.makeSourceString(),
null,
entities.toRawMessageEntities(),
quotePosition
)
constructor(
metaInfo: Message.MetaInfo,
entities: TextSourcesList,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null
) : this(
metaInfo.chatId,
metaInfo.messageId,
entities,
allowSendingWithoutReply,
quotePosition
)
constructor(
message: Message,
entities: TextSourcesList,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null
) : this(
message.metaInfo,
entities,
allowSendingWithoutReply,
quotePosition
)
constructor(
chatIdentifier: ChatIdentifier,
messageId: MessageId,
quote: String,
quoteParseMode: ParseMode,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null
) : this(
chatIdentifier,
messageId,
allowSendingWithoutReply,
quote,
quoteParseMode,
null,
quotePosition
)
constructor(
metaInfo: Message.MetaInfo,
quote: String,
quoteParseMode: ParseMode,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null
) : this(
metaInfo.chatId,
metaInfo.messageId,
quote,
quoteParseMode,
allowSendingWithoutReply,
quotePosition
)
constructor(
message: Message,
quote: String,
quoteParseMode: ParseMode,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null
) : this(
message.metaInfo,
quote,
quoteParseMode,
allowSendingWithoutReply,
quotePosition
)
constructor(
chatIdentifier: ChatIdentifier,
messageId: MessageId,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null
) : this(
chatIdentifier,
messageId,
allowSendingWithoutReply,
null,
null,
null,
quotePosition
)
constructor(
metaInfo: Message.MetaInfo,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null
) : this(
metaInfo.chatId,
metaInfo.messageId,
allowSendingWithoutReply,
quotePosition
)
constructor(
message: Message,
allowSendingWithoutReply: Boolean? = null,
quotePosition: Int? = null
) : this(
message.metaInfo,
allowSendingWithoutReply,
quotePosition
)
}

View File

@@ -0,0 +1,38 @@
package dev.inmo.tgbotapi.types
import dev.inmo.tgbotapi.abstracts.TextedInput
import dev.inmo.tgbotapi.types.message.RawMessageEntities
import dev.inmo.tgbotapi.types.message.asTextSources
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.jvm.JvmName
@Serializable
data class TextQuote private constructor(
@SerialName(textField)
override val text: String,
@SerialName(positionField)
val position: Int,
@SerialName(entitiesField)
private val entities: RawMessageEntities? = null,
@SerialName(isManualField)
val isManual: Boolean = false
) : TextedInput {
override val textSources: List<TextSource> by lazy {
(entities ?: emptyList()).asTextSources(text)
}
companion object {
@JvmName("PublicConstructor")
operator fun invoke(
text: String,
position: Int,
textSources: List<TextSource> = emptyList(),
isManual: Boolean = false
) = TextQuote(
text, position, textSources.toRawMessageEntities(position), isManual
)
}
}

View File

@@ -16,14 +16,16 @@ const val UPDATE_CHAT_MEMBER = "chat_member"
const val UPDATE_CHAT_JOIN_REQUEST = "chat_join_request"
const val UPDATE_MESSAGE_REACTION = "message_reaction"
const val UPDATE_MESSAGE_REACTION_COUNT = "message_reaction_count"
const val UPDATE_CHAT_BOOST = "chat_boost"
const val UPDATE_REMOVE_CHAT_BOOST = "removed_chat_boost"
val ALL_UPDATES_LIST = listOf(
val ALL_UPDATES_LIST_WITHOUT_REACTIONS = listOf(
UPDATE_MESSAGE,
UPDATE_EDITED_MESSAGE,
UPDATE_CHANNEL_POST,
UPDATE_EDITED_CHANNEL_POST,
UPDATE_CHOSEN_INLINE_RESULT,
UPDATE_INLINE_QUERY,
UPDATE_CHOSEN_INLINE_RESULT,
UPDATE_CALLBACK_QUERY,
UPDATE_SHIPPING_QUERY,
UPDATE_PRE_CHECKOUT_QUERY,
@@ -32,23 +34,11 @@ val ALL_UPDATES_LIST = listOf(
UPDATE_MY_CHAT_MEMBER,
UPDATE_CHAT_MEMBER,
UPDATE_CHAT_JOIN_REQUEST,
UPDATE_CHAT_BOOST,
UPDATE_REMOVE_CHAT_BOOST
)
val ALL_UPDATES_LIST = ALL_UPDATES_LIST_WITHOUT_REACTIONS + listOf(
UPDATE_MESSAGE_REACTION,
UPDATE_MESSAGE_REACTION_COUNT
)
val ALL_UPDATES_LIST_WITHOUT_REACTIONS = listOf(
UPDATE_MESSAGE,
UPDATE_EDITED_MESSAGE,
UPDATE_CHANNEL_POST,
UPDATE_EDITED_CHANNEL_POST,
UPDATE_CHOSEN_INLINE_RESULT,
UPDATE_INLINE_QUERY,
UPDATE_CALLBACK_QUERY,
UPDATE_SHIPPING_QUERY,
UPDATE_PRE_CHECKOUT_QUERY,
UPDATE_POLL,
UPDATE_POLL_ANSWER,
UPDATE_MY_CHAT_MEMBER,
UPDATE_CHAT_MEMBER,
UPDATE_CHAT_JOIN_REQUEST
)

View File

@@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.types.abstracts
import dev.inmo.tgbotapi.types.TextQuote
interface WithOptionalQuoteInfo {
val quote: TextQuote?
}

View File

@@ -4,10 +4,7 @@ import dev.inmo.tgbotapi.abstracts.WithMessageId
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.PreviewUser
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Required
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
@@ -31,6 +28,7 @@ sealed interface ChatBoostSource {
override val user: PreviewUser
) : ByUser {
@Required
@EncodeDefault
@SerialName(sourceField)
override val sourceName: String = sourceCode
@@ -45,6 +43,7 @@ sealed interface ChatBoostSource {
override val user: PreviewUser
) : ByUser {
@Required
@EncodeDefault
@SerialName(sourceField)
override val sourceName: String = sourceCode
@@ -67,9 +66,11 @@ sealed interface ChatBoostSource {
override val user: PreviewUser
) : Giveaway, ByUser {
@Required
@EncodeDefault
@SerialName(sourceField)
override val sourceName: String = Giveaway.sourceCode
@Required
@EncodeDefault
@SerialName(isUnclaimedField)
override val unclaimed: Boolean = false
}
@@ -80,9 +81,11 @@ sealed interface ChatBoostSource {
override val messageId: MessageId
) : Giveaway {
@Required
@EncodeDefault
@SerialName(sourceField)
override val sourceName: String = Giveaway.sourceCode
@Required
@EncodeDefault
@SerialName(isUnclaimedField)
override val unclaimed: Boolean = true
@SerialName(userField)
@@ -104,6 +107,7 @@ sealed interface ChatBoostSource {
@Serializable
private data class Surrogate(
@Required
@EncodeDefault
@SerialName(sourceField)
val sourceName: String,
@SerialName(userField)

View File

@@ -65,6 +65,7 @@ data class RequestLocationKeyboardButton(
) : KeyboardButton {
@SerialName(requestLocationField)
@Required
@EncodeDefault
val requestLocation: Boolean = true
}

View File

@@ -17,12 +17,15 @@ import kotlinx.serialization.encoding.Encoder
sealed interface KeyboardButtonRequestUsers {
val requestId: RequestId
val isBot: Boolean?
val isPremium: Boolean?
val maxCount: Int
@Serializable
data class Any(
@SerialName(requestIdField)
override val requestId: RequestId,
@SerialName(userIsPremiumField)
override val isPremium: Boolean? = null,
@SerialName(maxQuantityField)
override val maxCount: Int = keyboardButtonRequestUserLimit.first
) : KeyboardButtonRequestUsers {
@@ -36,7 +39,7 @@ sealed interface KeyboardButtonRequestUsers {
@SerialName(requestIdField)
override val requestId: RequestId,
@SerialName(userIsPremiumField)
val isPremium: Boolean? = null,
override val isPremium: Boolean? = null,
@SerialName(maxQuantityField)
override val maxCount: Int = keyboardButtonRequestUserLimit.first
) : KeyboardButtonRequestUsers {
@@ -55,6 +58,8 @@ sealed interface KeyboardButtonRequestUsers {
@SerialName(userIsBotField)
@EncodeDefault
override val isBot: Boolean = true
override val isPremium: Boolean?
get() = null
}
@Serializer(KeyboardButtonRequestUsers::class)
@@ -80,7 +85,7 @@ sealed interface KeyboardButtonRequestUsers {
return when (surrogate.userIsBot) {
true -> Bot(surrogate.requestId, surrogate.maxCount)
false -> Common(surrogate.requestId, surrogate.userIsPremium, surrogate.maxCount)
null -> Any(surrogate.requestId, surrogate.maxCount)
null -> Any(surrogate.requestId, surrogate.userIsPremium, surrogate.maxCount)
}
}

View File

@@ -11,6 +11,7 @@ data class ReplyForce(
) : KeyboardMarkup {
@SerialName(forceReplyField)
@Required
@EncodeDefault
val forceReply: Boolean = true
companion object {

View File

@@ -8,5 +8,6 @@ data class ReplyKeyboardRemove(
) : KeyboardMarkup {
@SerialName("remove_keyboard")
@Required
@EncodeDefault
val removeKeyboard: Boolean = true
}

Some files were not shown because too many files have changed in this diff Show More