1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

Merge pull request #675 from InsanusMokrassar/4.0.0

4.0.0
This commit is contained in:
InsanusMokrassar 2022-11-09 00:14:48 +06:00 committed by GitHub
commit 46fdbc02e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
181 changed files with 3219 additions and 1723 deletions

View File

@ -1,5 +1,20 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 4.0.0
**!!! THIS UPDATE CONTAINS FULL REWORK OF MEDIA GROUPS FUNCTIONALITY !!!**
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Common`:
* All the media groups have been rewritten. Since this update, there are no separated messages types for media groups,
but new type of content (`MediaGroupContent`) has been introduced
* [Bot API 6.3](https://core.telegram.org/bots/api-changelog#november-5-2022) support
* `Versions`:
* `MicroUtils`: `0.13.2` -> `0.14.0`
* `Core`:
* New requests
## 3.3.1 ## 3.3.1
* `Versions`: * `Versions`:

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.2-blue)](https://core.telegram.org/bots/api-changelog#august-12-2022) # 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.3-blue)](https://core.telegram.org/bots/api-changelog#november-5-2022)
| 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=Bookstack&message=Tutorial&color=blue&logo=bookstack)](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) | | 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=Bookstack&message=Tutorial&color=blue&logo=bookstack)](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|:---:|:---:| |:---:|:---:|

View File

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

View File

@ -13,7 +13,7 @@ ktor = "2.1.3"
ksp = "1.7.20-1.0.8" ksp = "1.7.20-1.0.8"
kotlin-poet = "1.12.0" kotlin-poet = "1.12.0"
microutils = "0.13.2" microutils = "0.14.0"
github-release-plugin = "2.4.1" github-release-plugin = "2.4.1"

View File

@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.ForwardMessage import dev.inmo.tgbotapi.requests.ForwardMessage
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.Message
@ -11,46 +12,52 @@ suspend fun TelegramBot.forwardMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = execute( ) = execute(
ForwardMessage(fromChatId, toChatId, messageId, disableNotification, protectContent) ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent)
) )
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
fromChat: Chat, fromChat: Chat,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification, protectContent) ) = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChat: Chat, toChat: Chat,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification, protectContent) ) = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
fromChat: Chat, fromChat: Chat,
toChat: Chat, toChat: Chat,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification, protectContent) ) = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
message: Message, message: Message,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification, protectContent) ) = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( suspend fun TelegramBot.forwardMessage(
toChat: Chat, toChat: Chat,
message: Message, message: Message,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(message.chat, toChat, message.messageId, disableNotification, protectContent) ) = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent)

View File

@ -1,70 +1,57 @@
package dev.inmo.tgbotapi.extensions.api.InternalUtils package dev.inmo.tgbotapi.extensions.api.InternalUtils
import dev.inmo.tgbotapi.types.MediaGroupIdentifier import dev.inmo.tgbotapi.types.MediaGroupIdentifier
import dev.inmo.tgbotapi.types.UpdateIdentifier import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
import dev.inmo.tgbotapi.types.update.* import dev.inmo.tgbotapi.types.update.*
import dev.inmo.tgbotapi.types.update.abstracts.* import dev.inmo.tgbotapi.types.update.abstracts.*
import dev.inmo.tgbotapi.types.update.media_group.* import dev.inmo.tgbotapi.utils.extensions.asMediaGroupMessage
internal fun Update.lastUpdateIdentifier(): UpdateIdentifier {
return if (this is SentMediaGroupUpdate) {
origins.last().updateId
} else {
updateId
}
}
internal fun List<Update>.lastUpdateIdentifier(): UpdateIdentifier? {
return maxByOrNull { it.updateId } ?.lastUpdateIdentifier()
}
/**
* Will convert incoming list of updates to list with [MediaGroupUpdate]s
*/
internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> { internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
val resultUpdates = mutableListOf<Update>() val resultUpdates = mutableListOf<Update>()
val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<BaseSentMessageUpdate>>() val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<Pair<BaseSentMessageUpdate, PossiblySentViaBotCommonMessage<MediaGroupPartContent>>>>()
for (update in this) { for (update in this) {
val data = (update.data as? MediaGroupMessage<*>) val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let {
if (data == null) { if (it.content is MediaGroupPartContent) {
it as PossiblySentViaBotCommonMessage<MediaGroupPartContent>
} else {
null
}
}
val mediaGroupId = message ?.mediaGroupId
if (message == null || mediaGroupId == null) {
resultUpdates.add(update) resultUpdates.add(update)
continue continue
} }
when (update) { when (update) {
is BaseEditMessageUpdate -> resultUpdates.add(
update.toEditMediaGroupUpdate()
)
is BaseSentMessageUpdate -> { is BaseSentMessageUpdate -> {
mediaGroups.getOrPut(data.mediaGroupId) { mediaGroups.getOrPut(mediaGroupId) {
mutableListOf() mutableListOf()
}.add(update) }.add(update to message)
} }
else -> resultUpdates.add(update) else -> resultUpdates.add(update)
} }
} }
mediaGroups.values.map {
it.toSentMediaGroupUpdate() ?.let { mediaGroupUpdate -> mediaGroups.map { (_, updatesWithMessages) ->
resultUpdates.add(mediaGroupUpdate) val update = updatesWithMessages.maxBy { it.first.updateId }.first
} resultUpdates.add(
update.copy(updatesWithMessages.map { it.second }.asMediaGroupMessage())
)
} }
resultUpdates.sortBy { it.updateId } resultUpdates.sortBy { it.updateId }
return resultUpdates return resultUpdates
} }
internal fun List<BaseSentMessageUpdate>.toSentMediaGroupUpdate(): SentMediaGroupUpdate? = (this as? SentMediaGroupUpdate) ?: let { /**
if (isEmpty()) { * @return [EditMessageMediaGroupUpdate] in case if [this] is [EditMessageUpdate]. When [this] object is
return@let null * [EditChannelPostUpdate] instance - will return [EditChannelPostMediaGroupUpdate]
} *
val resultList = sortedBy { it.updateId } * @throws IllegalStateException
when (first()) { */
is MessageUpdate -> MessageMediaGroupUpdate(resultList) internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate() = this
is ChannelPostUpdate -> ChannelPostMediaGroupUpdate(resultList)
else -> null
}
}
internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate(): EditMediaGroupUpdate = (this as? EditMediaGroupUpdate) ?: let {
when (this) {
is EditMessageUpdate -> EditMessageMediaGroupUpdate(this)
is EditChannelPostUpdate -> EditChannelPostMediaGroupUpdate(this)
else -> error("Unsupported type of ${BaseEditMessageUpdate::class.simpleName}")
}
}

View File

@ -5,7 +5,9 @@ import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
import dev.inmo.tgbotapi.abstracts.* import dev.inmo.tgbotapi.abstracts.*
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
import dev.inmo.tgbotapi.bot.TelegramBot 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.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.send.send
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
@ -39,6 +41,7 @@ suspend fun TelegramBot.handleLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
locationsFlow: Flow<EditLiveLocationInfo>, locationsFlow: Flow<EditLiveLocationInfo>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -56,7 +59,7 @@ suspend fun TelegramBot.handleLiveLocation(
val capturedLiveLocationMessage = currentLiveLocationMessage val capturedLiveLocationMessage = currentLiveLocationMessage
if (capturedLiveLocationMessage == null) { if (capturedLiveLocationMessage == null) {
updateMessageJob.start() updateMessageJob.start()
currentLiveLocationMessage = sendLiveLocation( currentLiveLocationMessage = send(
chatId, chatId,
it.latitude, it.latitude,
it.longitude, it.longitude,
@ -64,6 +67,7 @@ suspend fun TelegramBot.handleLiveLocation(
it.horizontalAccuracy, it.horizontalAccuracy,
it.heading, it.heading,
it.proximityAlertRadius, it.proximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -71,7 +75,7 @@ suspend fun TelegramBot.handleLiveLocation(
it.replyMarkup it.replyMarkup
) )
} else { } else {
editLiveLocation( edit(
capturedLiveLocationMessage, capturedLiveLocationMessage,
it.latitude, it.latitude,
it.longitude, it.longitude,
@ -94,6 +98,7 @@ suspend fun TelegramBot.handleLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
locationsFlow: Flow<Location>, locationsFlow: Flow<Location>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -112,6 +117,7 @@ suspend fun TelegramBot.handleLiveLocation(
) )
}, },
liveTimeMillis, liveTimeMillis,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -129,6 +135,7 @@ suspend fun TelegramBot.handleLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
locationsFlow: Flow<Pair<Double, Double>>, locationsFlow: Flow<Pair<Double, Double>>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -143,6 +150,7 @@ suspend fun TelegramBot.handleLiveLocation(
) )
}, },
liveTimeMillis, liveTimeMillis,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,

View File

@ -90,6 +90,7 @@ suspend fun TelegramBot.startLiveLocation(
initHorizontalAccuracy: Meters? = null, initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -106,6 +107,7 @@ suspend fun TelegramBot.startLiveLocation(
initHorizontalAccuracy, initHorizontalAccuracy,
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -135,6 +137,7 @@ suspend fun TelegramBot.startLiveLocation(
initHorizontalAccuracy: Meters? = null, initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -149,6 +152,7 @@ suspend fun TelegramBot.startLiveLocation(
initHorizontalAccuracy, initHorizontalAccuracy,
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -168,6 +172,7 @@ suspend fun TelegramBot.startLiveLocation(
initHorizontalAccuracy: Meters? = null, initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -182,6 +187,7 @@ suspend fun TelegramBot.startLiveLocation(
initHorizontalAccuracy, initHorizontalAccuracy,
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -201,6 +207,7 @@ suspend fun TelegramBot.startLiveLocation(
initHorizontalAccuracy: Meters? = null, initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -215,6 +222,7 @@ suspend fun TelegramBot.startLiveLocation(
initHorizontalAccuracy, initHorizontalAccuracy,
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -235,6 +243,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHorizontalAccuracy: Meters? = null, initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
@ -248,6 +257,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHorizontalAccuracy, initHorizontalAccuracy,
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,
@ -267,6 +277,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHorizontalAccuracy: Meters? = null, initHorizontalAccuracy: Meters? = null,
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
@ -279,6 +290,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHorizontalAccuracy, initHorizontalAccuracy,
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,

View File

@ -0,0 +1,28 @@
package dev.inmo.tgbotapi.extensions.api.chat.forum
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.forum.CloseForumTopic
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.closeForumTopic(
chatId: ChatIdentifier,
messageThreadId: MessageThreadId
) = execute(
CloseForumTopic(
chatId,
messageThreadId
)
)
suspend fun TelegramBot.closeForumTopic(
chat: Chat,
messageThreadId: MessageThreadId
) = closeForumTopic(chat.id, messageThreadId)
suspend fun TelegramBot.closeForumTopic(
chat: Chat,
forumTopic: ForumTopic
) = closeForumTopic(chat.id, forumTopic.messageThreadId)

View File

@ -0,0 +1,29 @@
package dev.inmo.tgbotapi.extensions.api.chat.forum
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.CustomEmojiId
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.utils.RGBColor
suspend fun TelegramBot.createForumTopic(
chatId: ChatIdentifier,
name: String,
color: RGBColor,
iconEmojiId: CustomEmojiId? = null
) = execute(
CreateForumTopic(
chatId,
name,
color,
iconEmojiId
)
)
suspend fun TelegramBot.createForumTopic(
chat: Chat,
name: String,
color: RGBColor,
iconEmojiId: CustomEmojiId? = null
) = createForumTopic(chat.id, name, color, iconEmojiId)

View File

@ -0,0 +1,33 @@
package dev.inmo.tgbotapi.extensions.api.chat.forum
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.forum.DeleteForumTopic
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.deleteForumTopic(
chatId: ChatIdentifier,
messageThreadId: MessageThreadId
) = execute(
DeleteForumTopic(
chatId,
messageThreadId
)
)
suspend fun TelegramBot.deleteForumTopic(
chatId: ChatIdentifier,
forumTopic: ForumTopic
) = deleteForumTopic(chatId, forumTopic.messageThreadId)
suspend fun TelegramBot.deleteForumTopic(
chat: Chat,
messageThreadId: MessageThreadId
) = deleteForumTopic(chat.id, messageThreadId)
suspend fun TelegramBot.deleteForumTopic(
chat: Chat,
forumTopic: ForumTopic
) = deleteForumTopic(chat.id, forumTopic.messageThreadId)

View File

@ -0,0 +1,36 @@
package dev.inmo.tgbotapi.extensions.api.chat.forum
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.forum.EditForumTopic
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.CustomEmojiId
import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.editForumTopic(
chatId: ChatIdentifier,
messageThreadId: MessageThreadId,
name: String,
iconEmojiId: CustomEmojiId
) = execute(
EditForumTopic(
chatId,
messageThreadId,
name,
iconEmojiId
)
)
suspend fun TelegramBot.editForumTopic(
chat: Chat,
messageThreadId: MessageThreadId,
name: String,
iconEmojiId: CustomEmojiId
) = editForumTopic(chat.id, messageThreadId, name, iconEmojiId)
suspend fun TelegramBot.editForumTopic(
chatIdentifier: ChatIdentifier,
forumTopic: ForumTopic,
iconEmojiId: CustomEmojiId = forumTopic.iconEmojiId ?: error("Icon emoji id in forum topic should be presented when edit forum topic basing on other forum topic object")
) = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId)

View File

@ -0,0 +1,28 @@
package dev.inmo.tgbotapi.extensions.api.chat.forum
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.forum.ReopenForumTopic
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.reopenForumTopic(
chatId: ChatIdentifier,
messageThreadId: MessageThreadId
) = execute(
ReopenForumTopic(
chatId,
messageThreadId
)
)
suspend fun TelegramBot.reopenForumTopic(
chat: Chat,
messageThreadId: MessageThreadId
) = reopenForumTopic(chat.id, messageThreadId)
suspend fun TelegramBot.reopenForumTopic(
chat: Chat,
forumTopic: ForumTopic
) = reopenForumTopic(chat.id, forumTopic.messageThreadId)

View File

@ -0,0 +1,28 @@
package dev.inmo.tgbotapi.extensions.api.chat.forum
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.forum.UnpinAllForumTopicMessages
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.unpinAllForumTopicMessages(
chatId: ChatIdentifier,
messageThreadId: MessageThreadId
) = execute(
UnpinAllForumTopicMessages(
chatId,
messageThreadId
)
)
suspend fun TelegramBot.unpinAllForumTopicMessages(
chat: Chat,
messageThreadId: MessageThreadId
) = unpinAllForumTopicMessages(chat.id, messageThreadId)
suspend fun TelegramBot.unpinAllForumTopicMessages(
chat: Chat,
forumTopic: ForumTopic
) = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId)

View File

@ -3,7 +3,27 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.get.GetChat import dev.inmo.tgbotapi.requests.chat.get.GetChat
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.* import dev.inmo.tgbotapi.types.chat.ChannelChat
import dev.inmo.tgbotapi.types.chat.ChannelChatImpl
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChat
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChat
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChat
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedPublicChat
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChat
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedUser
import dev.inmo.tgbotapi.types.chat.GroupChat
import dev.inmo.tgbotapi.types.chat.GroupChatImpl
import dev.inmo.tgbotapi.types.chat.PrivateChat
import dev.inmo.tgbotapi.types.chat.PrivateChatImpl
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.SupergroupChat
import dev.inmo.tgbotapi.types.chat.SupergroupChatImpl
import dev.inmo.tgbotapi.utils.PreviewFeature import dev.inmo.tgbotapi.utils.PreviewFeature
suspend fun TelegramBot.getChat( suspend fun TelegramBot.getChat(

View File

@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.get.GetChatMenuButton import dev.inmo.tgbotapi.requests.chat.get.GetChatMenuButton
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.chat.PrivateChat import dev.inmo.tgbotapi.types.chat.PrivateChat
suspend fun TelegramBot.getChatMenuButton( suspend fun TelegramBot.getChatMenuButton(

View File

@ -2,7 +2,5 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.get.GetDefaultChatMenuButton import dev.inmo.tgbotapi.requests.chat.get.GetDefaultChatMenuButton
import dev.inmo.tgbotapi.requests.chat.modify.SetDefaultChatMenuButton
import dev.inmo.tgbotapi.types.MenuButton
suspend fun TelegramBot.getDefaultChatMenuButton() = execute(GetDefaultChatMenuButton) suspend fun TelegramBot.getDefaultChatMenuButton() = execute(GetDefaultChatMenuButton)

View File

@ -0,0 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.chat.get
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.get.GetForumTopicIconStickers
suspend fun TelegramBot.getForumTopicIconStickers() = execute(GetForumTopicIconStickers)

View File

@ -2,8 +2,10 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.ApproveChatJoinRequest import dev.inmo.tgbotapi.requests.chat.invite_links.ApproveChatJoinRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.* import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate

View File

@ -3,8 +3,11 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import com.soywiz.klock.DateTime import com.soywiz.klock.DateTime
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MembersLimit
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.toTelegramDate
suspend fun TelegramBot.createChatInviteLinkUnlimited( suspend fun TelegramBot.createChatInviteLinkUnlimited(
chatId: ChatIdentifier, chatId: ChatIdentifier,

View File

@ -2,8 +2,10 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.DeclineChatJoinRequest import dev.inmo.tgbotapi.requests.chat.invite_links.DeclineChatJoinRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.* import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate

View File

@ -3,8 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import com.soywiz.klock.DateTime import com.soywiz.klock.DateTime
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.ChatInviteLink
import dev.inmo.tgbotapi.types.MembersLimit
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.toTelegramDate
suspend fun TelegramBot.editChatInviteLinkUnlimited( suspend fun TelegramBot.editChatInviteLinkUnlimited(
chatId: ChatIdentifier, chatId: ChatIdentifier,

View File

@ -2,7 +2,10 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.BanChatMember import dev.inmo.tgbotapi.requests.chat.members.BanChatMember
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User

View File

@ -2,7 +2,8 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.BanChatSenderChat import dev.inmo.tgbotapi.requests.chat.members.BanChatSenderChat
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
suspend fun TelegramBot.banChatSenderChat( suspend fun TelegramBot.banChatSenderChat(

View File

@ -2,7 +2,9 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.GetChatMember import dev.inmo.tgbotapi.requests.chat.members.GetChatMember
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User

View File

@ -2,7 +2,10 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
@ -20,7 +23,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null, canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = execute( ) = execute(
PromoteChatMember( PromoteChatMember(
chatId, chatId,
@ -36,7 +40,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages, canPinMessages,
canPromoteMembers, canPromoteMembers,
canManageVideoChats, canManageVideoChats,
canManageChat canManageChat,
canManageTopics
) )
) )
@ -54,7 +59,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null, canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = promoteChatMember( ) = promoteChatMember(
chat.id, chat.id,
userId, userId,
@ -69,7 +75,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages, canPinMessages,
canPromoteMembers, canPromoteMembers,
canManageVideoChats, canManageVideoChats,
canManageChat canManageChat,
canManageTopics
) )
suspend fun TelegramBot.promoteChatMember( suspend fun TelegramBot.promoteChatMember(
@ -86,7 +93,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null, canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = promoteChatMember( ) = promoteChatMember(
chatId, chatId,
user.id, user.id,
@ -101,7 +109,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages, canPinMessages,
canPromoteMembers, canPromoteMembers,
canManageVideoChats, canManageVideoChats,
canManageChat canManageChat,
canManageTopics
) )
suspend fun TelegramBot.promoteChatMember( suspend fun TelegramBot.promoteChatMember(
@ -118,7 +127,8 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages: Boolean? = null, canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null canManageChat: Boolean? = null,
canManageTopics: Boolean? = null
) = promoteChatMember( ) = promoteChatMember(
chat.id, chat.id,
user.id, user.id,
@ -133,5 +143,6 @@ suspend fun TelegramBot.promoteChatMember(
canPinMessages, canPinMessages,
canPromoteMembers, canPromoteMembers,
canManageVideoChats, canManageVideoChats,
canManageChat canManageChat,
canManageTopics
) )

View File

@ -2,8 +2,12 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.RestrictChatMember import dev.inmo.tgbotapi.requests.chat.members.RestrictChatMember
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.chat.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.ChatPermissions
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
suspend fun TelegramBot.restrictChatMember( suspend fun TelegramBot.restrictChatMember(

View File

@ -2,7 +2,8 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.SetChatAdministratorCustomTitle import dev.inmo.tgbotapi.requests.chat.members.SetChatAdministratorCustomTitle
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User

View File

@ -2,7 +2,9 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.UnbanChatMember import dev.inmo.tgbotapi.requests.chat.members.UnbanChatMember
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User

View File

@ -1,8 +1,9 @@
package dev.inmo.tgbotapi.extensions.api.chat.members package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.* import dev.inmo.tgbotapi.requests.chat.members.UnbanChatSenderChat
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
suspend fun TelegramBot.unbanChatSenderChat( suspend fun TelegramBot.unbanChatSenderChat(

View File

@ -1,8 +1,9 @@
package dev.inmo.tgbotapi.extensions.api.chat.modify package dev.inmo.tgbotapi.extensions.api.chat.modify
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.modify.* import dev.inmo.tgbotapi.requests.chat.modify.SetChatMenuButton
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.MenuButton
import dev.inmo.tgbotapi.types.chat.PrivateChat import dev.inmo.tgbotapi.types.chat.PrivateChat
suspend fun TelegramBot.setChatMenuButton( suspend fun TelegramBot.setChatMenuButton(

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.send.CopyMessage
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
@ -20,6 +21,7 @@ suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -32,6 +34,7 @@ suspend inline fun TelegramBot.copyMessage(
toChatId, toChatId,
text, text,
parseMode, parseMode,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -50,12 +53,13 @@ suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -67,12 +71,13 @@ suspend inline fun TelegramBot.copyMessage(
toChat: Chat, toChat: Chat,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -84,12 +89,13 @@ suspend inline fun TelegramBot.copyMessage(
toChat: Chat, toChat: Chat,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -101,6 +107,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -112,6 +119,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
toChatId, toChatId,
entities, entities,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -129,12 +137,13 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChatId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChatId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -145,12 +154,13 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
toChat: Chat, toChat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, messageId, toChat.id, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChatId, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -161,12 +171,13 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
toChat: Chat, toChat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChat.id, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -177,12 +188,13 @@ suspend inline fun TelegramBot.copyMessage(
message: Message, message: Message,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -193,12 +205,13 @@ suspend inline fun TelegramBot.copyMessage(
message: Message, message: Message,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -208,12 +221,13 @@ suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
message: Message, message: Message,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChatId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChatId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -223,12 +237,13 @@ suspend inline fun TelegramBot.copyMessage(
toChat: Chat, toChat: Chat,
message: Message, message: Message,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChat, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChat, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -240,6 +255,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -252,6 +268,7 @@ suspend inline fun TelegramBot.copyMessage(
toChatId, toChatId,
text, text,
parseMode, parseMode,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -270,6 +287,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -281,6 +299,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
text, text,
parseMode, parseMode,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -298,6 +317,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -309,6 +329,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
text, text,
parseMode, parseMode,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -326,6 +347,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -337,6 +359,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
text, text,
parseMode, parseMode,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -354,6 +377,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -365,6 +389,7 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
toChatId, toChatId,
entities, entities,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -382,6 +407,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChat: Chat, fromChat: Chat,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -392,6 +418,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChat.id, fromChat.id,
messageId, messageId,
entities, entities,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -408,6 +435,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -418,6 +446,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChatId, fromChatId,
messageId, messageId,
entities, entities,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -434,6 +463,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChat: Chat, fromChat: Chat,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -444,6 +474,7 @@ suspend inline fun TelegramBot.copyMessage(
fromChat.id, fromChat.id,
messageId, messageId,
entities, entities,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,

View File

@ -1,173 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.send.media.sendMediaGroup
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.media.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
import dev.inmo.tgbotapi.types.update.media_group.SentMediaGroupUpdate
/**
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
* will be copied as they are
*/
suspend inline fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
messages: List<MediaGroupMessage<MediaGroupContent>>,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
): List<MediaGroupMessage<MediaGroupContent>> {
val first = messages.first().content.toMediaGroupMemberTelegramMedia().let {
if (text != null) {
when (it) {
is TelegramMediaAudio -> it.copy(text = text, parseMode = parseMode)
is TelegramMediaDocument -> it.copy(text = text, parseMode = parseMode)
is TelegramMediaPhoto -> it.copy(text = text, parseMode = parseMode)
is TelegramMediaVideo -> it.copy(text = text, parseMode = parseMode)
}
} else {
it
}
}
return sendMediaGroup(
toChatId,
listOf(first) + messages.drop(1).map {
it.content.toMediaGroupMemberTelegramMedia()
},
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply
)
}
/**
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
* will be copied as they are
*/
suspend inline fun TelegramBot.copyMessages(
toChat: Chat,
messages: List<MediaGroupMessage<MediaGroupContent>>,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
) = copyMessages(toChat.id, messages, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
/**
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
* will be copied as they are
*/
suspend inline fun TelegramBot.copyMessages(
toChat: ChatIdentifier,
update: SentMediaGroupUpdate,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
) = copyMessages(toChat, update.data, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
/**
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
* will be copied as they are
*/
suspend inline fun TelegramBot.copyMessages(
toChat: Chat,
update: SentMediaGroupUpdate,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
) = copyMessages(toChat.id, update, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
/**
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
* will be copied as they are
*/
suspend inline fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
messages: List<MediaGroupMessage<MediaGroupContent>>,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
): List<MediaGroupMessage<MediaGroupContent>> {
val first = messages.first().content.toMediaGroupMemberTelegramMedia().let {
when (it) {
is TelegramMediaAudio -> TelegramMediaAudio(it.file, entities, it.duration, it.performer, it.title, it.thumb)
is TelegramMediaDocument -> TelegramMediaDocument(it.file, entities, it.thumb, it.disableContentTypeDetection)
is TelegramMediaPhoto -> TelegramMediaPhoto(it.file, entities)
is TelegramMediaVideo -> TelegramMediaVideo(it.file, entities, it.width, it.height, it.duration, it.thumb)
}
}
return sendMediaGroup(
toChatId,
listOf(first) + messages.drop(1).map {
it.content.toMediaGroupMemberTelegramMedia()
},
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply
)
}
/**
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
* will be copied as they are
*/
suspend inline fun TelegramBot.copyMessages(
toChat: Chat,
messages: List<MediaGroupMessage<MediaGroupContent>>,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
) = copyMessages(toChat.id, messages, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
/**
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
* will be copied as they are
*/
suspend inline fun TelegramBot.copyMessages(
toChat: ChatIdentifier,
update: SentMediaGroupUpdate,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
) = copyMessages(toChat, update.data, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
/**
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
* will be copied as they are
*/
suspend inline fun TelegramBot.copyMessages(
toChat: Chat,
update: SentMediaGroupUpdate,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null
) = copyMessages(toChat.id, update, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)

View File

@ -23,6 +23,7 @@ import dev.inmo.tgbotapi.types.files.Sticker
import dev.inmo.tgbotapi.types.games.Game import dev.inmo.tgbotapi.types.games.Game
import dev.inmo.tgbotapi.types.location.* import dev.inmo.tgbotapi.types.location.*
import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.payments.LabeledPrice import dev.inmo.tgbotapi.types.payments.LabeledPrice
@ -30,6 +31,7 @@ import dev.inmo.tgbotapi.types.payments.abstracts.Currency
import dev.inmo.tgbotapi.types.polls.* import dev.inmo.tgbotapi.types.polls.*
import dev.inmo.tgbotapi.types.venue.Venue import dev.inmo.tgbotapi.types.venue.Venue
import dev.inmo.tgbotapi.utils.* import dev.inmo.tgbotapi.utils.*
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlin.js.JsName import kotlin.js.JsName
import kotlin.jvm.JvmName import kotlin.jvm.JvmName
@ -55,6 +57,7 @@ suspend inline fun TelegramBot.reply(
phoneNumber, phoneNumber,
firstName, firstName,
lastName, lastName,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,
@ -76,6 +79,7 @@ suspend inline fun TelegramBot.reply(
) = sendContact( ) = sendContact(
to.chat, to.chat,
contact, contact,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,
@ -97,7 +101,7 @@ suspend inline fun TelegramBot.replyWithDice(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendDice(to.chat, animationType, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendDice(to.chat, animationType, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -131,6 +135,7 @@ suspend inline fun TelegramBot.reply(
to.chat, to.chat,
latitude, latitude,
longitude, longitude,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
allowSendingWithoutReply, allowSendingWithoutReply,
@ -152,6 +157,7 @@ suspend inline fun TelegramBot.reply(
) = sendLocation( ) = sendLocation(
to.chat, to.chat,
location, location,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
allowSendingWithoutReply, allowSendingWithoutReply,
@ -180,6 +186,7 @@ suspend inline fun TelegramBot.reply(
text, text,
parseMode, parseMode,
disableWebPagePreview, disableWebPagePreview,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,
@ -203,6 +210,7 @@ suspend inline fun TelegramBot.reply(
to.chat, to.chat,
entities, entities,
disableWebPagePreview, disableWebPagePreview,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,
@ -271,6 +279,7 @@ suspend inline fun TelegramBot.reply(
foursquareType = foursquareType, foursquareType = foursquareType,
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = to.threadIdOrNull,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = to.messageId, replyToMessageId = to.messageId,
@ -301,6 +310,7 @@ suspend inline fun TelegramBot.reply(
foursquareType = foursquareType, foursquareType = foursquareType,
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = to.threadIdOrNull,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = to.messageId, replyToMessageId = to.messageId,
@ -318,6 +328,7 @@ suspend inline fun TelegramBot.reply(
) = sendVenue( ) = sendVenue(
chat = to.chat, chat = to.chat,
venue = venue, venue = venue,
threadId = to.threadIdOrNull,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = to.messageId, replyToMessageId = to.messageId,
@ -336,7 +347,7 @@ suspend inline fun TelegramBot.replyWithGame(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
to.chat, gameShortName, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup to.chat, gameShortName, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.replyWithGame( suspend inline fun TelegramBot.replyWithGame(
@ -347,7 +358,7 @@ suspend inline fun TelegramBot.replyWithGame(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
to.chat, game.title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup to.chat, game.title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup
) )
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
@ -384,6 +395,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
duration, duration,
width, width,
height, height,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,
@ -403,7 +415,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithAnimation( suspend inline fun TelegramBot.replyWithAnimation(
to: Message, to: Message,
@ -425,6 +437,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
duration, duration,
width, width,
height, height,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,
@ -443,7 +456,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation(to.chat, animation, entities, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendAnimation(to.chat, animation, entities, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// Audio // Audio
@ -461,7 +474,7 @@ suspend inline fun TelegramBot.replyWithAudio(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -473,7 +486,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(to.chat, audio, text, parseMode, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(to.chat, audio, text, parseMode, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithAudio( suspend inline fun TelegramBot.replyWithAudio(
to: Message, to: Message,
@ -487,7 +500,7 @@ suspend inline fun TelegramBot.replyWithAudio(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -498,7 +511,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(to.chat, audio, entities, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(to.chat, audio, entities, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// Documents // Documents
@ -514,7 +527,7 @@ suspend inline fun TelegramBot.replyWithDocument(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(to.chat, document, thumb, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection) ) = sendDocument(to.chat, document, thumb, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -526,7 +539,7 @@ suspend inline fun TelegramBot.reply(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(to.chat, document, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection) ) = sendDocument(to.chat, document, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.replyWithDocument( suspend inline fun TelegramBot.replyWithDocument(
to: Message, to: Message,
@ -538,7 +551,7 @@ suspend inline fun TelegramBot.replyWithDocument(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(to.chat, document, thumb, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection) ) = sendDocument(to.chat, document, thumb, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -549,7 +562,7 @@ suspend inline fun TelegramBot.reply(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(to.chat, document, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection) ) = sendDocument(to.chat, document, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
// Media Group // Media Group
@ -561,7 +574,7 @@ suspend inline fun TelegramBot.replyWithMediaGroup(
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendMediaGroup(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply) ) = sendMediaGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
suspend inline fun TelegramBot.replyWithPlaylist( suspend inline fun TelegramBot.replyWithPlaylist(
to: Message, to: Message,
@ -569,7 +582,7 @@ suspend inline fun TelegramBot.replyWithPlaylist(
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendPlaylist(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply) ) = sendPlaylist(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
suspend inline fun TelegramBot.replyWithDocuments( suspend inline fun TelegramBot.replyWithDocuments(
to: Message, to: Message,
@ -577,7 +590,7 @@ suspend inline fun TelegramBot.replyWithDocuments(
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendDocumentsGroup(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply) ) = sendDocumentsGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
suspend inline fun TelegramBot.replyWithGallery( suspend inline fun TelegramBot.replyWithGallery(
to: Message, to: Message,
@ -585,7 +598,7 @@ suspend inline fun TelegramBot.replyWithGallery(
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendVisualMediaGroup(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply) ) = sendVisualMediaGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
// Photo // Photo
@ -599,7 +612,7 @@ suspend inline fun TelegramBot.replyWithPhoto(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, fileId, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(to.chat, fileId, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -610,7 +623,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photo, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(to.chat, photo, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -621,7 +634,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photoSize, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(to.chat, photoSize, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithPhoto( suspend inline fun TelegramBot.replyWithPhoto(
@ -632,7 +645,7 @@ suspend inline fun TelegramBot.replyWithPhoto(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, fileId, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(to.chat, fileId, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -642,7 +655,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photo, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(to.chat, photo, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -652,7 +665,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(to.chat, photoSize, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(to.chat, photoSize, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// Sticker // Sticker
@ -664,7 +677,7 @@ suspend inline fun TelegramBot.replyWithSticker(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(to.chat, sticker, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendSticker(to.chat, sticker, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -673,7 +686,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(to.chat, sticker, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendSticker(to.chat, sticker, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// Videos // Videos
@ -691,7 +704,7 @@ suspend inline fun TelegramBot.replyWithVideo(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, thumb, text, parseMode, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(to.chat, video, thumb, text, parseMode, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -702,7 +715,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(to.chat, video, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVideo( suspend inline fun TelegramBot.replyWithVideo(
to: Message, to: Message,
@ -716,7 +729,7 @@ suspend inline fun TelegramBot.replyWithVideo(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, thumb, entities, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(to.chat, video, thumb, entities, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -726,7 +739,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(to.chat, video, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(to.chat, video, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// VideoNotes // VideoNotes
@ -741,7 +754,7 @@ suspend inline fun TelegramBot.replyWithVideoNote(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(to.chat, videoNote, thumb, duration, size, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVideoNote(to.chat, videoNote, thumb, duration, size, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -750,7 +763,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(to.chat, videoNote, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVideoNote(to.chat, videoNote, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// Voice // Voice
@ -765,7 +778,7 @@ suspend inline fun TelegramBot.replyWithVoice(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(to.chat, voice, text, parseMode, duration, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVoice(to.chat, voice, text, parseMode, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -776,7 +789,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(to.chat, voice, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVoice(to.chat, voice, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.replyWithVoice( suspend inline fun TelegramBot.replyWithVoice(
@ -788,7 +801,7 @@ suspend inline fun TelegramBot.replyWithVoice(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(to.chat, voice, entities, duration, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVoice(to.chat, voice, entities, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -798,7 +811,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(to.chat, voice, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendVoice(to.chat, voice, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// Invoice // Invoice
@ -830,7 +843,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(to.chat.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendInvoice(to.chat.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
// Polls // Polls
@ -847,7 +860,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -862,7 +875,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -878,7 +891,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -895,7 +908,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -910,7 +923,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
to: Message, to: Message,
@ -926,7 +939,7 @@ suspend inline fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) ) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
suspend inline fun TelegramBot.reply( suspend inline fun TelegramBot.reply(
@ -990,6 +1003,7 @@ suspend inline fun TelegramBot.reply(
messageId, messageId,
text, text,
parseMode, parseMode,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,
@ -1027,10 +1041,10 @@ suspend fun TelegramBot.reply(
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) { ): Message = execute(
execute(
content.createResend( content.createResend(
to.chat.id, to.chat.id,
to.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
to.messageId, to.messageId,
@ -1038,7 +1052,6 @@ suspend fun TelegramBot.reply(
replyMarkup replyMarkup
) )
) )
}
/** /**
* Will use [handleLiveLocation] with replying to [message] each time new message will be sent by live location update * Will use [handleLiveLocation] with replying to [message] each time new message will be sent by live location update
@ -1056,6 +1069,7 @@ suspend fun TelegramBot.reply(
message.chat.id, message.chat.id,
locationsFlow, locationsFlow,
liveTimeMillis, liveTimeMillis,
message.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
message.messageId, message.messageId,
@ -1081,6 +1095,7 @@ suspend fun TelegramBot.reply(
message.chat.id, message.chat.id,
locationsFlow, locationsFlow,
liveTimeMillis, liveTimeMillis,
message.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
message.messageId, message.messageId,
@ -1107,6 +1122,7 @@ suspend fun TelegramBot.reply(
message.chat.id, message.chat.id,
locationsFlow, locationsFlow,
liveTimeMillis, liveTimeMillis,
message.threadIdOrNull,
disableNotification, disableNotification,
protectContent, protectContent,
message.messageId, message.messageId,
@ -1219,7 +1235,7 @@ suspend fun TelegramBot.reply(
allowSendingWithoutReply = allowSendingWithoutReply, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is AudioMediaGroupContent -> reply( is AudioMediaGroupPartContent -> reply(
to = to, to = to,
audio = content.media, audio = content.media,
text = text, text = text,
@ -1291,7 +1307,7 @@ suspend fun TelegramBot.reply(
allowSendingWithoutReply = allowSendingWithoutReply, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
is AudioMediaGroupContent -> reply( is AudioMediaGroupPartContent -> reply(
to = to, to = to,
audio = content.media, audio = content.media,
entities = entities, entities = entities,

View File

@ -15,6 +15,7 @@ suspend fun TelegramBot.sendContact(
phoneNumber: String, phoneNumber: String,
firstName: String, firstName: String,
lastName: String? = null, lastName: String? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -22,7 +23,7 @@ suspend fun TelegramBot.sendContact(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendContact( SendContact(
chatId, phoneNumber, firstName, lastName, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -33,6 +34,7 @@ suspend fun TelegramBot.sendContact(
suspend fun TelegramBot.sendContact( suspend fun TelegramBot.sendContact(
chatId: ChatIdentifier, chatId: ChatIdentifier,
contact: Contact, contact: Contact,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -40,7 +42,7 @@ suspend fun TelegramBot.sendContact(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendContact( SendContact(
chatId, contact, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, contact, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -53,13 +55,14 @@ suspend fun TelegramBot.sendContact(
phoneNumber: String, phoneNumber: String,
firstName: String, firstName: String,
lastName: String? = null, lastName: String? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendContact( ) = sendContact(
chat.id, phoneNumber, firstName, lastName, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -69,11 +72,12 @@ suspend fun TelegramBot.sendContact(
suspend fun TelegramBot.sendContact( suspend fun TelegramBot.sendContact(
chat: Chat, chat: Chat,
contact: Contact, contact: Contact,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendContact( ) = sendContact(
chat.id, contact, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, contact, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )

View File

@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendDice import dev.inmo.tgbotapi.requests.send.SendDice
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.dice.DiceAnimationType import dev.inmo.tgbotapi.types.dice.DiceAnimationType
@ -15,13 +16,14 @@ import dev.inmo.tgbotapi.types.dice.DiceAnimationType
suspend fun TelegramBot.sendDice( suspend fun TelegramBot.sendDice(
chatId: ChatIdentifier, chatId: ChatIdentifier,
animationType: DiceAnimationType? = null, animationType: DiceAnimationType? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendDice(chatId, animationType, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) SendDice(chatId, animationType, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
/** /**
@ -31,9 +33,10 @@ suspend fun TelegramBot.sendDice(
suspend fun TelegramBot.sendDice( suspend fun TelegramBot.sendDice(
chat: Chat, chat: Chat,
animationType: DiceAnimationType? = null, animationType: DiceAnimationType? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendDice(chat.id, animationType, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendDice(chat.id, animationType, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -19,6 +19,7 @@ suspend fun TelegramBot.sendLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -33,6 +34,7 @@ suspend fun TelegramBot.sendLocation(
horizontalAccuracy, horizontalAccuracy,
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -52,6 +54,7 @@ suspend fun TelegramBot.sendLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -65,6 +68,7 @@ suspend fun TelegramBot.sendLocation(
horizontalAccuracy, horizontalAccuracy,
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -84,6 +88,7 @@ suspend fun TelegramBot.sendLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -97,6 +102,7 @@ suspend fun TelegramBot.sendLocation(
horizontalAccuracy, horizontalAccuracy,
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -115,6 +121,7 @@ suspend fun TelegramBot.sendLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -128,6 +135,7 @@ suspend fun TelegramBot.sendLocation(
horizontalAccuracy, horizontalAccuracy,
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -147,12 +155,13 @@ suspend fun TelegramBot.sendLiveLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -165,12 +174,13 @@ suspend fun TelegramBot.sendLiveLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -184,12 +194,13 @@ suspend fun TelegramBot.sendLiveLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -202,9 +213,10 @@ suspend fun TelegramBot.sendLiveLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -20,13 +20,25 @@ suspend fun TelegramBot.sendMessage(
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendTextMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) SendTextMessage(
chatId,
text,
parseMode,
disableWebPagePreview,
threadId,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
) )
/** /**
@ -38,32 +50,16 @@ suspend fun TelegramBot.sendTextMessage(
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendMessage( ) = sendMessage(
chatId, text, parseMode, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendMessage(
chat: Chat,
text: String,
parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
@ -73,12 +69,31 @@ suspend fun TelegramBot.sendTextMessage(
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendMessage(
chat: Chat,
text: String,
parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -88,13 +103,14 @@ suspend fun TelegramBot.sendMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendTextMessage(chatId, entities, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) SendTextMessage(chatId, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
/** /**
@ -105,13 +121,14 @@ suspend fun TelegramBot.sendMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
separator: TextSource? = null, separator: TextSource? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -122,13 +139,14 @@ suspend fun TelegramBot.sendMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
separator: String, separator: String,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -138,13 +156,14 @@ suspend fun TelegramBot.sendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendMessage( ) = sendMessage(
chatId, entities, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -155,13 +174,14 @@ suspend fun TelegramBot.sendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
separator: TextSource? = null, separator: TextSource? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -172,13 +192,14 @@ suspend fun TelegramBot.sendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
separator: String, separator: String,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -188,12 +209,13 @@ suspend fun TelegramBot.sendMessage(
chat: Chat, chat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendMessage(chat.id, entities, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendMessage(chat.id, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@ -203,13 +225,14 @@ suspend fun TelegramBot.sendMessage(
chat: Chat, chat: Chat,
separator: TextSource? = null, separator: TextSource? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -220,13 +243,14 @@ suspend fun TelegramBot.sendMessage(
chat: Chat, chat: Chat,
separator: String, separator: String,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -237,12 +261,13 @@ suspend fun TelegramBot.sendTextMessage(
chat: Chat, chat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendTextMessage(chat.id, entities, disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendTextMessage(chat.id, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@ -252,13 +277,14 @@ suspend fun TelegramBot.sendTextMessage(
chat: Chat, chat: Chat,
separator: TextSource? = null, separator: TextSource? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -269,10 +295,11 @@ suspend fun TelegramBot.sendTextMessage(
chat: Chat, chat: Chat,
separator: String, separator: String,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendStaticLocation import dev.inmo.tgbotapi.requests.send.SendStaticLocation
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.location.Location
@ -16,6 +17,7 @@ suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
@ -26,6 +28,7 @@ suspend fun TelegramBot.sendLocation(
chatId, chatId,
latitude, latitude,
longitude, longitude,
threadId = threadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
allowSendingWithoutReply = allowSendingWithoutReply, allowSendingWithoutReply = allowSendingWithoutReply,
@ -41,6 +44,7 @@ suspend fun TelegramBot.sendLocation(
suspend fun TelegramBot.sendLocation( suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
location: Location, location: Location,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
@ -50,6 +54,7 @@ suspend fun TelegramBot.sendLocation(
chatId, chatId,
location.latitude, location.latitude,
location.longitude, location.longitude,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
allowSendingWithoutReply, allowSendingWithoutReply,
@ -65,6 +70,7 @@ suspend fun TelegramBot.sendLocation(
chat: Chat, chat: Chat,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
@ -74,6 +80,7 @@ suspend fun TelegramBot.sendLocation(
chat.id, chat.id,
latitude, latitude,
longitude, longitude,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
allowSendingWithoutReply, allowSendingWithoutReply,
@ -88,6 +95,7 @@ suspend fun TelegramBot.sendLocation(
suspend fun TelegramBot.sendLocation( suspend fun TelegramBot.sendLocation(
chat: Chat, chat: Chat,
location: Location, location: Location,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
@ -97,6 +105,7 @@ suspend fun TelegramBot.sendLocation(
chat.id, chat.id,
location.latitude, location.latitude,
location.longitude, location.longitude,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
allowSendingWithoutReply, allowSendingWithoutReply,
@ -112,12 +121,13 @@ suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, latitude, longitude, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup) ) = sendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -126,12 +136,13 @@ suspend fun TelegramBot.sendStaticLocation(
suspend fun TelegramBot.sendStaticLocation( suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
location: Location, location: Location,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, location.latitude, location.longitude, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup) ) = sendLocation(chatId, location.latitude, location.longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -141,12 +152,13 @@ suspend fun TelegramBot.sendStaticLocation(
chat: Chat, chat: Chat,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, latitude, longitude, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup) ) = sendLocation(chat.id, latitude, longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -155,9 +167,10 @@ suspend fun TelegramBot.sendStaticLocation(
suspend fun TelegramBot.sendStaticLocation( suspend fun TelegramBot.sendStaticLocation(
chat: Chat, chat: Chat,
location: Location, location: Location,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, location.latitude, location.longitude, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup) ) = sendLocation(chat.id, location.latitude, location.longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)

View File

@ -22,6 +22,7 @@ suspend fun TelegramBot.sendVenue(
foursquareType: FoursquareType? = null, foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null, googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null, googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -38,6 +39,7 @@ suspend fun TelegramBot.sendVenue(
foursquareType = foursquareType, foursquareType = foursquareType,
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = threadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = replyToMessageId, replyToMessageId = replyToMessageId,
@ -60,6 +62,7 @@ suspend fun TelegramBot.sendVenue(
foursquareType: FoursquareType? = null, foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null, googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null, googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -75,6 +78,7 @@ suspend fun TelegramBot.sendVenue(
foursquareType = foursquareType, foursquareType = foursquareType,
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = threadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = replyToMessageId, replyToMessageId = replyToMessageId,
@ -95,6 +99,7 @@ suspend fun TelegramBot.sendVenue(
foursquareType: FoursquareType? = null, foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null, googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null, googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -110,6 +115,7 @@ suspend fun TelegramBot.sendVenue(
foursquareType = foursquareType, foursquareType = foursquareType,
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = threadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = replyToMessageId, replyToMessageId = replyToMessageId,
@ -130,6 +136,7 @@ suspend fun TelegramBot.sendVenue(
foursquareType: FoursquareType? = null, foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null, googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null, googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -145,6 +152,7 @@ suspend fun TelegramBot.sendVenue(
foursquareType = foursquareType, foursquareType = foursquareType,
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = threadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = replyToMessageId, replyToMessageId = replyToMessageId,
@ -159,6 +167,7 @@ suspend fun TelegramBot.sendVenue(
suspend fun TelegramBot.sendVenue( suspend fun TelegramBot.sendVenue(
chatId: ChatIdentifier, chatId: ChatIdentifier,
venue: Venue, venue: Venue,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -168,6 +177,7 @@ suspend fun TelegramBot.sendVenue(
SendVenue( SendVenue(
chatId = chatId, chatId = chatId,
venue = venue, venue = venue,
threadId = threadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = replyToMessageId, replyToMessageId = replyToMessageId,
@ -183,6 +193,7 @@ suspend fun TelegramBot.sendVenue(
suspend fun TelegramBot.sendVenue( suspend fun TelegramBot.sendVenue(
chat: Chat, chat: Chat,
venue: Venue, venue: Venue,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -191,6 +202,7 @@ suspend fun TelegramBot.sendVenue(
) = sendVenue( ) = sendVenue(
chatId = chat.id, chatId = chat.id,
venue = venue, venue = venue,
threadId = threadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = replyToMessageId, replyToMessageId = replyToMessageId,

View File

@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.games.SendGame import dev.inmo.tgbotapi.requests.send.games.SendGame
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.games.Game import dev.inmo.tgbotapi.types.games.Game
@ -15,6 +16,7 @@ import dev.inmo.tgbotapi.types.games.Game
suspend fun TelegramBot.sendGame( suspend fun TelegramBot.sendGame(
chatId: ChatIdentifier, chatId: ChatIdentifier,
gameShortName: String, gameShortName: String,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -22,7 +24,7 @@ suspend fun TelegramBot.sendGame(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendGame( SendGame(
chatId, gameShortName, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, gameShortName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -33,13 +35,14 @@ suspend fun TelegramBot.sendGame(
suspend fun TelegramBot.sendGame( suspend fun TelegramBot.sendGame(
chat: Chat, chat: Chat,
gameShortName: String, gameShortName: String,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
chat.id, gameShortName, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, gameShortName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -49,13 +52,14 @@ suspend fun TelegramBot.sendGame(
suspend fun TelegramBot.sendGame( suspend fun TelegramBot.sendGame(
chatId: ChatIdentifier, chatId: ChatIdentifier,
game: Game, game: Game,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
chatId, game.title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, game.title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -65,11 +69,12 @@ suspend fun TelegramBot.sendGame(
suspend fun TelegramBot.sendGame( suspend fun TelegramBot.sendGame(
chat: Chat, chat: Chat,
game: Game, game: Game,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
chat.id, game.title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, game.title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )

View File

@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendAnimation
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
@ -24,6 +25,7 @@ suspend fun TelegramBot.sendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -39,6 +41,7 @@ suspend fun TelegramBot.sendAnimation(
duration, duration,
width, width,
height, height,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -59,13 +62,14 @@ suspend fun TelegramBot.sendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(
chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -81,12 +85,13 @@ suspend fun TelegramBot.sendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, text, parseMode, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAnimation(chat.id, animation, thumb, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -100,12 +105,13 @@ suspend fun TelegramBot.sendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, text, parseMode, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAnimation(chat.id, animation, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -120,6 +126,7 @@ suspend fun TelegramBot.sendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -134,6 +141,7 @@ suspend fun TelegramBot.sendAnimation(
duration, duration,
width, width,
height, height,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -153,13 +161,14 @@ suspend fun TelegramBot.sendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(
chatId, animation.fileId, animation.thumb ?.fileId, entities, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, animation.fileId, animation.thumb ?.fileId, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -174,12 +183,13 @@ suspend fun TelegramBot.sendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, thumb, entities, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAnimation(chat.id, animation, thumb, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -192,9 +202,10 @@ suspend fun TelegramBot.sendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation(chat.id, animation, entities, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAnimation(chat.id, animation, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendAudio
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
@ -24,6 +25,7 @@ suspend fun TelegramBot.sendAudio(
duration: Long? = null, duration: Long? = null,
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -39,6 +41,7 @@ suspend fun TelegramBot.sendAudio(
duration, duration,
performer, performer,
title, title,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -60,12 +63,13 @@ suspend fun TelegramBot.sendAudio(
duration: Long? = null, duration: Long? = null,
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -77,12 +81,13 @@ suspend fun TelegramBot.sendAudio(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
title: String? = audio.title, title: String? = audio.title,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -94,12 +99,13 @@ suspend fun TelegramBot.sendAudio(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
title: String? = audio.title, title: String? = audio.title,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, text, parseMode, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(chat.id, audio, text, parseMode, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -114,6 +120,7 @@ suspend inline fun TelegramBot.sendAudio(
duration: Long? = null, duration: Long? = null,
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -128,6 +135,7 @@ suspend inline fun TelegramBot.sendAudio(
duration, duration,
performer, performer,
title, title,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -148,12 +156,13 @@ suspend inline fun TelegramBot.sendAudio(
duration: Long? = null, duration: Long? = null,
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -164,12 +173,13 @@ suspend inline fun TelegramBot.sendAudio(
audio: AudioFile, audio: AudioFile,
entities: TextSourcesList, entities: TextSourcesList,
title: String? = audio.title, title: String? = audio.title,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, entities, audio.duration, audio.performer, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(chatId, audio.fileId, audio.thumb ?.fileId, entities, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -180,9 +190,10 @@ suspend inline fun TelegramBot.sendAudio(
audio: AudioFile, audio: AudioFile,
entities: TextSourcesList, entities: TextSourcesList,
title: String? = audio.title, title: String? = audio.title,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, entities, title, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendAudio(chat.id, audio, entities, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendDocument
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
@ -21,6 +22,7 @@ suspend fun TelegramBot.sendDocument(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -34,6 +36,7 @@ suspend fun TelegramBot.sendDocument(
thumb, thumb,
text, text,
parseMode, parseMode,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -53,13 +56,14 @@ suspend fun TelegramBot.sendDocument(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, thumb, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection) ) = sendDocument(chat.id, document, thumb, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -70,6 +74,7 @@ suspend fun TelegramBot.sendDocument(
document: DocumentFile, document: DocumentFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -77,7 +82,7 @@ suspend fun TelegramBot.sendDocument(
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument( ) = sendDocument(
chatId, document.fileId, document.thumb ?.fileId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection chatId, document.fileId, document.thumb ?.fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
) )
/** /**
@ -89,13 +94,14 @@ suspend fun TelegramBot.sendDocument(
document: DocumentFile, document: DocumentFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection) ) = sendDocument(chat.id, document, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -106,6 +112,7 @@ suspend inline fun TelegramBot.sendDocument(
document: InputFile, document: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -118,6 +125,7 @@ suspend inline fun TelegramBot.sendDocument(
document, document,
thumb, thumb,
entities, entities,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -136,13 +144,14 @@ suspend inline fun TelegramBot.sendDocument(
document: InputFile, document: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, thumb, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection) ) = sendDocument(chat.id, document, thumb, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -152,6 +161,7 @@ suspend inline fun TelegramBot.sendDocument(
chatId: ChatIdentifier, chatId: ChatIdentifier,
document: DocumentFile, document: DocumentFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -159,7 +169,7 @@ suspend inline fun TelegramBot.sendDocument(
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument( ) = sendDocument(
chatId, document.fileId, document.thumb ?.fileId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection chatId, document.fileId, document.thumb ?.fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
) )
/** /**
@ -170,10 +180,11 @@ suspend inline fun TelegramBot.sendDocument(
chat: Chat, chat: Chat,
document: DocumentFile, document: DocumentFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection) ) = sendDocument(chat.id, document, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)

View File

@ -5,9 +5,10 @@ import dev.inmo.tgbotapi.requests.send.media.*
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.media.* import dev.inmo.tgbotapi.types.media.*
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupContent import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.AudioContent import dev.inmo.tgbotapi.types.message.content.AudioContent
import dev.inmo.tgbotapi.types.message.content.DocumentContent import dev.inmo.tgbotapi.types.message.content.DocumentContent
import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.RiskFeature
@ -20,13 +21,14 @@ import kotlin.jvm.JvmName
suspend fun TelegramBot.sendMediaGroup( suspend fun TelegramBot.sendMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<MediaGroupMemberTelegramMedia>, media: List<MediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendMediaGroup<MediaGroupContent>( SendMediaGroup<MediaGroupPartContent>(
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
) )
@ -37,12 +39,13 @@ suspend fun TelegramBot.sendMediaGroup(
suspend fun TelegramBot.sendMediaGroup( suspend fun TelegramBot.sendMediaGroup(
chat: Chat, chat: Chat,
media: List<MediaGroupMemberTelegramMedia>, media: List<MediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendMediaGroup( ) = sendMediaGroup(
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -52,13 +55,14 @@ suspend fun TelegramBot.sendMediaGroup(
@JvmName("sendMedaGroupByContent") @JvmName("sendMedaGroupByContent")
suspend fun TelegramBot.sendMediaGroup( suspend fun TelegramBot.sendMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<MediaGroupContent>, media: List<MediaGroupPartContent>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendMediaGroup( ) = sendMediaGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -68,13 +72,14 @@ suspend fun TelegramBot.sendMediaGroup(
@JvmName("sendMedaGroupByContent") @JvmName("sendMedaGroupByContent")
suspend fun TelegramBot.sendMediaGroup( suspend fun TelegramBot.sendMediaGroup(
chat: Chat, chat: Chat,
media: List<MediaGroupContent>, media: List<MediaGroupPartContent>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendMediaGroup( ) = sendMediaGroup(
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -83,13 +88,14 @@ suspend fun TelegramBot.sendMediaGroup(
suspend fun TelegramBot.sendPlaylist( suspend fun TelegramBot.sendPlaylist(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberTelegramMedia>, media: List<AudioMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendPlaylist( SendPlaylist(
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
) )
@ -99,12 +105,13 @@ suspend fun TelegramBot.sendPlaylist(
suspend fun TelegramBot.sendPlaylist( suspend fun TelegramBot.sendPlaylist(
chat: Chat, chat: Chat,
media: List<AudioMediaGroupMemberTelegramMedia>, media: List<AudioMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendPlaylist( ) = sendPlaylist(
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -114,12 +121,13 @@ suspend fun TelegramBot.sendPlaylist(
suspend fun TelegramBot.sendPlaylist( suspend fun TelegramBot.sendPlaylist(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<AudioContent>, media: List<AudioContent>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendPlaylist( ) = sendPlaylist(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -129,12 +137,13 @@ suspend fun TelegramBot.sendPlaylist(
suspend fun TelegramBot.sendPlaylist( suspend fun TelegramBot.sendPlaylist(
chat: Chat, chat: Chat,
media: List<AudioContent>, media: List<AudioContent>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendPlaylist( ) = sendPlaylist(
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -143,13 +152,14 @@ suspend fun TelegramBot.sendPlaylist(
suspend fun TelegramBot.sendDocumentsGroup( suspend fun TelegramBot.sendDocumentsGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberTelegramMedia>, media: List<DocumentMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendDocumentsGroup( SendDocumentsGroup(
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
) )
@ -159,12 +169,13 @@ suspend fun TelegramBot.sendDocumentsGroup(
suspend fun TelegramBot.sendDocumentsGroup( suspend fun TelegramBot.sendDocumentsGroup(
chat: Chat, chat: Chat,
media: List<DocumentMediaGroupMemberTelegramMedia>, media: List<DocumentMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendDocumentsGroup( ) = sendDocumentsGroup(
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -174,12 +185,13 @@ suspend fun TelegramBot.sendDocumentsGroup(
suspend fun TelegramBot.sendDocumentsGroup( suspend fun TelegramBot.sendDocumentsGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<DocumentContent>, media: List<DocumentContent>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendDocumentsGroup( ) = sendDocumentsGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -189,12 +201,13 @@ suspend fun TelegramBot.sendDocumentsGroup(
suspend fun TelegramBot.sendDocumentsGroup( suspend fun TelegramBot.sendDocumentsGroup(
chat: Chat, chat: Chat,
media: List<DocumentContent>, media: List<DocumentContent>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendDocumentsGroup( ) = sendDocumentsGroup(
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -203,13 +216,14 @@ suspend fun TelegramBot.sendDocumentsGroup(
suspend fun TelegramBot.sendVisualMediaGroup( suspend fun TelegramBot.sendVisualMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberTelegramMedia>, media: List<VisualMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendVisualMediaGroup( SendVisualMediaGroup(
chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
) )
@ -219,12 +233,13 @@ suspend fun TelegramBot.sendVisualMediaGroup(
suspend fun TelegramBot.sendVisualMediaGroup( suspend fun TelegramBot.sendVisualMediaGroup(
chat: Chat, chat: Chat,
media: List<VisualMediaGroupMemberTelegramMedia>, media: List<VisualMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendVisualMediaGroup( ) = sendVisualMediaGroup(
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -233,13 +248,14 @@ suspend fun TelegramBot.sendVisualMediaGroup(
@JvmName("sendVisualMediaGroupByContent") @JvmName("sendVisualMediaGroupByContent")
suspend fun TelegramBot.sendVisualMediaGroup( suspend fun TelegramBot.sendVisualMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<VisualMediaGroupContent>, media: List<VisualMediaGroupPartContent>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendVisualMediaGroup( ) = sendVisualMediaGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@ -248,11 +264,12 @@ suspend fun TelegramBot.sendVisualMediaGroup(
@JvmName("sendVisualMediaGroupByContent") @JvmName("sendVisualMediaGroupByContent")
suspend fun TelegramBot.sendVisualMediaGroup( suspend fun TelegramBot.sendVisualMediaGroup(
chat: Chat, chat: Chat,
media: List<VisualMediaGroupContent>, media: List<VisualMediaGroupPartContent>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = sendVisualMediaGroup( ) = sendVisualMediaGroup(
chat.id, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )

View File

@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendPhoto
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
@ -20,6 +21,7 @@ suspend fun TelegramBot.sendPhoto(
fileId: InputFile, fileId: InputFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -31,6 +33,7 @@ suspend fun TelegramBot.sendPhoto(
fileId, fileId,
text, text,
parseMode, parseMode,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -48,12 +51,13 @@ suspend fun TelegramBot.sendPhoto(
fileId: InputFile, fileId: InputFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chat.id, fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -64,12 +68,13 @@ suspend fun TelegramBot.sendPhoto(
photo: Photo, photo: Photo,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -80,12 +85,13 @@ suspend fun TelegramBot.sendPhoto(
photo: Photo, photo: Photo,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chat.id, photo, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -96,12 +102,13 @@ suspend fun TelegramBot.sendPhoto(
photoSize: PhotoSize, photoSize: PhotoSize,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize.fileId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chatId, photoSize.fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -112,12 +119,13 @@ suspend fun TelegramBot.sendPhoto(
photoSize: PhotoSize, photoSize: PhotoSize,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photoSize, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chat.id, photoSize, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -128,6 +136,7 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
fileId: InputFile, fileId: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -138,6 +147,7 @@ suspend inline fun TelegramBot.sendPhoto(
chatId, chatId,
fileId, fileId,
entities, entities,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -154,12 +164,13 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat, chat: Chat,
fileId: InputFile, fileId: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, fileId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chat.id, fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -169,12 +180,13 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
photo: Photo, photo: Photo,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -184,12 +196,13 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat, chat: Chat,
photo: Photo, photo: Photo,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photo, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chat.id, photo, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -199,12 +212,13 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
photoSize: PhotoSize, photoSize: PhotoSize,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chatId, photoSize.fileId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chatId, photoSize.fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -214,9 +228,10 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat, chat: Chat,
photoSize: PhotoSize, photoSize: PhotoSize,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto(chat.id, photoSize, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendPhoto(chat.id, photoSize, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendSticker import dev.inmo.tgbotapi.requests.send.media.SendSticker
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.Sticker import dev.inmo.tgbotapi.types.files.Sticker
@ -16,13 +17,14 @@ import dev.inmo.tgbotapi.types.files.Sticker
suspend fun TelegramBot.sendSticker( suspend fun TelegramBot.sendSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,
sticker: InputFile, sticker: InputFile,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendSticker(chatId, sticker, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) SendSticker(chatId, sticker, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
/** /**
@ -32,12 +34,13 @@ suspend fun TelegramBot.sendSticker(
suspend fun TelegramBot.sendSticker( suspend fun TelegramBot.sendSticker(
chat: Chat, chat: Chat,
sticker: InputFile, sticker: InputFile,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat.id, sticker, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendSticker(chat.id, sticker, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -46,12 +49,13 @@ suspend fun TelegramBot.sendSticker(
suspend fun TelegramBot.sendSticker( suspend fun TelegramBot.sendSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,
sticker: Sticker, sticker: Sticker,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(chatId, sticker.fileId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendSticker(chatId, sticker.fileId, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -60,9 +64,10 @@ suspend fun TelegramBot.sendSticker(
suspend fun TelegramBot.sendSticker( suspend fun TelegramBot.sendSticker(
chat: Chat, chat: Chat,
sticker: Sticker, sticker: Sticker,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat, sticker.fileId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendSticker(chat, sticker.fileId, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendVideo
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
@ -24,6 +25,7 @@ suspend fun TelegramBot.sendVideo(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -40,6 +42,7 @@ suspend fun TelegramBot.sendVideo(
width, width,
height, height,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -57,12 +60,13 @@ suspend fun TelegramBot.sendVideo(
video: VideoFile, video: VideoFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -77,12 +81,13 @@ suspend fun TelegramBot.sendVideo(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, text, parseMode, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(chat.id, video, thumb, text, parseMode, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -94,12 +99,13 @@ suspend fun TelegramBot.sendVideo(
video: VideoFile, video: VideoFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(chat.id, video, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -113,6 +119,7 @@ suspend inline fun TelegramBot.sendVideo(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -128,6 +135,7 @@ suspend inline fun TelegramBot.sendVideo(
width, width,
height, height,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -144,12 +152,13 @@ suspend inline fun TelegramBot.sendVideo(
chatId: ChatIdentifier, chatId: ChatIdentifier,
video: VideoFile, video: VideoFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, entities, video.duration, video.width, video.height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(chatId, video.fileId, video.thumb ?.fileId, entities, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -163,12 +172,13 @@ suspend inline fun TelegramBot.sendVideo(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, thumb, entities, duration, width, height, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(chat.id, video, thumb, entities, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -179,9 +189,10 @@ suspend inline fun TelegramBot.sendVideo(
chat: Chat, chat: Chat,
video: VideoFile, video: VideoFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo(chat.id, video, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVideo(chat.id, video, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVideoNote import dev.inmo.tgbotapi.requests.send.media.SendVideoNote
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.VideoNoteFile import dev.inmo.tgbotapi.types.files.VideoNoteFile
@ -19,6 +20,7 @@ suspend fun TelegramBot.sendVideoNote(
thumb: InputFile? = null, thumb: InputFile? = null,
duration: Long? = null, duration: Long? = null,
size: Int? = null, size: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -31,6 +33,7 @@ suspend fun TelegramBot.sendVideoNote(
thumb, thumb,
duration, duration,
size, size,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -46,13 +49,14 @@ suspend fun TelegramBot.sendVideoNote(
suspend fun TelegramBot.sendVideoNote( suspend fun TelegramBot.sendVideoNote(
chatId: ChatIdentifier, chatId: ChatIdentifier,
videoNote: VideoNoteFile, videoNote: VideoNoteFile,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote( ) = sendVideoNote(
chatId, videoNote.fileId, videoNote.thumb ?.fileId, videoNote.duration, videoNote.width, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, videoNote.fileId, videoNote.thumb ?.fileId, videoNote.duration, videoNote.width, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -65,12 +69,13 @@ suspend fun TelegramBot.sendVideoNote(
thumb: InputFile? = null, thumb: InputFile? = null,
duration: Long? = null, duration: Long? = null,
size: Int? = null, size: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(chat.id, videoNote, thumb, duration, size, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVideoNote(chat.id, videoNote, thumb, duration, size, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -79,9 +84,10 @@ suspend fun TelegramBot.sendVideoNote(
suspend fun TelegramBot.sendVideoNote( suspend fun TelegramBot.sendVideoNote(
chat: Chat, chat: Chat,
videoNote: VideoNoteFile, videoNote: VideoNoteFile,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(chat.id, videoNote, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVideoNote(chat.id, videoNote, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.SendVoice
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
@ -21,6 +22,7 @@ suspend fun TelegramBot.sendVoice(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
duration: Long? = null, duration: Long? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -33,6 +35,7 @@ suspend fun TelegramBot.sendVoice(
text, text,
parseMode, parseMode,
duration, duration,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -51,12 +54,13 @@ suspend fun TelegramBot.sendVoice(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
duration: Long? = null, duration: Long? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, text, parseMode, duration, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVoice(chat.id, voice, text, parseMode, duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -67,13 +71,14 @@ suspend fun TelegramBot.sendVoice(
voice: VoiceFile, voice: VoiceFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice( ) = sendVoice(
chatId, voice.fileId, text, parseMode, voice.duration, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, voice.fileId, text, parseMode, voice.duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -85,12 +90,13 @@ suspend fun TelegramBot.sendVoice(
voice: VoiceFile, voice: VoiceFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVoice(chat.id, voice, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@ -102,6 +108,7 @@ suspend inline fun TelegramBot.sendVoice(
voice: InputFile, voice: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
duration: Long? = null, duration: Long? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -113,6 +120,7 @@ suspend inline fun TelegramBot.sendVoice(
voice, voice,
entities, entities,
duration, duration,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -130,12 +138,13 @@ suspend inline fun TelegramBot.sendVoice(
voice: InputFile, voice: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
duration: Long? = null, duration: Long? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, entities, duration, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVoice(chat.id, voice, entities, duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -145,13 +154,14 @@ suspend inline fun TelegramBot.sendVoice(
chatId: ChatIdentifier, chatId: ChatIdentifier,
voice: VoiceFile, voice: VoiceFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice( ) = sendVoice(
chatId, voice.fileId, entities, voice.duration, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, voice.fileId, entities, voice.duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -161,9 +171,10 @@ suspend inline fun TelegramBot.sendVoice(
chat: Chat, chat: Chat,
voice: VoiceFile, voice: VoiceFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendVoice(chat.id, voice, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -31,13 +31,14 @@ suspend fun TelegramBot.sendInvoice(
shouldSendPhoneNumberToProvider: Boolean = false, shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false, shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false, priceDependOnShipAddress: Boolean = false,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
SendInvoice(chatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, 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, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
/** /**
@ -63,9 +64,10 @@ suspend fun TelegramBot.sendInvoice(
shouldSendPhoneNumberToProvider: Boolean = false, shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false, shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false, priceDependOnShipAddress: Boolean = false,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, 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, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
@ -23,6 +24,7 @@ suspend fun TelegramBot.sendRegularPoll(
isClosed: Boolean = false, isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false, allowMultipleAnswers: Boolean = false,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -30,7 +32,7 @@ suspend fun TelegramBot.sendRegularPoll(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendRegularPoll( SendRegularPoll(
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
/** /**
@ -46,12 +48,13 @@ suspend fun TelegramBot.sendRegularPoll(
isAnonymous: Boolean = poll.isAnonymous, isAnonymous: Boolean = poll.isAnonymous,
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers, allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@ -65,13 +68,14 @@ suspend fun TelegramBot.sendRegularPoll(
isClosed: Boolean = false, isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false, allowMultipleAnswers: Boolean = false,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll( ) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -87,13 +91,14 @@ suspend fun TelegramBot.sendRegularPoll(
isAnonymous: Boolean = poll.isAnonymous, isAnonymous: Boolean = poll.isAnonymous,
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers, allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll( ) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
@ -111,6 +116,7 @@ suspend fun TelegramBot.sendQuizPoll(
explanation: String? = null, explanation: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -118,7 +124,7 @@ suspend fun TelegramBot.sendQuizPoll(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendQuizPoll( SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -136,13 +142,14 @@ suspend fun TelegramBot.sendQuizPoll(
explanation: String? = null, explanation: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll( ) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -160,13 +167,14 @@ suspend fun TelegramBot.sendQuizPoll(
explanation: String? = null, explanation: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll( ) = sendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -184,13 +192,14 @@ suspend fun TelegramBot.sendQuizPoll(
explanation: String? = null, explanation: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll( ) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
@ -207,6 +216,7 @@ suspend inline fun TelegramBot.sendQuizPoll(
isClosed: Boolean = false, isClosed: Boolean = false,
entities: TextSourcesList, entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -214,7 +224,7 @@ suspend inline fun TelegramBot.sendQuizPoll(
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendQuizPoll( SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@ -231,13 +241,14 @@ suspend inline fun TelegramBot.sendQuizPoll(
isClosed: Boolean = false, isClosed: Boolean = false,
entities: TextSourcesList, entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll( ) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -254,13 +265,14 @@ suspend inline fun TelegramBot.sendQuizPoll(
isAnonymous: Boolean = quizPoll.isAnonymous, isAnonymous: Boolean = quizPoll.isAnonymous,
entities: TextSourcesList, entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll( ) = sendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@ -277,11 +289,12 @@ suspend inline fun TelegramBot.sendQuizPoll(
isAnonymous: Boolean = quizPoll.isAnonymous, isAnonymous: Boolean = quizPoll.isAnonymous,
entities: TextSourcesList, entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll( ) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.utils package dev.inmo.tgbotapi.extensions.api.utils
import dev.inmo.tgbotapi.extensions.api.InternalUtils.convertWithMediaGroupUpdates import dev.inmo.tgbotapi.extensions.api.InternalUtils.convertWithMediaGroupUpdates
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
import dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate import dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate
import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.updateshandlers.UpdateReceiver import dev.inmo.tgbotapi.updateshandlers.UpdateReceiver
@ -30,10 +30,21 @@ fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(
launch { launch {
launch { launch {
for (update in updatesChannel) { for (update in updatesChannel) {
when (val data = update.data) { val dataAsPossiblySentViaBotCommonMessage = update.data as? PossiblySentViaBotCommonMessage<*>
is MediaGroupMessage<*> -> mediaGroupChannel.send("${data.mediaGroupId}${update::class.simpleName}" to update as BaseMessageUpdate)
else -> output(update) if (dataAsPossiblySentViaBotCommonMessage == null) {
output(update)
continue
} }
val mediaGroupId = dataAsPossiblySentViaBotCommonMessage.mediaGroupId
if (mediaGroupId == null) {
output(update)
continue
}
mediaGroupChannel.send("${mediaGroupId}${update::class.simpleName}" to update as BaseMessageUpdate)
} }
} }
launch { launch {

View File

@ -66,12 +66,12 @@ suspend fun BehaviourContext.waitAudioMediaGroupContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitContent<AudioMediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitContent<AudioMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitDocumentMediaGroupContent( suspend fun BehaviourContext.waitDocumentMediaGroupContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitContent<DocumentMediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitContent<DocumentMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitMedia( suspend fun BehaviourContext.waitMedia(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
@ -81,12 +81,12 @@ suspend fun BehaviourContext.waitAnyMediaGroupContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitContent<MediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitContent<MediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitVisualMediaGroupContent( suspend fun BehaviourContext.waitVisualMediaGroupContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitContent<VisualMediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitContent<VisualMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitTextedMediaContent( suspend fun BehaviourContext.waitTextedMediaContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },

View File

@ -9,7 +9,6 @@ import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
import dev.inmo.tgbotapi.types.update.media_group.SentMediaGroupUpdate
import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
@ -25,20 +24,7 @@ suspend inline fun <reified O : MessageContent> BehaviourContext.waitContentMess
initRequest, initRequest,
errorFactory errorFactory
) { ) {
val messages = when (it) { listOfNotNull((it.data as? CommonMessage<*>) ?.withContent<O>())
is SentMediaGroupUpdate -> {
if (includeMediaGroups) {
it.data
} else {
emptyList()
}
}
is BaseSentMessageUpdate -> listOf(it.data)
else -> return@expectFlow emptyList()
}
messages.mapNotNull { message ->
(message as? CommonMessage<*>) ?.withContent<O>()
}
} }
internal inline fun <reified T : MessageContent> contentMessageConverter( internal inline fun <reified T : MessageContent> contentMessageConverter(
@ -103,12 +89,12 @@ suspend fun BehaviourContext.waitAudioMediaGroupContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitContentMessage<AudioMediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitContentMessage<AudioMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitDocumentMediaGroupContentMessage( suspend fun BehaviourContext.waitDocumentMediaGroupContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitContentMessage<DocumentMediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitContentMessage<DocumentMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitMediaMessage( suspend fun BehaviourContext.waitMediaMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
@ -118,12 +104,12 @@ suspend fun BehaviourContext.waitAnyMediaGroupContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitContentMessage<MediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitContentMessage<MediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitVisualMediaGroupContentMessage( suspend fun BehaviourContext.waitVisualMediaGroupContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitContentMessage<VisualMediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitContentMessage<VisualMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitTextedMediaContentMessage( suspend fun BehaviourContext.waitTextedMediaContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },

View File

@ -15,7 +15,7 @@ suspend inline fun <reified O : MessageContent> BehaviourContext.waitEditedConte
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
includeMediaGroups: Boolean = true, includeMediaGroups: Boolean = true,
noinline errorFactory: NullableRequestBuilder<*> = { null } noinline errorFactory: NullableRequestBuilder<*> = { null }
): Flow<O> = waitEditedContentMessage<O>(initRequest, includeMediaGroups, errorFactory).map { it.content } ): Flow<O> = waitEditedContentMessage<O>(initRequest, errorFactory).map { it.content }
suspend fun BehaviourContext.waitEditedMessageContent( suspend fun BehaviourContext.waitEditedMessageContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
@ -64,12 +64,12 @@ suspend fun BehaviourContext.waitEditedAudioMediaGroupContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitEditedContent<AudioMediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitEditedContent<AudioMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedDocumentMediaGroupContent( suspend fun BehaviourContext.waitEditedDocumentMediaGroupContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitEditedContent<DocumentMediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitEditedContent<DocumentMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedMedia( suspend fun BehaviourContext.waitEditedMedia(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
@ -79,12 +79,12 @@ suspend fun BehaviourContext.waitEditedAnyMediaGroupContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitEditedContent<MediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitEditedContent<MediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedVisualMediaGroupContent( suspend fun BehaviourContext.waitEditedVisualMediaGroupContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = true includeMediaGroups: Boolean = true
) = waitEditedContent<VisualMediaGroupContent>(initRequest, includeMediaGroups, errorFactory) ) = waitEditedContent<VisualMediaGroupPartContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedTextedMediaContent( suspend fun BehaviourContext.waitEditedTextedMediaContent(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },

View File

@ -3,11 +3,11 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext 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.commonMessageOrNull
import dev.inmo.tgbotapi.extensions.utils.withContent import dev.inmo.tgbotapi.extensions.utils.withContent
import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate import dev.inmo.tgbotapi.types.update.abstracts.BaseEditMessageUpdate
import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.RiskFeature
@ -17,7 +17,6 @@ import kotlinx.coroutines.flow.Flow
@RiskFeature(lowLevelRiskFeatureMessage) @RiskFeature(lowLevelRiskFeatureMessage)
suspend inline fun <reified O : MessageContent> BehaviourContext.waitEditedContentMessage( suspend inline fun <reified O : MessageContent> BehaviourContext.waitEditedContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
includeMediaGroups: Boolean = true,
noinline errorFactory: NullableRequestBuilder<*> = { null } noinline errorFactory: NullableRequestBuilder<*> = { null }
): Flow<CommonMessage<O>> = expectFlow( ): Flow<CommonMessage<O>> = expectFlow(
initRequest, initRequest,
@ -26,11 +25,7 @@ suspend inline fun <reified O : MessageContent> BehaviourContext.waitEditedConte
val messages = when (it) { val messages = when (it) {
is BaseEditMessageUpdate -> { is BaseEditMessageUpdate -> {
val commonMessage = it.data.commonMessageOrNull() ?: return@expectFlow emptyList() val commonMessage = it.data.commonMessageOrNull() ?: return@expectFlow emptyList()
if (commonMessage !is MediaGroupMessage<*> || includeMediaGroups) {
listOf(commonMessage) listOf(commonMessage)
} else {
emptyList()
}
} }
else -> return@expectFlow emptyList() else -> return@expectFlow emptyList()
} }
@ -41,109 +36,103 @@ suspend inline fun <reified O : MessageContent> BehaviourContext.waitEditedConte
suspend fun BehaviourContext.waitEditedMessageContentMessage( suspend fun BehaviourContext.waitEditedMessageContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null }
includeMediaGroups: Boolean = true ) = waitEditedContentMessage<MessageContent>(initRequest, errorFactory)
) = waitEditedContentMessage<MessageContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedContactMessage( suspend fun BehaviourContext.waitEditedContactMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<ContactContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<ContactContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedDiceMessage( suspend fun BehaviourContext.waitEditedDiceMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<DiceContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<DiceContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedGameMessage( suspend fun BehaviourContext.waitEditedGameMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<GameContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<GameContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedLocationMessage( suspend fun BehaviourContext.waitEditedLocationMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<LocationContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<LocationContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedLiveLocationMessage( suspend fun BehaviourContext.waitEditedLiveLocationMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<LiveLocationContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<LiveLocationContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedStaticLocationMessage( suspend fun BehaviourContext.waitEditedStaticLocationMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<StaticLocationContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<StaticLocationContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedTextMessage( suspend fun BehaviourContext.waitEditedTextMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<TextContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<TextContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVenueMessage( suspend fun BehaviourContext.waitEditedVenueMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<VenueContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<VenueContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedAudioMediaGroupContentMessage( suspend fun BehaviourContext.waitEditedAudioMediaGroupContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null }
includeMediaGroups: Boolean = true ) = waitEditedContentMessage<AudioMediaGroupPartContent>(initRequest, errorFactory)
) = waitEditedContentMessage<AudioMediaGroupContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedDocumentMediaGroupContentMessage( suspend fun BehaviourContext.waitEditedDocumentMediaGroupContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null }
includeMediaGroups: Boolean = true ) = waitEditedContentMessage<DocumentMediaGroupPartContent>(initRequest, errorFactory)
) = waitEditedContentMessage<DocumentMediaGroupContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedMediaMessage( suspend fun BehaviourContext.waitEditedMediaMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false includeMediaGroups: Boolean = false
) = waitEditedContentMessage<MediaContent>(initRequest, includeMediaGroups, errorFactory) ) = waitEditedContentMessage<MediaContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedAnyMediaGroupContentMessage( suspend fun BehaviourContext.waitEditedAnyMediaGroupContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null }
includeMediaGroups: Boolean = true ) = waitEditedContentMessage<MediaGroupPartContent>(initRequest, errorFactory)
) = waitEditedContentMessage<MediaGroupContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedVisualMediaGroupContentMessage( suspend fun BehaviourContext.waitEditedVisualMediaGroupContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null }
includeMediaGroups: Boolean = true ) = waitEditedContentMessage<VisualMediaGroupPartContent>(initRequest, errorFactory)
) = waitEditedContentMessage<VisualMediaGroupContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedTextedMediaContentMessage( suspend fun BehaviourContext.waitEditedTextedMediaContentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null }
includeMediaGroups: Boolean = true ) = waitEditedContentMessage<TextedMediaContent>(initRequest, errorFactory)
) = waitEditedContentMessage<TextedMediaContent>(initRequest, includeMediaGroups, errorFactory)
suspend fun BehaviourContext.waitEditedAnimationMessage( suspend fun BehaviourContext.waitEditedAnimationMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<AnimationContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<AnimationContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedAudioMessage( suspend fun BehaviourContext.waitEditedAudioMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false includeMediaGroups: Boolean = false
) = waitEditedContentMessage<AudioContent>(initRequest, includeMediaGroups, errorFactory) ) = waitEditedContentMessage<AudioContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedDocumentMessage( suspend fun BehaviourContext.waitEditedDocumentMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false includeMediaGroups: Boolean = false
) = waitEditedContentMessage<DocumentContent>(initRequest, includeMediaGroups, errorFactory) ) = waitEditedContentMessage<DocumentContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedPhotoMessage( suspend fun BehaviourContext.waitEditedPhotoMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false includeMediaGroups: Boolean = false
) = waitEditedContentMessage<PhotoContent>(initRequest, includeMediaGroups, errorFactory) ) = waitEditedContentMessage<PhotoContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedStickerMessage( suspend fun BehaviourContext.waitEditedStickerMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<StickerContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<StickerContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVideoMessage( suspend fun BehaviourContext.waitEditedVideoMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }, errorFactory: NullableRequestBuilder<*> = { null },
includeMediaGroups: Boolean = false includeMediaGroups: Boolean = false
) = waitEditedContentMessage<VideoContent>(initRequest, includeMediaGroups, errorFactory) ) = waitEditedContentMessage<VideoContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVideoNoteMessage( suspend fun BehaviourContext.waitEditedVideoNoteMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<VideoNoteContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<VideoNoteContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedVoiceMessage( suspend fun BehaviourContext.waitEditedVoiceMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<VoiceContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<VoiceContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitEditedInvoiceMessage( suspend fun BehaviourContext.waitEditedInvoiceMessage(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEditedContentMessage<InvoiceContent>(initRequest, false, errorFactory) ) = waitEditedContentMessage<InvoiceContent>(initRequest, errorFactory)

View File

@ -7,6 +7,9 @@ import dev.inmo.tgbotapi.extensions.utils.*
import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.message.ChatEvents.* import dev.inmo.tgbotapi.types.message.ChatEvents.*
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicCreated
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicReopened
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.* import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
@ -136,3 +139,15 @@ suspend fun BehaviourContext.waitWebAppDataEvents(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<WebAppData>(initRequest, errorFactory) ) = waitEvents<WebAppData>(initRequest, errorFactory)
suspend fun BehaviourContext.waitForumTopicClosed(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<ForumTopicClosed>(initRequest, errorFactory)
suspend fun BehaviourContext.waitForumTopicCreated(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<ForumTopicCreated>(initRequest, errorFactory)
suspend fun BehaviourContext.waitForumTopicReopened(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEvents<ForumTopicReopened>(initRequest, errorFactory)

View File

@ -7,6 +7,9 @@ import dev.inmo.tgbotapi.extensions.utils.*
import dev.inmo.tgbotapi.requests.abstracts.Request import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.message.ChatEvents.* import dev.inmo.tgbotapi.types.message.ChatEvents.*
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicCreated
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicReopened
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.* import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
@ -133,3 +136,15 @@ suspend fun BehaviourContext.waitWebAppDataEventsMessages(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<WebAppData>(initRequest, errorFactory) ) = waitEventsMessages<WebAppData>(initRequest, errorFactory)
suspend fun BehaviourContext.waitForumTopicClosedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<ForumTopicClosed>(initRequest, errorFactory)
suspend fun BehaviourContext.waitForumTopicCreatedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<ForumTopicCreated>(initRequest, errorFactory)
suspend fun BehaviourContext.waitForumTopicReopenedEventsMessages(
initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null }
) = waitEventsMessages<ForumTopicReopened>(initRequest, errorFactory)

View File

@ -1,40 +1,46 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.utils.baseSentMessageUpdateOrNull
import dev.inmo.tgbotapi.extensions.utils.commonMessageOrNull
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.requests.abstracts.Request
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
typealias MediaGroupFilter<T> = SimpleFilter<List<MediaGroupMessage<T>>>
@RiskFeature(lowLevelRiskFeatureMessage) @RiskFeature(lowLevelRiskFeatureMessage)
suspend inline fun <reified O : MediaGroupContent> BehaviourContext.buildMediaGroupWaiter( suspend inline fun <reified T : MediaGroupPartContent> BehaviourContext.buildMediaGroupWaiter(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
noinline errorFactory: NullableRequestBuilder<*> = { null } noinline errorFactory: NullableRequestBuilder<*> = { null }
): Flow<List<O>> = buildMediaGroupMessagesWaiter<O>(initRequest, errorFactory).map { it.map { it.content } } ): Flow<MediaGroupContent<T>> = flowsUpdatesFilter.expectFlow(bot, initRequest, errorFactory) { update ->
update.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull<MediaGroupContent<*>>() ?.let { message ->
if (message.content.group.all { it is T }) {
listOf(message.content as MediaGroupContent<T>)
} else {
null
}
} ?: emptyList()
}
suspend fun BehaviourContext.waitMediaGroup( suspend fun BehaviourContext.waitMediaGroup(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = buildMediaGroupWaiter<MediaGroupContent>(initRequest, errorFactory) ) = buildMediaGroupWaiter<MediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitPlaylist( suspend fun BehaviourContext.waitPlaylist(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = buildMediaGroupWaiter<AudioMediaGroupContent>(initRequest, errorFactory) ) = buildMediaGroupWaiter<AudioMediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitDocumentsGroup( suspend fun BehaviourContext.waitDocumentsGroup(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = buildMediaGroupWaiter<DocumentMediaGroupContent>(initRequest, errorFactory) ) = buildMediaGroupWaiter<DocumentMediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitVisualGallery( suspend fun BehaviourContext.waitVisualGallery(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = buildMediaGroupWaiter<VisualMediaGroupContent>(initRequest, errorFactory) ) = buildMediaGroupWaiter<VisualMediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitPhotoGallery( suspend fun BehaviourContext.waitPhotoGallery(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }

View File

@ -1,44 +1,46 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
import dev.inmo.tgbotapi.extensions.utils.sentMediaGroupUpdateOrNull import dev.inmo.tgbotapi.extensions.utils.baseSentMessageUpdateOrNull
import dev.inmo.tgbotapi.extensions.utils.commonMessageOrNull
import dev.inmo.tgbotapi.extensions.utils.withContent 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.requests.abstracts.Request
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.RiskFeature
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
@RiskFeature(lowLevelRiskFeatureMessage) @RiskFeature(lowLevelRiskFeatureMessage)
suspend inline fun <reified T : MediaGroupContent> BehaviourContext.buildMediaGroupMessagesWaiter( suspend inline fun <reified T : MediaGroupPartContent> BehaviourContext.buildMediaGroupMessagesWaiter(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
noinline errorFactory: NullableRequestBuilder<*> = { null } noinline errorFactory: NullableRequestBuilder<*> = { null }
): Flow<List<MediaGroupMessage<T>>> = flowsUpdatesFilter.expectFlow(bot, initRequest, errorFactory) { update -> ): Flow<MediaGroupMessage<T>> = flowsUpdatesFilter.expectFlow(bot, initRequest, errorFactory) { update ->
update.sentMediaGroupUpdateOrNull() ?.data ?.let { mediaGroup -> update.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull<MediaGroupContent<*>>() ?.let { message ->
val mapped = mediaGroup.mapNotNull { it.withContent<T>() } if (message.content.group.all { it is T }) {
listOf( listOf(message as MediaGroupMessage<T>)
mapped } else {
) null
}
} ?: emptyList() } ?: emptyList()
} }
suspend fun BehaviourContext.waitMediaGroupMessages( suspend fun BehaviourContext.waitMediaGroupMessages(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = buildMediaGroupMessagesWaiter<MediaGroupContent>(initRequest, errorFactory) ) = buildMediaGroupMessagesWaiter<MediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitPlaylistMessages( suspend fun BehaviourContext.waitPlaylistMessages(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = buildMediaGroupMessagesWaiter<AudioMediaGroupContent>(initRequest, errorFactory) ) = buildMediaGroupMessagesWaiter<AudioMediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitDocumentsGroupMessages( suspend fun BehaviourContext.waitDocumentsGroupMessages(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = buildMediaGroupMessagesWaiter<DocumentMediaGroupContent>(initRequest, errorFactory) ) = buildMediaGroupMessagesWaiter<DocumentMediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitVisualGalleryMessages( suspend fun BehaviourContext.waitVisualGalleryMessages(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }
) = buildMediaGroupMessagesWaiter<VisualMediaGroupContent>(initRequest, errorFactory) ) = buildMediaGroupMessagesWaiter<VisualMediaGroupPartContent>(initRequest, errorFactory)
suspend fun BehaviourContext.waitPhotoGalleryMessages( suspend fun BehaviourContext.waitPhotoGalleryMessages(
initRequest: Request<*>? = null, initRequest: Request<*>? = null,
errorFactory: NullableRequestBuilder<*> = { null } errorFactory: NullableRequestBuilder<*> = { null }

View File

@ -3,18 +3,13 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
import dev.inmo.tgbotapi.types.message.abstracts.* 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 import dev.inmo.tgbotapi.types.update.abstracts.Update
/**
* Allow only messages which are not [MediaGroupMessage]
*/
val MessageFilterExcludingMediaGroups: BehaviourContextAndTwoTypesReceiver<Boolean, CommonMessage<*>, Update> = { _, update ->
update !is MediaGroupMessage<*>
}
/** /**
* Allow only messages which are not [MediaGroupMessage] * Allow only messages which are not [MediaGroupMessage]
*/ */
val CommonMessageFilterExcludeMediaGroups = SimpleFilter<Message> { val CommonMessageFilterExcludeMediaGroups = SimpleFilter<Message> {
it !is MediaGroupMessage<*> it !is CommonMessage<*> || it.content !is MediaGroupContent<*>
} }

View File

@ -0,0 +1,12 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
/**
* Allow only messages which are not in some forum
*/
val MessageFilterForums = SimpleFilter<Message> {
it.threadIdOrNull == null
}

View File

@ -14,7 +14,6 @@ import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.types.update.media_group.SentMediaGroupUpdate
typealias CommonMessageFilter<T> = SimpleFilter<CommonMessage<T>> typealias CommonMessageFilter<T> = SimpleFilter<CommonMessage<T>>
@ -26,7 +25,6 @@ internal suspend inline fun <BC : BehaviourContext, reified T : MessageContent>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
when (it) { when (it) {
is BaseSentMessageUpdate -> it.data.whenCommonMessage(::listOfNotNull) is BaseSentMessageUpdate -> it.data.whenCommonMessage(::listOfNotNull)
is SentMediaGroupUpdate -> it.data
else -> null else -> null
} ?.mapNotNull { message -> } ?.mapNotNull { message ->
if (message.content is T) message as CommonMessage<T> else null if (message.content is T) message as CommonMessage<T> else null
@ -287,7 +285,7 @@ suspend fun <BC : BehaviourContext> BC.onVenue(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onAudioMediaGroup( suspend fun <BC : BehaviourContext> BC.onAudioMediaGroup(
initialFilter: CommonMessageFilter<AudioMediaGroupContent>? = null, initialFilter: CommonMessageFilter<AudioMediaGroupPartContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMediaGroupMessage, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMediaGroupMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in AudioMediaGroupMessage, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in AudioMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMediaGroupMessage> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMediaGroupMessage>
@ -311,7 +309,7 @@ suspend fun <BC : BehaviourContext> BC.onAudioMediaGroup(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onDocumentMediaGroupContent( suspend fun <BC : BehaviourContext> BC.onDocumentMediaGroupContent(
initialFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null, initialFilter: CommonMessageFilter<DocumentMediaGroupPartContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMediaGroupMessage, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMediaGroupMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in DocumentMediaGroupMessage, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in DocumentMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMediaGroupMessage> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMediaGroupMessage>

View File

@ -222,7 +222,7 @@ suspend fun <BC : BehaviourContext> BC.onEditedVenue(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedAudioMediaGroup( suspend fun <BC : BehaviourContext> BC.onEditedAudioMediaGroup(
initialFilter: CommonMessageFilter<AudioMediaGroupContent>? = null, initialFilter: CommonMessageFilter<AudioMediaGroupPartContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMediaGroupMessage, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMediaGroupMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in AudioMediaGroupMessage, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in AudioMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMediaGroupMessage> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMediaGroupMessage>
@ -246,7 +246,7 @@ suspend fun <BC : BehaviourContext> BC.onEditedAudioMediaGroup(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedDocumentMediaGroupContent( suspend fun <BC : BehaviourContext> BC.onEditedDocumentMediaGroupContent(
initialFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null, initialFilter: CommonMessageFilter<DocumentMediaGroupPartContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMediaGroupMessage, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMediaGroupMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in DocumentMediaGroupMessage, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in DocumentMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMediaGroupMessage> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMediaGroupMessage>

View File

@ -11,9 +11,13 @@ import dev.inmo.tgbotapi.extensions.utils.baseSentMessageUpdateOrNull
import dev.inmo.tgbotapi.extensions.utils.chatEventMessageOrNull import dev.inmo.tgbotapi.extensions.utils.chatEventMessageOrNull
import dev.inmo.tgbotapi.types.message.ChatEvents.* import dev.inmo.tgbotapi.types.message.ChatEvents.*
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicCreated
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicReopened
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.* import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
import dev.inmo.tgbotapi.types.message.PrivateEventMessage import dev.inmo.tgbotapi.types.message.PrivateEventMessage
import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
import dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.types.update.abstracts.Update
@ -27,6 +31,16 @@ internal suspend inline fun <BC : BehaviourContext, reified T : ChatEvent> BC.on
(it.baseSentMessageUpdateOrNull() ?.data ?.chatEventMessageOrNull() ?.takeIf { it.chatEvent is T } as? ChatEventMessage<T>) ?.let(::listOfNotNull) (it.baseSentMessageUpdateOrNull() ?.data ?.chatEventMessageOrNull() ?.takeIf { it.chatEvent is T } as? ChatEventMessage<T>) ?.let(::listOfNotNull)
} }
internal suspend inline fun <BC : BehaviourContext, reified T : ChatEvent, reified CEM : ChatEventMessage<T>> BC.onEventWithCustomChatEventMessage(
initialFilter: SimpleFilter<CEM>? = null,
noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CEM, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in CEM, Any> = ByChatMessageMarkerFactory,
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CEM>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
@Suppress("UNCHECKED_CAST")
(it.baseSentMessageUpdateOrNull() ?.data ?.chatEventMessageOrNull() ?.takeIf { it.chatEvent is T } as? CEM) ?.let(::listOfNotNull)
}
/** /**
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call * @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, * @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
@ -503,12 +517,61 @@ suspend fun <BC : BehaviourContext> BC.onWebAppData(
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PrivateEventMessage<WebAppData>, Update>? = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PrivateEventMessage<WebAppData>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<WebAppData>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in ChatEventMessage<WebAppData>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<WebAppData>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<WebAppData>>
) = onEvent( ) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
initialFilter ?.let { { it is PrivateEventMessage<WebAppData> && initialFilter(it) } },
subcontextUpdatesFilter ?.let { { message: ChatEventMessage<WebAppData>, update: Update -> message is PrivateEventMessage<WebAppData> && subcontextUpdatesFilter(message, update) } }, /**
markerFactory * @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,
if (it is PrivateEventMessage<WebAppData>) { * this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
scenarioReceiver(it) * 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.onForumTopicClosed(
initialFilter: SimpleFilter<SupergroupEventMessage<ForumTopicClosed>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, SupergroupEventMessage<ForumTopicClosed>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<ForumTopicClosed>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, SupergroupEventMessage<ForumTopicClosed>>
) = 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.onForumTopicCreated(
initialFilter: SimpleFilter<SupergroupEventMessage<ForumTopicCreated>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, SupergroupEventMessage<ForumTopicCreated>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<ForumTopicCreated>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, SupergroupEventMessage<ForumTopicCreated>>
) = 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.onForumTopicReopened(
initialFilter: SimpleFilter<SupergroupEventMessage<ForumTopicReopened>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, SupergroupEventMessage<ForumTopicReopened>, Update>? = MessageFilterByChat,
markerFactory: MarkerFactory<in ChatEventMessage<ForumTopicReopened>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, SupergroupEventMessage<ForumTopicReopened>>
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)

View File

@ -13,11 +13,20 @@ internal suspend inline fun <BC : BehaviourContext, reified T> BC.on(
noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, T, Update>? = null, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, T, Update>? = null,
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, T>, noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, T>,
noinline updateToData: (Update) -> List<T>? noinline updateToData: (Update) -> List<T>?
) = flowsUpdatesFilter.expectFlow(bot) { ) = flowsUpdatesFilter.expectFlow(
bot,
filter = initialFilter ?.let {
{
updateToData(it) ?.mapNotNull { data -> updateToData(it) ?.mapNotNull { data ->
if (initialFilter ?.invoke(data) != false) it to data else null if (initialFilter(data)) it to data else null
} ?: emptyList() } ?: emptyList()
}.subscribeSafelyWithoutExceptionsAsync( }
} ?: {
updateToData(it) ?.mapNotNull { data ->
it to data
} ?: emptyList()
}
).subscribeSafelyWithoutExceptionsAsync(
scope, scope,
{ markerFactory(it.second) } { markerFactory(it.second) }
) { (update, triggerData) -> ) { (update, triggerData) ->

View File

@ -0,0 +1,164 @@
@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.ByChatMessageMarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
import dev.inmo.tgbotapi.extensions.utils.baseSentMessageUpdateOrNull
import dev.inmo.tgbotapi.extensions.utils.commonMessageOrNull
import dev.inmo.tgbotapi.extensions.utils.withContentOrNull
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.utils.PreviewFeature
@PreviewFeature
internal suspend inline fun <BC : BehaviourContext, reified T : MediaGroupPartContent> BC.buildMediaGroupMessagesTrigger(
initialFilter: SimpleFilter<MediaGroupMessage<T>>? = null,
noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupMessage<T>, Update>? = null,
markerFactory: MarkerFactory<in MediaGroupMessage<T>, Any> = ByChatMessageMarkerFactory,
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupMessage<T>>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
it.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull<MediaGroupContent<*>>() ?.let {
if (it.content.group.all { it.content is T }) {
listOf(it as MediaGroupMessage<T>)
} else {
null
}
} ?: emptyList()
}
/**
* @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.onMediaGroupMessages(
initialFilter: SimpleFilter<MediaGroupMessage<MediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupMessage<MediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in MediaGroupMessage<MediaGroupPartContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupMessage<MediaGroupPartContent>>
) = buildMediaGroupMessagesTrigger(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.onPlaylistMessages(
initialFilter: SimpleFilter<MediaGroupMessage<AudioMediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupMessage<AudioMediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in MediaGroupMessage<AudioMediaGroupPartContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupMessage<AudioMediaGroupPartContent>>
) = buildMediaGroupMessagesTrigger(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.onDocumentsGroupMessages(
initialFilter: SimpleFilter<MediaGroupMessage<DocumentMediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupMessage<DocumentMediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in MediaGroupMessage<DocumentMediaGroupPartContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupMessage<DocumentMediaGroupPartContent>>
) = buildMediaGroupMessagesTrigger(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.onVisualGalleryMessages(
initialFilter: SimpleFilter<MediaGroupMessage<VisualMediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupMessage<VisualMediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in MediaGroupMessage<VisualMediaGroupPartContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupMessage<VisualMediaGroupPartContent>>
) = buildMediaGroupMessagesTrigger(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.onVisualMediaGroupMessages(
initialFilter: SimpleFilter<MediaGroupMessage<VisualMediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupMessage<VisualMediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in MediaGroupMessage<VisualMediaGroupPartContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupMessage<VisualMediaGroupPartContent>>
) = onVisualGalleryMessages(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.onPhotoGalleryMessages(
initialFilter: SimpleFilter<MediaGroupMessage<PhotoContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupMessage<PhotoContent>, Update>? = null,
markerFactory: MarkerFactory<in MediaGroupMessage<PhotoContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupMessage<PhotoContent>>
) = buildMediaGroupMessagesTrigger(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.onVideoGalleryMessages(
initialFilter: SimpleFilter<MediaGroupMessage<VideoContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupMessage<VideoContent>, Update>? = null,
markerFactory: MarkerFactory<in MediaGroupMessage<VideoContent>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupMessage<VideoContent>>
) = buildMediaGroupMessagesTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)

View File

@ -3,28 +3,31 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
import dev.inmo.tgbotapi.extensions.behaviour_builder.* import dev.inmo.tgbotapi.extensions.behaviour_builder.*
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.MessagesFilterByChat
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatMediaGroupMarkerFactory import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.AnyMarkerFactory
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
import dev.inmo.tgbotapi.extensions.utils.sentMediaGroupUpdateOrNull import dev.inmo.tgbotapi.extensions.utils.baseSentMessageUpdateOrNull
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage import dev.inmo.tgbotapi.extensions.utils.commonMessageOrNull
import dev.inmo.tgbotapi.extensions.utils.withContentOrNull
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.utils.PreviewFeature import dev.inmo.tgbotapi.utils.PreviewFeature
@PreviewFeature @PreviewFeature
internal suspend inline fun <BC : BehaviourContext, reified T : MediaGroupContent> BC.buildMediaGroupTrigger( internal suspend inline fun <BC : BehaviourContext, reified T : MediaGroupPartContent> BC.buildMediaGroupTrigger(
initialFilter: SimpleFilter<List<MediaGroupMessage<T>>>? = null, initialFilter: SimpleFilter<MediaGroupContent<T>>? = null,
noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, List<MediaGroupMessage<T>>, Update>? = MessagesFilterByChat, noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupContent<T>, Update>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<T>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in MediaGroupContent<T>, Any> = AnyMarkerFactory(),
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<T>>> noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupContent<T>>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
(it.sentMediaGroupUpdateOrNull() ?.data ?.takeIf { messages -> it.baseSentMessageUpdateOrNull() ?.data ?.commonMessageOrNull() ?.withContentOrNull<MediaGroupContent<*>>() ?.let {
messages.all { message -> if (it.content.group.all { it.content is T }) {
message.content is T listOf(it.content as MediaGroupContent<T>)
} else {
null
} }
} as? List<MediaGroupMessage<T>>) ?.let(::listOfNotNull) } ?: emptyList()
} }
/** /**
@ -40,10 +43,10 @@ internal suspend inline fun <BC : BehaviourContext, reified T : MediaGroupConten
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onMediaGroup( suspend fun <BC : BehaviourContext> BC.onMediaGroup(
initialFilter: SimpleFilter<List<MediaGroupMessage<MediaGroupContent>>>? = null, initialFilter: SimpleFilter<MediaGroupContent<MediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, List<MediaGroupMessage<MediaGroupContent>>, Update>? = MessagesFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupContent<MediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<MediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in MediaGroupContent<MediaGroupPartContent>, Any> = AnyMarkerFactory(),
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<MediaGroupContent>>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupContent<MediaGroupPartContent>>
) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/** /**
@ -59,10 +62,10 @@ suspend fun <BC : BehaviourContext> BC.onMediaGroup(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onPlaylist( suspend fun <BC : BehaviourContext> BC.onPlaylist(
initialFilter: SimpleFilter<List<MediaGroupMessage<AudioMediaGroupContent>>>? = null, initialFilter: SimpleFilter<MediaGroupContent<AudioMediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, List<MediaGroupMessage<AudioMediaGroupContent>>, Update>? = MessagesFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupContent<AudioMediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<AudioMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in MediaGroupContent<AudioMediaGroupPartContent>, Any> = AnyMarkerFactory(),
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<AudioMediaGroupContent>>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupContent<AudioMediaGroupPartContent>>
) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/** /**
@ -78,10 +81,10 @@ suspend fun <BC : BehaviourContext> BC.onPlaylist(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onDocumentsGroup( suspend fun <BC : BehaviourContext> BC.onDocumentsGroup(
initialFilter: SimpleFilter<List<MediaGroupMessage<DocumentMediaGroupContent>>>? = null, initialFilter: SimpleFilter<MediaGroupContent<DocumentMediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, List<MediaGroupMessage<DocumentMediaGroupContent>>, Update>? = MessagesFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupContent<DocumentMediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<DocumentMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in MediaGroupContent<DocumentMediaGroupPartContent>, Any> = AnyMarkerFactory(),
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<DocumentMediaGroupContent>>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupContent<DocumentMediaGroupPartContent>>
) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/** /**
@ -97,10 +100,10 @@ suspend fun <BC : BehaviourContext> BC.onDocumentsGroup(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onVisualGallery( suspend fun <BC : BehaviourContext> BC.onVisualGallery(
initialFilter: SimpleFilter<List<MediaGroupMessage<VisualMediaGroupContent>>>? = null, initialFilter: SimpleFilter<MediaGroupContent<VisualMediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, List<MediaGroupMessage<VisualMediaGroupContent>>, Update>? = MessagesFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupContent<VisualMediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<VisualMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in MediaGroupContent<VisualMediaGroupPartContent>, Any> = AnyMarkerFactory(),
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<VisualMediaGroupContent>>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupContent<VisualMediaGroupPartContent>>
) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/** /**
@ -116,10 +119,10 @@ suspend fun <BC : BehaviourContext> BC.onVisualGallery(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onVisualMediaGroup( suspend fun <BC : BehaviourContext> BC.onVisualMediaGroup(
initialFilter: SimpleFilter<List<MediaGroupMessage<VisualMediaGroupContent>>>? = null, initialFilter: SimpleFilter<MediaGroupContent<VisualMediaGroupPartContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, List<MediaGroupMessage<VisualMediaGroupContent>>, Update>? = MessagesFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupContent<VisualMediaGroupPartContent>, Update>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<VisualMediaGroupContent>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in MediaGroupContent<VisualMediaGroupPartContent>, Any> = AnyMarkerFactory(),
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<VisualMediaGroupContent>>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupContent<VisualMediaGroupPartContent>>
) = onVisualGallery(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ) = onVisualGallery(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/** /**
@ -135,10 +138,10 @@ suspend fun <BC : BehaviourContext> BC.onVisualMediaGroup(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onPhotoGallery( suspend fun <BC : BehaviourContext> BC.onPhotoGallery(
initialFilter: SimpleFilter<List<MediaGroupMessage<PhotoContent>>>? = null, initialFilter: SimpleFilter<MediaGroupContent<PhotoContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, List<MediaGroupMessage<PhotoContent>>, Update>? = MessagesFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupContent<PhotoContent>, Update>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<PhotoContent>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in MediaGroupContent<PhotoContent>, Any> = AnyMarkerFactory(),
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<PhotoContent>>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupContent<PhotoContent>>
) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
/** /**
@ -154,8 +157,8 @@ suspend fun <BC : BehaviourContext> BC.onPhotoGallery(
* data * data
*/ */
suspend fun <BC : BehaviourContext> BC.onVideoGallery( suspend fun <BC : BehaviourContext> BC.onVideoGallery(
initialFilter: SimpleFilter<List<MediaGroupMessage<VideoContent>>>? = null, initialFilter: SimpleFilter<MediaGroupContent<VideoContent>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, List<MediaGroupMessage<VideoContent>>, Update>? = MessagesFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaGroupContent<VideoContent>, Update>? = null,
markerFactory: MarkerFactory<in List<MediaGroupMessage<VideoContent>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in MediaGroupContent<VideoContent>, Any> = AnyMarkerFactory(),
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<VideoContent>>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaGroupContent<VideoContent>>
) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ) = buildMediaGroupTrigger(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)

View File

@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
private val commonAnyMarker = MarkerFactory<Any, Any> { it }
fun <T> AnyMarkerFactory() = commonAnyMarker as MarkerFactory<T, T>

View File

@ -1,8 +0,0 @@
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
import dev.inmo.tgbotapi.extensions.utils.shortcuts.chat
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
object ByChatMediaGroupMarkerFactory : MarkerFactory<List<MediaGroupMessage<*>>, Any> {
override suspend fun invoke(data: List<MediaGroupMessage<*>>) = data.chat ?: error("Data must not be empty")
}

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests
import dev.inmo.tgbotapi.abstracts.types.MessageAction import dev.inmo.tgbotapi.abstracts.types.MessageAction
import dev.inmo.tgbotapi.abstracts.types.ProtectContent import dev.inmo.tgbotapi.abstracts.types.ProtectContent
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@ -18,11 +19,13 @@ data class ForwardMessage(
val toChatId: ChatIdentifier, val toChatId: ChatIdentifier,
@SerialName(messageIdField) @SerialName(messageIdField)
override val messageId: MessageId, override val messageId: MessageId,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
val disableNotification: Boolean = false, val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
override val protectContent: Boolean = false override val protectContent: Boolean = false
): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent { ): SimpleRequest<PossiblyForwardedMessage>, MessageAction, ProtectContent, OptionallyMessageThreadRequest {
override val chatId: ChatIdentifier override val chatId: ChatIdentifier
get() = fromChatId get() = fromChatId

View File

@ -0,0 +1,20 @@
package dev.inmo.tgbotapi.requests.chat.forum
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.utils.RGBColor
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
data class CloseForumTopic (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageThreadIdField)
val messageThreadId: MessageThreadId
): ModifyForumRequest {
override fun method(): String = "closeForumTopic"
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@ -0,0 +1,32 @@
package dev.inmo.tgbotapi.requests.chat.forum
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.utils.RGBColor
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
data class CreateForumTopic (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(nameField)
val name: String,
@SerialName(iconColorField)
val color: RGBColor,
@SerialName(iconCustomEmojiIdField)
val iconEmojiId: CustomEmojiId? = null,
): ForumRequest<ForumTopic> {
init {
if (name.length !in threadNameLength) {
throw IllegalArgumentException("Thread name must be in $threadNameLength range")
}
}
override fun method(): String = "createForumTopic"
override val resultDeserializer: DeserializationStrategy<ForumTopic>
get() = ForumTopic.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@ -0,0 +1,20 @@
package dev.inmo.tgbotapi.requests.chat.forum
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.utils.RGBColor
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
data class DeleteForumTopic (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageThreadIdField)
val messageThreadId: MessageThreadId
): ModifyForumRequest {
override fun method(): String = "deleteForumTopic"
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@ -0,0 +1,30 @@
package dev.inmo.tgbotapi.requests.chat.forum
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.utils.RGBColor
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
data class EditForumTopic (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageThreadIdField)
val messageThreadId: MessageThreadId,
@SerialName(nameField)
val name: String,
@SerialName(iconCustomEmojiIdField)
val iconEmojiId: CustomEmojiId,
): ModifyForumRequest {
init {
if (name.length !in threadNameLength) {
throw IllegalArgumentException("Thread name must be in $threadNameLength range")
}
}
override fun method(): String = "editForumTopic"
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@ -0,0 +1,6 @@
package dev.inmo.tgbotapi.requests.chat.forum
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
sealed interface ForumRequest<T : Any> : SimpleRequest<T>, ChatRequest

View File

@ -0,0 +1,10 @@
package dev.inmo.tgbotapi.requests.chat.forum
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.builtins.serializer
sealed interface ModifyForumRequest : ForumRequest<Boolean> {
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = Boolean.serializer()
}

View File

@ -0,0 +1,20 @@
package dev.inmo.tgbotapi.requests.chat.forum
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.utils.RGBColor
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
data class ReopenForumTopic (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageThreadIdField)
val messageThreadId: MessageThreadId
): ModifyForumRequest {
override fun method(): String = "reopenForumTopic"
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@ -0,0 +1,20 @@
package dev.inmo.tgbotapi.requests.chat.forum
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.utils.RGBColor
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
data class UnpinAllForumTopicMessages (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(messageThreadIdField)
val messageThreadId: MessageThreadId
): ModifyForumRequest {
override fun method(): String = "unpinAllForumTopicMessages"
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@ -0,0 +1,23 @@
package dev.inmo.tgbotapi.requests.chat.get
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.abstracts.types.OptionalChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.files.Sticker
import dev.inmo.tgbotapi.types.files.StickerSerializer
import kotlinx.serialization.*
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
object GetForumTopicIconStickers : SimpleRequest<List<Sticker>> {
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
private val deserializer = ListSerializer(StickerSerializer)
override fun method(): String = "getForumTopicIconStickers"
override val resultDeserializer: DeserializationStrategy<List<Sticker>>
get() = deserializer
}

View File

@ -35,7 +35,9 @@ data class PromoteChatMember(
@SerialName(canManageVideoChatsField) @SerialName(canManageVideoChatsField)
private val canManageVideoChats: Boolean? = null, private val canManageVideoChats: Boolean? = null,
@SerialName(canManageChatField) @SerialName(canManageChatField)
private val canManageChat: Boolean? = null private val canManageChat: Boolean? = null,
@SerialName(canManageTopicsField)
private val canManageTopics: Boolean? = null
) : ChatMemberRequest<Boolean>, UntilDate { ) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "promoteChatMember" override fun method(): String = "promoteChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>

View File

@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.TextedOutput
import dev.inmo.tgbotapi.abstracts.types.MessageAction import dev.inmo.tgbotapi.abstracts.types.MessageAction
import dev.inmo.tgbotapi.abstracts.types.ProtectContent import dev.inmo.tgbotapi.abstracts.types.ProtectContent
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.textsources.TextSource
@ -26,6 +27,7 @@ fun CopyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -38,6 +40,7 @@ fun CopyMessage(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -50,6 +53,7 @@ fun CopyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
entities: List<TextSource>, entities: List<TextSource>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -62,6 +66,7 @@ fun CopyMessage(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -75,6 +80,7 @@ fun CopyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -87,6 +93,7 @@ fun CopyMessage(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -99,6 +106,7 @@ fun CopyMessage(
messageId: MessageId, messageId: MessageId,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
entities: List<TextSource>, entities: List<TextSource>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -111,6 +119,7 @@ fun CopyMessage(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -132,6 +141,8 @@ data class CopyMessage internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -146,7 +157,8 @@ data class CopyMessage internal constructor(
ReplyingMarkupSendMessageRequest<MessageId>, ReplyingMarkupSendMessageRequest<MessageId>,
MessageAction, MessageAction,
TextedOutput, TextedOutput,
ProtectContent { ProtectContent,
OptionallyMessageThreadRequest {
override val chatId: ChatIdentifier override val chatId: ChatIdentifier
get() = fromChatId get() = fromChatId
override val textSources: List<TextSource>? by lazy { override val textSources: List<TextSource>? by lazy {

View File

@ -22,6 +22,8 @@ data class SendContact(
val firstName: String, val firstName: String,
@SerialName(lastNameField) @SerialName(lastNameField)
val lastName: String? = null, val lastName: String? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -38,6 +40,7 @@ data class SendContact(
constructor( constructor(
chatId: ChatIdentifier, chatId: ChatIdentifier,
contact: Contact, contact: Contact,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -48,6 +51,7 @@ data class SendContact(
contact.phoneNumber, contact.phoneNumber,
contact.firstName, contact.firstName,
contact.lastName, contact.lastName,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -64,6 +68,7 @@ data class SendContact(
fun Contact.toRequest( fun Contact.toRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -72,6 +77,7 @@ fun Contact.toRequest(
): SendContact = SendContact( ): SendContact = SendContact(
chatId, chatId,
this, this,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,

View File

@ -20,6 +20,8 @@ data class SendDice(
override val chatId: ChatIdentifier, override val chatId: ChatIdentifier,
@SerialName(emojiField) @SerialName(emojiField)
val animationType: DiceAnimationType? = null, val animationType: DiceAnimationType? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId?,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -18,6 +18,7 @@ fun SendLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -31,6 +32,7 @@ fun SendLocation(
null, null,
null, null,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -42,12 +44,13 @@ fun SendStaticLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendLocation(chatId, latitude, longitude, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = SendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
fun SendLiveLocation( fun SendLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
@ -57,6 +60,7 @@ fun SendLiveLocation(
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -70,6 +74,7 @@ fun SendLiveLocation(
horizontalAccuracy, horizontalAccuracy,
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -93,6 +98,8 @@ data class SendLocation internal constructor(
override val heading: Degrees? = null, override val heading: Degrees? = null,
@SerialName(proximityAlertRadiusField) @SerialName(proximityAlertRadiusField)
override val proximityAlertRadius: Meters? = null, override val proximityAlertRadius: Meters? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -25,6 +25,7 @@ fun SendTextMessage(
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -35,6 +36,7 @@ fun SendTextMessage(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableWebPagePreview, disableWebPagePreview,
disableNotification, disableNotification,
protectContent, protectContent,
@ -47,6 +49,7 @@ fun SendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
disableWebPagePreview: Boolean? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -57,6 +60,7 @@ fun SendTextMessage(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableWebPagePreview, disableWebPagePreview,
disableNotification, disableNotification,
protectContent, protectContent,
@ -75,6 +79,8 @@ data class SendTextMessage internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(entitiesField) @SerialName(entitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableWebPagePreviewField) @SerialName(disableWebPagePreviewField)
override val disableWebPagePreview: Boolean? = null, override val disableWebPagePreview: Boolean? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)

View File

@ -32,6 +32,8 @@ data class SendVenue(
val googlePlaceId: GooglePlaceId? = null, val googlePlaceId: GooglePlaceId? = null,
@SerialName(googlePlaceTypeField) @SerialName(googlePlaceTypeField)
val googlePlaceType: GooglePlaceType? = null, val googlePlaceType: GooglePlaceType? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -50,6 +52,7 @@ data class SendVenue(
constructor( constructor(
chatId: ChatIdentifier, chatId: ChatIdentifier,
venue: Venue, venue: Venue,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -65,6 +68,7 @@ data class SendVenue(
foursquareType = venue.foursquareType, foursquareType = venue.foursquareType,
googlePlaceId = venue.googlePlaceId, googlePlaceId = venue.googlePlaceId,
googlePlaceType = venue.googlePlaceType, googlePlaceType = venue.googlePlaceType,
threadId = threadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
replyToMessageId = replyToMessageId, replyToMessageId = replyToMessageId,
@ -81,6 +85,7 @@ data class SendVenue(
fun Venue.toRequest( fun Venue.toRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -89,6 +94,7 @@ fun Venue.toRequest(
): SendVenue = SendVenue( ): SendVenue = SendVenue(
chatId, chatId,
this, this,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,

View File

@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.types.MessageThreadId
interface OptionallyMessageThreadRequest {
val threadId: MessageThreadId?
}

View File

@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.abstracts.types.ChatRequest import dev.inmo.tgbotapi.abstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.MessageThreadId
interface SendChatMessageRequest<T: Any> : SimpleRequest<T>, ChatRequest interface SendChatMessageRequest<T: Any> : SimpleRequest<T>, ChatRequest

View File

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

View File

@ -18,6 +18,8 @@ data class SendGame (
override val chatId: ChatIdentifier, override val chatId: ChatIdentifier,
@SerialName(gameShortNameField) @SerialName(gameShortNameField)
val gameShortName: String, val gameShortName: String,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -28,6 +28,7 @@ fun SendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -49,6 +50,7 @@ fun SendAnimation(
duration, duration,
width, width,
height, height,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -74,6 +76,7 @@ fun SendAnimation(
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -95,6 +98,7 @@ fun SendAnimation(
duration, duration,
width, width,
height, height,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -135,6 +139,8 @@ data class SendAnimationData internal constructor(
override val width: Int? = null, override val width: Int? = null,
@SerialName(heightField) @SerialName(heightField)
override val height: Int? = null, override val height: Int? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -29,6 +29,7 @@ fun SendAudio(
duration: Long? = null, duration: Long? = null,
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -50,6 +51,7 @@ fun SendAudio(
duration, duration,
performer, performer,
title, title,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -75,6 +77,7 @@ fun SendAudio(
duration: Long? = null, duration: Long? = null,
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -96,6 +99,7 @@ fun SendAudio(
duration, duration,
performer, performer,
title, title,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -136,6 +140,8 @@ data class SendAudioData internal constructor(
override val performer: String? = null, override val performer: String? = null,
@SerialName(titleField) @SerialName(titleField)
override val title: String? = null, override val title: String? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -34,6 +34,7 @@ fun SendDocument(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -53,6 +54,7 @@ fun SendDocument(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -85,6 +87,7 @@ fun SendDocument(
document: InputFile, document: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -104,6 +107,7 @@ fun SendDocument(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -148,6 +152,8 @@ data class SendDocumentData internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -6,29 +6,38 @@ import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.requests.send.media.base.* import dev.inmo.tgbotapi.requests.send.media.base.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.media.* import dev.inmo.tgbotapi.types.media.*
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupContent import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.AudioContent import dev.inmo.tgbotapi.types.message.content.AudioContent
import dev.inmo.tgbotapi.types.message.content.DocumentContent import dev.inmo.tgbotapi.types.message.content.DocumentContent
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
import dev.inmo.tgbotapi.utils.* import dev.inmo.tgbotapi.utils.*
import dev.inmo.tgbotapi.utils.extensions.asMediaGroupMessage
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.builtins.ListSerializer 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.buildJsonArray
import kotlinx.serialization.json.jsonPrimitive
const val rawSendingMediaGroupsWarning = "Media groups contains restrictions related to combinations of media" + 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" " types. Currently it is possible to combine photo + video OR audio OR documents"
@RiskFeature(rawSendingMediaGroupsWarning) @RiskFeature(rawSendingMediaGroupsWarning)
fun <T : MediaGroupContent> SendMediaGroup( fun <T : MediaGroupPartContent> SendMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<MediaGroupMemberTelegramMedia>, media: List<MediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
): Request<List<MediaGroupMessage<T>>> { ): Request<PossiblySentViaBotCommonMessage<T>> {
if (media.size !in mediaCountInMediaGroup) { if (media.size !in mediaCountInMediaGroup) {
throwRangeError("Count of members in media group", mediaCountInMediaGroup, media.size) throwRangeError("Count of members in media group", mediaCountInMediaGroup, media.size)
} }
@ -47,6 +56,7 @@ fun <T : MediaGroupContent> SendMediaGroup(
val data = SendMediaGroupData( val data = SendMediaGroupData(
chatId, chatId,
media, media,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -60,7 +70,7 @@ fun <T : MediaGroupContent> SendMediaGroup(
data, data,
SendMediaGroupFiles(files) SendMediaGroupFiles(files)
) )
}) as Request<List<MediaGroupMessage<T>>> }) as Request<PossiblySentViaBotCommonMessage<T>>
} }
/** /**
@ -72,11 +82,12 @@ fun <T : MediaGroupContent> SendMediaGroup(
inline fun SendPlaylist( inline fun SendPlaylist(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberTelegramMedia>, media: List<AudioMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<AudioContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) ) = SendMediaGroup<AudioContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
/** /**
* Use this method to be sure that you are correctly sending documents media group * Use this method to be sure that you are correctly sending documents media group
@ -87,11 +98,12 @@ inline fun SendPlaylist(
inline fun SendDocumentsGroup( inline fun SendDocumentsGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberTelegramMedia>, media: List<DocumentMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<DocumentContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) ) = SendMediaGroup<DocumentContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
/** /**
* Use this method to be sure that you are correctly sending visual media group * Use this method to be sure that you are correctly sending visual media group
@ -103,20 +115,35 @@ inline fun SendDocumentsGroup(
inline fun SendVisualMediaGroup( inline fun SendVisualMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberTelegramMedia>, media: List<VisualMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<VisualMediaGroupContent>(chatId, media, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply) ) = SendMediaGroup<VisualMediaGroupPartContent>(chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
private val messagesListSerializer: KSerializer<List<MediaGroupMessage<MediaGroupContent>>> private object MessagesListSerializer: KSerializer<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> {
= ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass()) private val serializer = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass<PossiblySentViaBotCommonMessage<MediaGroupPartContent>>())
override val descriptor: SerialDescriptor = serializer.descriptor
override fun deserialize(decoder: Decoder): PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>> {
val messages = serializer.deserialize(decoder)
return messages.asMediaGroupMessage()
}
override fun serialize(encoder: Encoder, value: PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>) {
serializer.serialize(encoder, value.content.group.map { it.sourceMessage })
}
}
@Serializable @Serializable
data class SendMediaGroupData internal constructor( data class SendMediaGroupData internal constructor(
@SerialName(chatIdField) @SerialName(chatIdField)
override val chatId: ChatIdentifier, override val chatId: ChatIdentifier,
val media: List<MediaGroupMemberTelegramMedia> = emptyList(), val media: List<MediaGroupMemberTelegramMedia> = emptyList(),
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -125,7 +152,8 @@ data class SendMediaGroupData internal constructor(
override val replyToMessageId: MessageId? = null, override val replyToMessageId: MessageId? = null,
@SerialName(allowSendingWithoutReplyField) @SerialName(allowSendingWithoutReplyField)
override val allowSendingWithoutReply: Boolean? = null override val allowSendingWithoutReply: Boolean? = null
) : DataRequest<List<MediaGroupMessage<MediaGroupContent>>>, SendMessageRequest<List<MediaGroupMessage<MediaGroupContent>>> { ) : DataRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>>,
SendMessageRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> {
@SerialName(mediaField) @SerialName(mediaField)
private val convertedMedia: String private val convertedMedia: String
get() = buildJsonArray { get() = buildJsonArray {
@ -138,8 +166,8 @@ data class SendMediaGroupData internal constructor(
override fun method(): String = "sendMediaGroup" override fun method(): String = "sendMediaGroup"
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
override val resultDeserializer: DeserializationStrategy<List<MediaGroupMessage<MediaGroupContent>>> override val resultDeserializer: DeserializationStrategy<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>>
get() = messagesListSerializer get() = MessagesListSerializer
} }
data class SendMediaGroupFiles internal constructor( data class SendMediaGroupFiles internal constructor(

View File

@ -23,6 +23,7 @@ fun SendPhoto(
photo: InputFile, photo: InputFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -35,6 +36,7 @@ fun SendPhoto(
text, text,
parseMode, parseMode,
null, null,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -53,6 +55,7 @@ fun SendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
photo: InputFile, photo: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -65,6 +68,7 @@ fun SendPhoto(
entities.makeString(), entities.makeString(),
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -94,6 +98,8 @@ data class SendPhotoData internal constructor(
override val parseMode: ParseMode? = null, override val parseMode: ParseMode? = null,
@SerialName(captionEntitiesField) @SerialName(captionEntitiesField)
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -15,6 +15,7 @@ import kotlinx.serialization.json.JsonObject
fun SendSticker( fun SendSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,
sticker: InputFile, sticker: InputFile,
threadId: MessageThreadId? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageId? = null, replyToMessageId: MessageId? = null,
@ -23,6 +24,7 @@ fun SendSticker(
): Request<ContentMessage<StickerContent>> = SendStickerByFileId( ): Request<ContentMessage<StickerContent>> = SendStickerByFileId(
chatId, chatId,
sticker as? FileId, sticker as? FileId,
threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyToMessageId, replyToMessageId,
@ -44,6 +46,8 @@ data class SendStickerByFileId internal constructor(
override val chatId: ChatIdentifier, override val chatId: ChatIdentifier,
@SerialName(stickerField) @SerialName(stickerField)
val sticker: FileId? = null, val sticker: FileId? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

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