1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 03:28:44 +00:00

add sender_business_bot support

This commit is contained in:
InsanusMokrassar 2024-04-16 18:37:04 +06:00
parent a7b2bb820b
commit cb7bb01671
4 changed files with 23 additions and 3 deletions

View File

@ -26,6 +26,7 @@ data class BusinessContentMessageImpl<T: MessageContent>(
override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupId?,
override val senderBusinessBot: PreviewBot? = null
) : BusinessContentMessage<T> {
constructor(
messageId: MessageId,
@ -41,7 +42,21 @@ data class BusinessContentMessageImpl<T: MessageContent>(
replyMarkup: InlineKeyboardMarkup?,
senderBot: CommonBot?,
mediaGroupId: MediaGroupId?,
senderBusinessBot: PreviewBot? = null,
) : this(
messageId, from, chat, businessConnectionId, content, date, editDate, hasProtectedContent, forwardInfo.messageOrigin(), replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, senderBot, mediaGroupId
messageId = messageId,
from = from,
chat = chat,
businessConnectionId = businessConnectionId,
content = content,
date = date,
editDate = editDate,
hasProtectedContent = hasProtectedContent,
forwardOrigin = forwardInfo.messageOrigin(),
replyInfo = replyTo ?.let { ReplyInfo.Internal(it) },
replyMarkup = replyMarkup,
senderBot = senderBot,
mediaGroupId = mediaGroupId,
senderBusinessBot = senderBusinessBot
)
}

View File

@ -142,6 +142,7 @@ internal data class RawMessage(
// Business
private val business_connection_id: BusinessConnectionId? = null,
private val sender_business_bot: PreviewBot? = null,
// Giveaways
private val giveaway_created: GiveawayCreated? = null,
@ -542,7 +543,8 @@ internal data class RawMessage(
replyInfo,
reply_markup,
via_bot,
media_group_id
media_group_id,
sender_business_bot
)
}
else -> error("Unknown type of chat: $chat")

View File

@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.chat.PreviewBot
import dev.inmo.tgbotapi.types.chat.PreviewPrivateChat
import dev.inmo.tgbotapi.types.message.content.MessageContent
@ -9,4 +10,5 @@ interface BusinessContentMessage<T: MessageContent> : PossiblySentViaBotCommonMe
WithBusinessConnectionId {
override val chat: PreviewPrivateChat
override val businessConnectionId: BusinessConnectionId
val senderBusinessBot: PreviewBot?
}

View File

@ -42,7 +42,8 @@ fun <T : MediaGroupPartContent> List<PossiblySentViaBotCommonMessage<T>>.asMedia
sourceMessage.replyInfo,
sourceMessage.replyMarkup,
sourceMessage.senderBot,
sourceMessage.mediaGroupId
sourceMessage.mediaGroupId,
sourceMessage.senderBusinessBot
)
is PrivateContentMessage -> PrivateContentMessageImpl(
sourceMessage.messageId,