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

add support of sender_boost_count

This commit is contained in:
InsanusMokrassar 2024-02-16 21:38:28 +06:00
parent 468c54a30f
commit a9a01e3154
5 changed files with 36 additions and 9 deletions

View File

@ -123,6 +123,7 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
override val content: T,
override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupIdentifier?,
override val senderBoostsCount: Int?
) : CommonGroupContentMessage<T> {
constructor(
chat: PreviewGroupChat,
@ -137,8 +138,9 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
content: T,
senderBot: CommonBot?,
mediaGroupId: MediaGroupIdentifier?,
senderBoostsCount: Int?,
) : this(
chat, messageId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId
chat, messageId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId, senderBoostsCount
)
}
@ -226,6 +228,7 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
override val content: T,
override val senderBot: CommonBot?,
override val mediaGroupId: MediaGroupIdentifier?,
override val senderBoostsCount: Int?,
) : CommonForumContentMessage<T> {
constructor(
chat: PreviewForumChat,
@ -241,7 +244,8 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
content: T,
senderBot: CommonBot?,
mediaGroupId: MediaGroupIdentifier?,
senderBoostsCount: Int?,
) : this(
chat, messageId, threadId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId
chat, messageId, threadId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId, senderBoostsCount
)
}

View File

@ -98,6 +98,7 @@ internal data class RawMessage(
private val successful_payment: SuccessfulPayment? = null,
private val giveaway: Giveaway? = null,
private val giveaway_winners: GiveawayResults? = null,
private val sender_boost_count: Int? = null,
private val users_shared: UsersShared? = null,
private val chat_shared: ChatShared? = null,
@ -371,7 +372,8 @@ internal data class RawMessage(
reply_markup,
content,
via_bot,
media_group_id
media_group_id,
sender_boost_count
)
}
} else {
@ -435,7 +437,8 @@ internal data class RawMessage(
reply_markup,
content,
via_bot,
media_group_id
media_group_id,
sender_boost_count
)
}
}
@ -499,7 +502,8 @@ internal data class RawMessage(
reply_markup,
content,
via_bot,
media_group_id
media_group_id,
sender_boost_count
)
}
}

View File

@ -8,6 +8,10 @@ sealed interface GroupContentMessage<T : MessageContent> : PublicContentMessage<
override val chat: PreviewGroupChat
}
sealed interface PotentiallyFromUserGroupContentMessage<T : MessageContent> : GroupContentMessage<T> {
val senderBoostsCount: Int?
}
sealed interface ForumContentMessage<T : MessageContent> : GroupContentMessage<T>, PossiblyTopicMessage {
override val chat: PreviewForumChat
override val threadId: MessageThreadId
@ -28,7 +32,7 @@ interface AnonymousGroupContentMessage<T : MessageContent> : GroupContentMessage
get() = chat
}
interface CommonGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, FromUserMessage
interface CommonGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserMessage
interface FromChannelForumContentMessage<T: MessageContent> : FromChannelGroupContentMessage<T>, ForumContentMessage<T>
@ -37,4 +41,4 @@ interface AnonymousForumContentMessage<T : MessageContent> : ForumContentMessage
get() = chat
}
interface CommonForumContentMessage<T : MessageContent> : ForumContentMessage<T>, FromUserMessage
interface CommonForumContentMessage<T : MessageContent> : ForumContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserMessage

View File

@ -86,7 +86,8 @@ fun <T : MediaGroupPartContent> List<PossiblySentViaBotCommonMessage<T>>.asMedia
sourceMessage.replyMarkup,
content,
sourceMessage.senderBot,
sourceMessage.mediaGroupId
sourceMessage.mediaGroupId,
sourceMessage.senderBoostsCount
)
is ConnectedFromChannelGroupContentMessage -> ConnectedFromChannelGroupContentMessageImpl(
sourceMessage.chat,
@ -146,7 +147,8 @@ fun <T : MediaGroupPartContent> List<PossiblySentViaBotCommonMessage<T>>.asMedia
sourceMessage.replyMarkup,
content,
sourceMessage.senderBot,
sourceMessage.mediaGroupId
sourceMessage.mediaGroupId,
sourceMessage.senderBoostsCount
)
is FromChannelForumContentMessage -> FromChannelForumContentMessageImpl(
sourceMessage.chat,

View File

@ -285,6 +285,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyPaymentMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
import dev.inmo.tgbotapi.types.message.abstracts.PotentiallyFromUserGroupContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.PublicContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.SignedMessage
@ -3397,6 +3398,18 @@ public inline fun <T>
Message.ifGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T): T? =
groupContentMessageOrNull() ?.let(block)
public inline fun Message.potentiallyFromUserGroupContentMessageOrNull():
PotentiallyFromUserGroupContentMessage<MessageContent>? = this as?
dev.inmo.tgbotapi.types.message.abstracts.PotentiallyFromUserGroupContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun Message.potentiallyFromUserGroupContentMessageOrThrow():
PotentiallyFromUserGroupContentMessage<MessageContent> = this as
dev.inmo.tgbotapi.types.message.abstracts.PotentiallyFromUserGroupContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
public inline fun <T>
Message.ifPotentiallyFromUserGroupContentMessage(block: (PotentiallyFromUserGroupContentMessage<MessageContent>) -> T):
T? = potentiallyFromUserGroupContentMessageOrNull() ?.let(block)
public inline fun Message.forumContentMessageOrNull(): ForumContentMessage<MessageContent>? = this
as?
dev.inmo.tgbotapi.types.message.abstracts.ForumContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>