1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

start adding of support business_connection_id in sending requests

This commit is contained in:
InsanusMokrassar 2024-04-16 23:11:01 +06:00
parent 953bdef657
commit e4a3acdd68
23 changed files with 155 additions and 8 deletions

View File

@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.abstracts.types
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
interface OptionallyBusinessConnectionRequest {
val businessConnectionId: BusinessConnectionId?
}

View File

@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest 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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
@ -28,6 +29,7 @@ fun CopyMessage(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -40,6 +42,7 @@ fun CopyMessage(
parseMode, parseMode,
null, null,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -52,6 +55,7 @@ fun CopyMessage(
messageId: MessageId, messageId: MessageId,
entities: List<TextSource>, entities: List<TextSource>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -64,6 +68,7 @@ fun CopyMessage(
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -77,6 +82,7 @@ fun CopyMessage(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -89,6 +95,7 @@ fun CopyMessage(
parseMode, parseMode,
null, null,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -101,6 +108,7 @@ fun CopyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
entities: List<TextSource>, entities: List<TextSource>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -113,6 +121,7 @@ fun CopyMessage(
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -135,6 +144,8 @@ data class CopyMessage internal constructor(
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = toChatId.threadId, override val threadId: MessageThreadId? = toChatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -2,10 +2,12 @@ package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.abstracts.types.DisableNotification import dev.inmo.tgbotapi.abstracts.types.DisableNotification
import dev.inmo.tgbotapi.abstracts.types.MessagesAction import dev.inmo.tgbotapi.abstracts.types.MessagesAction
import dev.inmo.tgbotapi.abstracts.types.OptionallyBusinessConnectionRequest
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.OptionallyMessageThreadRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.textsources.TextSource
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
@ -20,6 +22,7 @@ fun CopyMessages(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageIds: Array<MessageId>, messageIds: Array<MessageId>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
@ -43,6 +46,8 @@ data class CopyMessages (
override val messageIds: List<MessageId>, override val messageIds: List<MessageId>,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = toChatId.threadId, override val threadId: MessageThreadId? = toChatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -53,6 +58,7 @@ data class CopyMessages (
MessagesAction, MessagesAction,
ProtectContent, ProtectContent,
OptionallyMessageThreadRequest, OptionallyMessageThreadRequest,
OptionallyBusinessConnectionRequest,
DisableNotification { DisableNotification {
override val chatId: ChatIdentifier override val chatId: ChatIdentifier
get() = fromChatId get() = fromChatId

View File

@ -1,9 +1,11 @@
package dev.inmo.tgbotapi.requests.send package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.abstracts.types.OptionallyBusinessConnectionRequest
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendChatMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendChatMessageRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.actions.BotAction import dev.inmo.tgbotapi.types.actions.BotAction
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer import kotlinx.serialization.builtins.serializer
@ -17,8 +19,10 @@ data class SendAction(
@SerialName(actionField) @SerialName(actionField)
val action: BotAction, val action: BotAction,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId override val threadId: MessageThreadId? = chatId.threadId,
): SendChatMessageRequest<Boolean>, OptionallyMessageThreadRequest { @SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
): SendChatMessageRequest<Boolean>, OptionallyMessageThreadRequest, OptionallyBusinessConnectionRequest {
override fun method(): String = "sendChatAction" override fun method(): String = "sendChatAction"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = Boolean.serializer() get() = Boolean.serializer()

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@ -24,6 +25,8 @@ data class SendContact(
val lastName: String? = null, val lastName: String? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -39,6 +42,7 @@ data class SendContact(
chatId: ChatIdentifier, chatId: ChatIdentifier,
contact: Contact, contact: Contact,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -49,6 +53,7 @@ data class SendContact(
contact.firstName, contact.firstName,
contact.lastName, contact.lastName,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -65,6 +70,7 @@ data class SendContact(
fun Contact.toRequest( fun Contact.toRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -73,6 +79,7 @@ fun Contact.toRequest(
chatId, chatId,
this, this,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,

View File

@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.types.DisableNotification
import dev.inmo.tgbotapi.abstracts.types.WithReplyParameters import dev.inmo.tgbotapi.abstracts.types.WithReplyParameters
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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.dice.DiceAnimationType import dev.inmo.tgbotapi.types.dice.DiceAnimationType
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
@ -21,7 +22,9 @@ data class SendDice(
@SerialName(emojiField) @SerialName(emojiField)
val animationType: DiceAnimationType? = null, val animationType: DiceAnimationType? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId?, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.abstracts.* import dev.inmo.tgbotapi.abstracts.*
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@ -19,6 +20,7 @@ fun SendLocation(
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -32,6 +34,7 @@ fun SendLocation(
null, null,
null, null,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -43,11 +46,12 @@ fun SendStaticLocation(
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = SendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = SendLocation(chatId, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup)
fun SendLiveLocation( fun SendLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
@ -58,6 +62,7 @@ fun SendLiveLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -71,6 +76,7 @@ fun SendLiveLocation(
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -95,6 +101,8 @@ data class SendLocation internal constructor(
override val proximityAlertRadius: Meters? = null, override val proximityAlertRadius: Meters? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
@ -26,6 +27,7 @@ fun SendTextMessage(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -36,6 +38,7 @@ fun SendTextMessage(
parseMode, parseMode,
null, null,
threadId, threadId,
businessConnectionId,
linkPreviewOptions, linkPreviewOptions,
disableNotification, disableNotification,
protectContent, protectContent,
@ -48,6 +51,7 @@ fun SendTextMessage(
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -58,6 +62,7 @@ fun SendTextMessage(
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId, threadId,
businessConnectionId,
linkPreviewOptions, linkPreviewOptions,
disableNotification, disableNotification,
protectContent, protectContent,
@ -77,6 +82,8 @@ data class SendTextMessage internal constructor(
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(linkPreviewOptionsField) @SerialName(linkPreviewOptionsField)
override val linkPreviewOptions: LinkPreviewOptions? = null, override val linkPreviewOptions: LinkPreviewOptions? = null,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)

View File

@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@ -34,6 +35,8 @@ data class SendVenue(
val googlePlaceType: GooglePlaceType? = null, val googlePlaceType: GooglePlaceType? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -51,6 +54,7 @@ data class SendVenue(
chatId: ChatIdentifier, chatId: ChatIdentifier,
venue: Venue, venue: Venue,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -82,6 +86,7 @@ data class SendVenue(
fun Venue.toRequest( fun Venue.toRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -90,6 +95,7 @@ fun Venue.toRequest(
chatId, chatId,
this, this,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,

View File

@ -6,4 +6,5 @@ interface SendMessageRequest<T: Any> : SendChatMessageRequest<T>,
WithReplyParameters, WithReplyParameters,
DisableNotification, DisableNotification,
ProtectContent, ProtectContent,
OptionallyMessageThreadRequest OptionallyMessageThreadRequest,
OptionallyBusinessConnectionRequest

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send.games
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@ -20,6 +21,8 @@ data class SendGame (
val gameShortName: String, val gameShortName: String,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
@ -31,6 +32,7 @@ fun SendAnimation(
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -51,6 +53,7 @@ fun SendAnimation(
width, width,
height, height,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -77,6 +80,7 @@ fun SendAnimation(
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -97,6 +101,7 @@ fun SendAnimation(
width, width,
height, height,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -140,6 +145,8 @@ data class SendAnimationData internal constructor(
override val height: Int? = null, override val height: Int? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
@ -31,6 +32,7 @@ fun SendAudio(
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -50,6 +52,7 @@ fun SendAudio(
performer, performer,
title, title,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -75,6 +78,7 @@ fun SendAudio(
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -94,6 +98,7 @@ fun SendAudio(
performer, performer,
title, title,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -135,6 +140,8 @@ data class SendAudioData internal constructor(
override val title: String? = null, override val title: String? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
@ -36,6 +37,7 @@ fun SendDocument(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -53,6 +55,7 @@ fun SendDocument(
parseMode, parseMode,
null, null,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -85,6 +88,7 @@ fun SendDocument(
thumbnail: InputFile? = null, thumbnail: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -102,6 +106,7 @@ fun SendDocument(
null, null,
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -147,6 +152,8 @@ data class SendDocumentData internal constructor(
private val rawEntities: List<RawMessageEntity>? = null, private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest 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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.media.* import dev.inmo.tgbotapi.types.media.*
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
@ -32,6 +33,7 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<MediaGroupMemberTelegramMedia>, media: List<MediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -56,6 +58,7 @@ fun <T : MediaGroupPartContent> SendMediaGroup(
chatId, chatId,
media, media,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters replyParameters
@ -81,11 +84,12 @@ inline fun SendPlaylist(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberTelegramMedia>, media: List<AudioMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<AudioContent>(chatId, media, threadId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) ) = SendMediaGroup<AudioContent>(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, 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
@ -97,11 +101,12 @@ inline fun SendDocumentsGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberTelegramMedia>, media: List<DocumentMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<DocumentContent>(chatId, media, threadId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) ) = SendMediaGroup<DocumentContent>(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, 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
@ -114,11 +119,12 @@ inline fun SendVisualMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberTelegramMedia>, media: List<VisualMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
allowSendingWithoutReply: Boolean? = null allowSendingWithoutReply: Boolean? = null
) = SendMediaGroup<VisualMediaGroupPartContent>(chatId, media, threadId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply) ) = SendMediaGroup<VisualMediaGroupPartContent>(chatId, media, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, allowSendingWithoutReply)
private object MessagesListSerializer: KSerializer<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> { private object MessagesListSerializer: KSerializer<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> {
private val serializer = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass<PossiblySentViaBotCommonMessage<MediaGroupPartContent>>()) private val serializer = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass<PossiblySentViaBotCommonMessage<MediaGroupPartContent>>())
@ -142,6 +148,8 @@ data class SendMediaGroupData internal constructor(
val media: List<MediaGroupMemberTelegramMedia> = emptyList(), val media: List<MediaGroupMemberTelegramMedia> = emptyList(),
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
@ -26,6 +27,7 @@ fun SendPhoto(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -39,6 +41,7 @@ fun SendPhoto(
null, null,
spoilered, spoilered,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -60,6 +63,7 @@ fun SendPhoto(
entities: TextSourcesList, entities: TextSourcesList,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -73,6 +77,7 @@ fun SendPhoto(
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
spoilered, spoilered,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -108,6 +113,8 @@ data class SendPhotoData internal constructor(
override val spoilered: Boolean = false, override val spoilered: Boolean = false,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@ -15,6 +16,7 @@ fun SendSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,
sticker: InputFile, sticker: InputFile,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@ -24,6 +26,7 @@ fun SendSticker(
chatId, chatId,
sticker, sticker,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -49,6 +52,8 @@ data class SendStickerByFileId internal constructor(
val sticker: InputFile, val sticker: InputFile,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
@ -32,6 +33,7 @@ fun SendVideo(
height: Int? = null, height: Int? = null,
supportStreaming: Boolean? = null, supportStreaming: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -53,6 +55,7 @@ fun SendVideo(
height, height,
supportStreaming, supportStreaming,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -80,6 +83,7 @@ fun SendVideo(
height: Int? = null, height: Int? = null,
supportStreaming: Boolean? = null, supportStreaming: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -101,6 +105,7 @@ fun SendVideo(
height, height,
supportStreaming, supportStreaming,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -146,6 +151,8 @@ data class SendVideoData internal constructor(
val supportStreaming: Boolean? = null, val supportStreaming: Boolean? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@ -19,6 +20,7 @@ fun SendVideoNote(
duration: Long? = null, duration: Long? = null,
size: Int? = null, // in documentation - length (size of video side) size: Int? = null, // in documentation - length (size of video side)
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -34,6 +36,7 @@ fun SendVideoNote(
duration, duration,
size, size,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -67,6 +70,8 @@ data class SendVideoNoteData internal constructor(
override val width: Int? = null, override val width: Int? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.requests.send.abstracts.*
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.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField import dev.inmo.tgbotapi.types.message.parseModeField
@ -27,6 +28,7 @@ fun SendVoice(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
duration: Long? = null, duration: Long? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -42,6 +44,7 @@ fun SendVoice(
null, null,
duration, duration,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -63,6 +66,7 @@ fun SendVoice(
voice: InputFile, voice: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
duration: Long? = null, duration: Long? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@ -79,6 +83,7 @@ fun SendVoice(
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
duration, duration,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -114,6 +119,8 @@ data class SendVoiceData internal constructor(
override val duration: Long? = null, override val duration: Long? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.CommonSendInvoiceData
import dev.inmo.tgbotapi.abstracts.types.* import dev.inmo.tgbotapi.abstracts.types.*
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
@ -60,6 +61,8 @@ data class SendInvoice(
override val priceDependOnShipAddress: Boolean = false, override val priceDependOnShipAddress: Boolean = false,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.abstracts.TextedOutput
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSource import dev.inmo.tgbotapi.types.message.textsources.TextSource
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
@ -51,6 +52,7 @@ fun SendPoll(
isAnonymous: Boolean = true, isAnonymous: Boolean = true,
isClosed: Boolean = false, isClosed: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -75,6 +77,7 @@ fun SendPoll(
fun Poll.createRequest( fun Poll.createRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -89,6 +92,7 @@ fun Poll.createRequest(
allowMultipleAnswers, allowMultipleAnswers,
scheduledCloseInfo, scheduledCloseInfo,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -119,6 +123,7 @@ fun Poll.createRequest(
false, false,
scheduledCloseInfo, scheduledCloseInfo,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -133,6 +138,7 @@ fun Poll.createRequest(
false, false,
scheduledCloseInfo, scheduledCloseInfo,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -198,6 +204,8 @@ data class SendRegularPoll(
override val closeDate: LongSeconds?, override val closeDate: LongSeconds?,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)
@ -226,6 +234,7 @@ fun SendRegularPoll(
allowMultipleAnswers: Boolean = false, allowMultipleAnswers: Boolean = false,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -240,6 +249,7 @@ fun SendRegularPoll(
(closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod, (closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
(closeInfo as? ExactScheduledCloseInfo) ?.closeDate, (closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -257,6 +267,7 @@ fun SendQuizPoll(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -273,6 +284,7 @@ fun SendQuizPoll(
null, null,
closeInfo, closeInfo,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -289,6 +301,7 @@ fun SendQuizPoll(
entities: List<TextSource>, entities: List<TextSource>,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -305,6 +318,7 @@ fun SendQuizPoll(
entities.toRawMessageEntities(), entities.toRawMessageEntities(),
closeInfo, closeInfo,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -323,6 +337,7 @@ internal fun SendQuizPoll(
rawEntities: List<RawMessageEntity>? = null, rawEntities: List<RawMessageEntity>? = null,
closeInfo: ScheduledCloseInfo? = null, closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
@ -340,6 +355,7 @@ internal fun SendQuizPoll(
(closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod, (closeInfo as? ApproximateScheduledCloseInfo) ?.openPeriod,
(closeInfo as? ExactScheduledCloseInfo) ?.closeDate, (closeInfo as? ExactScheduledCloseInfo) ?.closeDate,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyParameters,
@ -372,6 +388,8 @@ data class SendQuizPoll internal constructor(
override val closeDate: LongSeconds? = null, override val closeDate: LongSeconds? = null,
@SerialName(messageThreadIdField) @SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId, override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField) @SerialName(disableNotificationField)
override val disableNotification: Boolean = false, override val disableNotification: Boolean = false,
@SerialName(protectContentField) @SerialName(protectContentField)

View File

@ -72,6 +72,9 @@ value class BusinessChatId(val chatIdWithBusinessConnectionId: Pair<RawChatId, B
val ChatIdentifier.threadId: MessageThreadId? val ChatIdentifier.threadId: MessageThreadId?
get() = (this as? IdChatIdentifier) ?.threadId get() = (this as? IdChatIdentifier) ?.threadId
val ChatIdentifier.businessConnectionId: BusinessConnectionId?
get() = (this as? IdChatIdentifier) ?.businessConnectionId
fun IdChatIdentifier.toChatId() = when (this) { fun IdChatIdentifier.toChatId() = when (this) {
is ChatId -> this is ChatId -> this
is ChatIdWithThreadId -> ChatId(chatId) is ChatIdWithThreadId -> ChatId(chatId)