mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 20:10:18 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b9bc40187f | |||
| 3da4ee4808 | |||
| 6571e8f592 | |||
| 5c13047a0b | |||
| 4908bb2cfe | |||
| a01ca43837 | |||
| a9a01e3154 | |||
| 468c54a30f | |||
| 9177e01910 | |||
| 417f72af4a | |||
| df6d70b20d | |||
| 0b12df14db | |||
| 1590e1eef2 | |||
| ce1abb0ae2 | |||
| 76a2cfd1a0 | |||
|
|
edca5494d4 |
16
CHANGELOG.md
16
CHANGELOG.md
@@ -1,5 +1,21 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 10.1.0
|
||||||
|
|
||||||
|
**Add support of [Telegram Bots API 7.1](https://core.telegram.org/bots/api-changelog#february-16-2024)**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Coroutines`: `1.7.3` -> `1.8.0`
|
||||||
|
* `MicroUtils`: `0.20.32` -> `0.20.34`
|
||||||
|
|
||||||
|
## 10.0.1
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Ktor`: `2.3.7` -> `2.3.8`
|
||||||
|
* `MicroUtils`: `0.20.26` -> `0.20.32`
|
||||||
|
* `Korlibs`: `5.3.0` -> `5.3.1`
|
||||||
|
* `KSLog`: `1.3.1` -> `1.3.2`
|
||||||
|
|
||||||
## 10.0.0
|
## 10.0.0
|
||||||
|
|
||||||
**Add support of [Telegram Bots API 7.0](https://core.telegram.org/bots/api-changelog#december-29-2023)**
|
**Add support of [Telegram Bots API 7.0](https://core.telegram.org/bots/api-changelog#december-29-2023)**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#december-29-2023)
|
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#february-16-2024)
|
||||||
|
|
||||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
||||||
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||||
@@ -118,5 +118,5 @@ suspend fun main() {
|
|||||||
### More examples
|
### More examples
|
||||||
|
|
||||||
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
|
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
|
||||||
always welcome in our [bookstack](https://bookstack.inmo.dev/books/telegrambotapi) and
|
always welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and
|
||||||
[chat](https://t.me/InMoTelegramBotAPIChat).
|
[chat](https://t.me/InMoTelegramBotAPIChat).
|
||||||
|
|||||||
12
build.gradle
12
build.gradle
@@ -54,13 +54,13 @@ if (new File(projectDir, "secret.gradle").exists()) {
|
|||||||
githubRelease {
|
githubRelease {
|
||||||
token "${project.property('GITHUB_RELEASE_TOKEN')}"
|
token "${project.property('GITHUB_RELEASE_TOKEN')}"
|
||||||
|
|
||||||
owner "InsanusMokrassar"
|
owner = "InsanusMokrassar"
|
||||||
repo "TelegramBotAPI"
|
repo = "TelegramBotAPI"
|
||||||
|
|
||||||
tagName "v$library_version"
|
tagName = "v$library_version"
|
||||||
releaseName "$library_version"
|
releaseName = "$library_version"
|
||||||
targetCommitish "$library_version"
|
targetCommitish = "$library_version"
|
||||||
|
|
||||||
body getCurrentVersionChangelog()
|
body = getCurrentVersionChangelog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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=10.0.0
|
library_version=10.1.0
|
||||||
|
|||||||
@@ -2,23 +2,23 @@
|
|||||||
|
|
||||||
kotlin = "1.9.22"
|
kotlin = "1.9.22"
|
||||||
kotlin-serialization = "1.6.2"
|
kotlin-serialization = "1.6.2"
|
||||||
kotlin-coroutines = "1.7.3"
|
kotlin-coroutines = "1.8.0"
|
||||||
|
|
||||||
javax-activation = "1.1.1"
|
javax-activation = "1.1.1"
|
||||||
|
|
||||||
korlibs = "5.3.0"
|
korlibs = "5.3.1"
|
||||||
uuid = "0.8.2"
|
uuid = "0.8.2"
|
||||||
ktor = "2.3.7"
|
ktor = "2.3.8"
|
||||||
|
|
||||||
ksp = "1.9.22-1.0.16"
|
ksp = "1.9.22-1.0.17"
|
||||||
kotlin-poet = "1.15.3"
|
kotlin-poet = "1.16.0"
|
||||||
|
|
||||||
microutils = "0.20.26"
|
microutils = "0.20.34"
|
||||||
kslog = "1.3.1"
|
kslog = "1.3.2"
|
||||||
|
|
||||||
versions = "0.50.0"
|
versions = "0.51.0"
|
||||||
|
|
||||||
github-release-plugin = "2.4.1"
|
github-release-plugin = "2.5.2"
|
||||||
dokka = "1.9.10"
|
dokka = "1.9.10"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
|||||||
@@ -214,3 +214,8 @@ suspend fun BehaviourContext.waitChatShared(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEvents<ChatShared>(initRequest, errorFactory)
|
) = waitEvents<ChatShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostAdded(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEvents<ChatBoostAdded>(initRequest, errorFactory)
|
||||||
|
|||||||
@@ -208,3 +208,8 @@ suspend fun BehaviourContext.waitChatSharedEventsMessages(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEventsMessages<ChatShared>(initRequest, errorFactory)
|
) = waitEventsMessages<ChatShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostAddedEventsMessages(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEventsMessages<ChatBoostAdded>(initRequest, errorFactory)
|
||||||
|
|||||||
@@ -823,3 +823,24 @@ suspend fun <BC : BehaviourContext> BC.onChatShared(
|
|||||||
markerFactory: MarkerFactory<in ChatEventMessage<ChatShared>, Any> = ByChatMessageMarkerFactory,
|
markerFactory: MarkerFactory<in ChatEventMessage<ChatShared>, Any> = ByChatMessageMarkerFactory,
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<ChatShared>>
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<ChatShared>>
|
||||||
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onChatBoostAdded(
|
||||||
|
initialFilter: SimpleFilter<ChatEventMessage<ChatBoostAdded>>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<ChatBoostAdded>, Update>? = MessageFilterByChat,
|
||||||
|
markerFactory: MarkerFactory<in ChatEventMessage<ChatBoostAdded>, Any> = ByChatMessageMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<ChatBoostAdded>>
|
||||||
|
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ value class CustomEmojiId(
|
|||||||
val appLink
|
val appLink
|
||||||
get() = "${internalTgAppLinksBeginning}emoji?id=$this"
|
get() = "${internalTgAppLinksBeginning}emoji?id=$this"
|
||||||
}
|
}
|
||||||
|
@Serializable
|
||||||
|
@JvmInline
|
||||||
|
value class StoryId(
|
||||||
|
val long: Long
|
||||||
|
)
|
||||||
|
|
||||||
typealias Seconds = Int
|
typealias Seconds = Int
|
||||||
typealias MilliSeconds = Long
|
typealias MilliSeconds = Long
|
||||||
@@ -246,6 +251,8 @@ const val profileAccentColorIdField = "profile_accent_color_id"
|
|||||||
const val backgroundCustomEmojiIdField = "background_custom_emoji_id"
|
const val backgroundCustomEmojiIdField = "background_custom_emoji_id"
|
||||||
const val profileBackgroundCustomEmojiIdField = "profile_background_custom_emoji_id"
|
const val profileBackgroundCustomEmojiIdField = "profile_background_custom_emoji_id"
|
||||||
const val hasVisibleHistoryField = "has_visible_history"
|
const val hasVisibleHistoryField = "has_visible_history"
|
||||||
|
const val unrestrictBoostsCountField = "unrestrict_boost_count"
|
||||||
|
const val customEmojiStickerSetNameField = "custom_emoji_sticker_set_name"
|
||||||
const val iconCustomEmojiIdField = "icon_custom_emoji_id"
|
const val iconCustomEmojiIdField = "icon_custom_emoji_id"
|
||||||
const val canJoinGroupsField = "can_join_groups"
|
const val canJoinGroupsField = "can_join_groups"
|
||||||
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
||||||
@@ -656,6 +663,7 @@ const val menuButtonField = "menu_button"
|
|||||||
|
|
||||||
const val boostIdField = "boost_id"
|
const val boostIdField = "boost_id"
|
||||||
const val boostField = "boost"
|
const val boostField = "boost"
|
||||||
|
const val boostCountField = "boost_count"
|
||||||
const val addDateField = "add_date"
|
const val addDateField = "add_date"
|
||||||
const val expirationDateField = "expiration_date"
|
const val expirationDateField = "expiration_date"
|
||||||
const val removeDateField = "remove_date"
|
const val removeDateField = "remove_date"
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import dev.inmo.tgbotapi.types.giveaway.GiveawayPublicResults
|
|||||||
import dev.inmo.tgbotapi.types.giveaway.Giveaway
|
import dev.inmo.tgbotapi.types.giveaway.Giveaway
|
||||||
import dev.inmo.tgbotapi.types.location.Location
|
import dev.inmo.tgbotapi.types.location.Location
|
||||||
import dev.inmo.tgbotapi.types.message.MessageOrigin
|
import dev.inmo.tgbotapi.types.message.MessageOrigin
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import dev.inmo.tgbotapi.types.payments.Invoice
|
import dev.inmo.tgbotapi.types.payments.Invoice
|
||||||
import dev.inmo.tgbotapi.types.polls.Poll
|
import dev.inmo.tgbotapi.types.polls.Poll
|
||||||
@@ -34,6 +33,14 @@ sealed interface ReplyInfo {
|
|||||||
get() = message.metaInfo
|
get() = message.metaInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ToStory(
|
||||||
|
val story: Story
|
||||||
|
): ReplyInfo {
|
||||||
|
override val messageMeta: Message.MetaInfo?
|
||||||
|
get() = null
|
||||||
|
}
|
||||||
|
|
||||||
@Serializable(External.Companion::class)
|
@Serializable(External.Companion::class)
|
||||||
sealed interface External : ReplyInfo {
|
sealed interface External : ReplyInfo {
|
||||||
val origin: MessageOrigin
|
val origin: MessageOrigin
|
||||||
|
|||||||
@@ -184,6 +184,10 @@ data class ExtendedSupergroupChatImpl(
|
|||||||
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
|
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
|
||||||
@SerialName(hasVisibleHistoryField)
|
@SerialName(hasVisibleHistoryField)
|
||||||
override val newMembersSeeHistory: Boolean = false,
|
override val newMembersSeeHistory: Boolean = false,
|
||||||
|
@SerialName(unrestrictBoostsCountField)
|
||||||
|
override val unrestrictBoostsCount: Int? = null,
|
||||||
|
@SerialName(customEmojiStickerSetNameField)
|
||||||
|
override val customEmojiStickerSetName: StickerSetName? = null,
|
||||||
) : ExtendedSupergroupChat
|
) : ExtendedSupergroupChat
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@@ -242,6 +246,10 @@ data class ExtendedForumChatImpl(
|
|||||||
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
|
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
|
||||||
@SerialName(hasVisibleHistoryField)
|
@SerialName(hasVisibleHistoryField)
|
||||||
override val newMembersSeeHistory: Boolean = false,
|
override val newMembersSeeHistory: Boolean = false,
|
||||||
|
@SerialName(unrestrictBoostsCountField)
|
||||||
|
override val unrestrictBoostsCount: Int? = null,
|
||||||
|
@SerialName(customEmojiStickerSetNameField)
|
||||||
|
override val customEmojiStickerSetName: StickerSetName? = null,
|
||||||
) : ExtendedForumChat
|
) : ExtendedForumChat
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ sealed interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat, Ext
|
|||||||
val stickerSetName: StickerSetName?
|
val stickerSetName: StickerSetName?
|
||||||
val canSetStickerSet: Boolean
|
val canSetStickerSet: Boolean
|
||||||
val linkedChannelChatId: IdChatIdentifier?
|
val linkedChannelChatId: IdChatIdentifier?
|
||||||
|
val unrestrictBoostsCount: Int?
|
||||||
val location: ChatLocation?
|
val location: ChatLocation?
|
||||||
|
val customEmojiStickerSetName: StickerSetName?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This field represents field "join_to_send_messages" from API
|
* This field represents field "join_to_send_messages" from API
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.message.ChatEvents
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.boostCountField
|
||||||
|
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ChatBoostAdded(
|
||||||
|
@SerialName(boostCountField)
|
||||||
|
val count: Int
|
||||||
|
) : PublicChatEvent
|
||||||
@@ -123,6 +123,7 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
|
|||||||
override val content: T,
|
override val content: T,
|
||||||
override val senderBot: CommonBot?,
|
override val senderBot: CommonBot?,
|
||||||
override val mediaGroupId: MediaGroupIdentifier?,
|
override val mediaGroupId: MediaGroupIdentifier?,
|
||||||
|
override val senderBoostsCount: Int?
|
||||||
) : CommonGroupContentMessage<T> {
|
) : CommonGroupContentMessage<T> {
|
||||||
constructor(
|
constructor(
|
||||||
chat: PreviewGroupChat,
|
chat: PreviewGroupChat,
|
||||||
@@ -137,8 +138,9 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
|
|||||||
content: T,
|
content: T,
|
||||||
senderBot: CommonBot?,
|
senderBot: CommonBot?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
|
senderBoostsCount: Int?,
|
||||||
) : this(
|
) : 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 content: T,
|
||||||
override val senderBot: CommonBot?,
|
override val senderBot: CommonBot?,
|
||||||
override val mediaGroupId: MediaGroupIdentifier?,
|
override val mediaGroupId: MediaGroupIdentifier?,
|
||||||
|
override val senderBoostsCount: Int?,
|
||||||
) : CommonForumContentMessage<T> {
|
) : CommonForumContentMessage<T> {
|
||||||
constructor(
|
constructor(
|
||||||
chat: PreviewForumChat,
|
chat: PreviewForumChat,
|
||||||
@@ -241,7 +244,8 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
|
|||||||
content: T,
|
content: T,
|
||||||
senderBot: CommonBot?,
|
senderBot: CommonBot?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
|
senderBoostsCount: Int?,
|
||||||
) : this(
|
) : 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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ internal data class RawMessage(
|
|||||||
private val is_topic_message: Boolean? = null,
|
private val is_topic_message: Boolean? = null,
|
||||||
private val is_automatic_forward: Boolean? = null,
|
private val is_automatic_forward: Boolean? = null,
|
||||||
private val reply_to_message: RawMessage? = null,
|
private val reply_to_message: RawMessage? = null,
|
||||||
|
private val reply_to_story: Story? = null,
|
||||||
private val external_reply: ReplyInfo.External? = null,
|
private val external_reply: ReplyInfo.External? = null,
|
||||||
private val quote: TextQuote? = null,
|
private val quote: TextQuote? = null,
|
||||||
private val via_bot: CommonBot? = null,
|
private val via_bot: CommonBot? = null,
|
||||||
@@ -98,6 +99,7 @@ internal data class RawMessage(
|
|||||||
private val successful_payment: SuccessfulPayment? = null,
|
private val successful_payment: SuccessfulPayment? = null,
|
||||||
private val giveaway: Giveaway? = null,
|
private val giveaway: Giveaway? = null,
|
||||||
private val giveaway_winners: GiveawayResults? = null,
|
private val giveaway_winners: GiveawayResults? = null,
|
||||||
|
private val sender_boost_count: Int? = null,
|
||||||
|
|
||||||
private val users_shared: UsersShared? = null,
|
private val users_shared: UsersShared? = null,
|
||||||
private val chat_shared: ChatShared? = null,
|
private val chat_shared: ChatShared? = null,
|
||||||
@@ -117,6 +119,9 @@ internal data class RawMessage(
|
|||||||
private val general_forum_topic_unhidden: GeneralForumTopicUnhidden? = null,
|
private val general_forum_topic_unhidden: GeneralForumTopicUnhidden? = null,
|
||||||
private val write_access_allowed: WriteAccessAllowed? = null,
|
private val write_access_allowed: WriteAccessAllowed? = null,
|
||||||
|
|
||||||
|
// Boost added to groups
|
||||||
|
private val boost_added: ChatBoostAdded? = null,
|
||||||
|
|
||||||
// AutoDelete Message time changed
|
// AutoDelete Message time changed
|
||||||
private val message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged? = null,
|
private val message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged? = null,
|
||||||
|
|
||||||
@@ -247,6 +252,7 @@ internal data class RawMessage(
|
|||||||
giveaway_created != null -> giveaway_created
|
giveaway_created != null -> giveaway_created
|
||||||
giveaway_winners is GiveawayPrivateResults -> giveaway_winners
|
giveaway_winners is GiveawayPrivateResults -> giveaway_winners
|
||||||
giveaway_completed != null -> giveaway_completed
|
giveaway_completed != null -> giveaway_completed
|
||||||
|
boost_added != null -> boost_added
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,6 +301,7 @@ internal data class RawMessage(
|
|||||||
reply_to_message != null -> ReplyInfo.Internal(
|
reply_to_message != null -> ReplyInfo.Internal(
|
||||||
reply_to_message.asMessage
|
reply_to_message.asMessage
|
||||||
)
|
)
|
||||||
|
reply_to_story != null -> ReplyInfo.ToStory(reply_to_story)
|
||||||
external_reply != null -> external_reply
|
external_reply != null -> external_reply
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
@@ -367,7 +374,8 @@ internal data class RawMessage(
|
|||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
via_bot,
|
via_bot,
|
||||||
media_group_id
|
media_group_id,
|
||||||
|
sender_boost_count
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -431,7 +439,8 @@ internal data class RawMessage(
|
|||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
via_bot,
|
via_bot,
|
||||||
media_group_id
|
media_group_id,
|
||||||
|
sender_boost_count
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,7 +504,8 @@ internal data class RawMessage(
|
|||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
via_bot,
|
via_bot,
|
||||||
media_group_id
|
media_group_id,
|
||||||
|
sender_boost_count
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ sealed interface GroupContentMessage<T : MessageContent> : PublicContentMessage<
|
|||||||
override val chat: PreviewGroupChat
|
override val chat: PreviewGroupChat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sealed interface PotentiallyFromUserGroupContentMessage<T : MessageContent> : GroupContentMessage<T> {
|
||||||
|
val senderBoostsCount: Int?
|
||||||
|
}
|
||||||
|
|
||||||
sealed interface ForumContentMessage<T : MessageContent> : GroupContentMessage<T>, PossiblyTopicMessage {
|
sealed interface ForumContentMessage<T : MessageContent> : GroupContentMessage<T>, PossiblyTopicMessage {
|
||||||
override val chat: PreviewForumChat
|
override val chat: PreviewForumChat
|
||||||
override val threadId: MessageThreadId
|
override val threadId: MessageThreadId
|
||||||
@@ -28,7 +32,7 @@ interface AnonymousGroupContentMessage<T : MessageContent> : GroupContentMessage
|
|||||||
get() = chat
|
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>
|
interface FromChannelForumContentMessage<T: MessageContent> : FromChannelGroupContentMessage<T>, ForumContentMessage<T>
|
||||||
|
|
||||||
@@ -37,4 +41,4 @@ interface AnonymousForumContentMessage<T : MessageContent> : ForumContentMessage
|
|||||||
get() = chat
|
get() = chat
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CommonForumContentMessage<T : MessageContent> : ForumContentMessage<T>, FromUserMessage
|
interface CommonForumContentMessage<T : MessageContent> : ForumContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserMessage
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
package dev.inmo.tgbotapi.types.stories
|
package dev.inmo.tgbotapi.types.stories
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.ReplyInfo
|
import dev.inmo.tgbotapi.types.ReplyInfo
|
||||||
|
import dev.inmo.tgbotapi.types.StoryId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||||
|
import dev.inmo.tgbotapi.types.chatField
|
||||||
|
import dev.inmo.tgbotapi.types.idField
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class Story : ReplyInfo.External.ContentVariant
|
data class Story(
|
||||||
|
@SerialName(idField)
|
||||||
|
val id: StoryId,
|
||||||
|
@SerialName(chatField)
|
||||||
|
val chat: PreviewChat
|
||||||
|
) : ReplyInfo.External.ContentVariant
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ fun <T : MediaGroupPartContent> List<PossiblySentViaBotCommonMessage<T>>.asMedia
|
|||||||
sourceMessage.replyMarkup,
|
sourceMessage.replyMarkup,
|
||||||
content,
|
content,
|
||||||
sourceMessage.senderBot,
|
sourceMessage.senderBot,
|
||||||
sourceMessage.mediaGroupId
|
sourceMessage.mediaGroupId,
|
||||||
|
sourceMessage.senderBoostsCount
|
||||||
)
|
)
|
||||||
is ConnectedFromChannelGroupContentMessage -> ConnectedFromChannelGroupContentMessageImpl(
|
is ConnectedFromChannelGroupContentMessage -> ConnectedFromChannelGroupContentMessageImpl(
|
||||||
sourceMessage.chat,
|
sourceMessage.chat,
|
||||||
@@ -146,7 +147,8 @@ fun <T : MediaGroupPartContent> List<PossiblySentViaBotCommonMessage<T>>.asMedia
|
|||||||
sourceMessage.replyMarkup,
|
sourceMessage.replyMarkup,
|
||||||
content,
|
content,
|
||||||
sourceMessage.senderBot,
|
sourceMessage.senderBot,
|
||||||
sourceMessage.mediaGroupId
|
sourceMessage.mediaGroupId,
|
||||||
|
sourceMessage.senderBoostsCount
|
||||||
)
|
)
|
||||||
is FromChannelForumContentMessage -> FromChannelForumContentMessageImpl(
|
is FromChannelForumContentMessage -> FromChannelForumContentMessageImpl(
|
||||||
sourceMessage.chat,
|
sourceMessage.chat,
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ import dev.inmo.tgbotapi.types.media.TitledTelegramMedia
|
|||||||
import dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia
|
import dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia
|
||||||
import dev.inmo.tgbotapi.types.message.ChannelEventMessage
|
import dev.inmo.tgbotapi.types.message.ChannelEventMessage
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated
|
import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated
|
||||||
|
import dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
|
import dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.GroupChatCreated
|
import dev.inmo.tgbotapi.types.message.ChatEvents.GroupChatCreated
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent
|
import dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent
|
||||||
@@ -284,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.PossiblyPaymentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
|
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.PrivateContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PublicContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PublicContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.SignedMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.SignedMessage
|
||||||
@@ -1629,6 +1631,15 @@ public inline fun ReplyInfo.internalOrThrow(): ReplyInfo.Internal = this as
|
|||||||
public inline fun <T> ReplyInfo.ifInternal(block: (ReplyInfo.Internal) -> T): T? = internalOrNull()
|
public inline fun <T> ReplyInfo.ifInternal(block: (ReplyInfo.Internal) -> T): T? = internalOrNull()
|
||||||
?.let(block)
|
?.let(block)
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.toStoryOrNull(): ReplyInfo.ToStory? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.ToStory
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.toStoryOrThrow(): ReplyInfo.ToStory = this as
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.ToStory
|
||||||
|
|
||||||
|
public inline fun <T> ReplyInfo.ifToStory(block: (ReplyInfo.ToStory) -> T): T? = toStoryOrNull()
|
||||||
|
?.let(block)
|
||||||
|
|
||||||
public inline fun BotAction.typingActionOrNull(): TypingAction? = this as?
|
public inline fun BotAction.typingActionOrNull(): TypingAction? = this as?
|
||||||
dev.inmo.tgbotapi.types.actions.TypingAction
|
dev.inmo.tgbotapi.types.actions.TypingAction
|
||||||
|
|
||||||
@@ -2882,6 +2893,15 @@ public inline fun ChatEvent.channelChatCreatedOrThrow(): ChannelChatCreated = th
|
|||||||
public inline fun <T> ChatEvent.ifChannelChatCreated(block: (ChannelChatCreated) -> T): T? =
|
public inline fun <T> ChatEvent.ifChannelChatCreated(block: (ChannelChatCreated) -> T): T? =
|
||||||
channelChatCreatedOrNull() ?.let(block)
|
channelChatCreatedOrNull() ?.let(block)
|
||||||
|
|
||||||
|
public inline fun ChatEvent.chatBoostAddedOrNull(): ChatBoostAdded? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded
|
||||||
|
|
||||||
|
public inline fun ChatEvent.chatBoostAddedOrThrow(): ChatBoostAdded = this as
|
||||||
|
dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded
|
||||||
|
|
||||||
|
public inline fun <T> ChatEvent.ifChatBoostAdded(block: (ChatBoostAdded) -> T): T? =
|
||||||
|
chatBoostAddedOrNull() ?.let(block)
|
||||||
|
|
||||||
public inline fun ChatEvent.deleteChatPhotoOrNull(): DeleteChatPhoto? = this as?
|
public inline fun ChatEvent.deleteChatPhotoOrNull(): DeleteChatPhoto? = this as?
|
||||||
dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
|
dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
|
||||||
|
|
||||||
@@ -3387,6 +3407,18 @@ public inline fun <T>
|
|||||||
Message.ifGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T): T? =
|
Message.ifGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T): T? =
|
||||||
groupContentMessageOrNull() ?.let(block)
|
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
|
public inline fun Message.forumContentMessageOrNull(): ForumContentMessage<MessageContent>? = this
|
||||||
as?
|
as?
|
||||||
dev.inmo.tgbotapi.types.message.abstracts.ForumContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
dev.inmo.tgbotapi.types.message.abstracts.ForumContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user