mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-12-07 06:45:57 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97d6d3ad13 | |||
| 3dd428c7d9 | |||
| 688de1053b | |||
| a4fae36b22 | |||
| 909a7fd26a | |||
| 041232e260 | |||
| d4c409107a |
@@ -22,6 +22,13 @@
|
||||
* `FlowsUpdatesFilter` now as marked my annotation `FlowPreview`
|
||||
* `PathedFile#fullUrl` now is not `inline` function
|
||||
* `SimpleRequest#json` now is not `inline` and `internal` function
|
||||
* `FlowsUpdatesFilter` now have two additional flows: `pollAnswerFlow`, `unknownUpdateTypeFlow`
|
||||
* `ExtendedUser` (`typealias`) was added as a `PreviewFeature`
|
||||
|
||||
### 0.25.1
|
||||
|
||||
* Update kotlin: `1.3.70` -> `1.3.71`
|
||||
* Fix of error inside of update utils for media groups
|
||||
|
||||
## 0.24.0
|
||||
|
||||
|
||||
@@ -23,19 +23,19 @@ internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
|
||||
val resultUpdates = mutableListOf<Update>()
|
||||
val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<BaseSentMessageUpdate>>()
|
||||
for (update in this) {
|
||||
val data = (update.data as? MediaGroupMessage)
|
||||
if (data == null) {
|
||||
resultUpdates.add(update)
|
||||
continue
|
||||
}
|
||||
when (update) {
|
||||
is BaseEditMessageUpdate -> resultUpdates.add(
|
||||
update.toEditMediaGroupUpdate()
|
||||
)
|
||||
is BaseSentMessageUpdate -> {
|
||||
val data = update.data
|
||||
if (data is MediaGroupMessage) {
|
||||
mediaGroups.getOrPut(data.mediaGroupId) {
|
||||
mutableListOf()
|
||||
}.add(update)
|
||||
} else {
|
||||
resultUpdates.add(update)
|
||||
}
|
||||
mediaGroups.getOrPut(data.mediaGroupId) {
|
||||
mutableListOf()
|
||||
}.add(update)
|
||||
}
|
||||
else -> resultUpdates.add(update)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended.ExtendedPrivateChatImpl
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.PreviewFeature
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.json.JsonObjectSerializer
|
||||
@@ -21,6 +23,9 @@ data class CommonUser(
|
||||
val languageCode: String? = null
|
||||
) : User()
|
||||
|
||||
@PreviewFeature
|
||||
typealias ExtendedUser = ExtendedPrivateChatImpl
|
||||
|
||||
@Serializable(UserSerializer::class)
|
||||
sealed class Bot : User() {
|
||||
abstract override val username: Username
|
||||
|
||||
@@ -29,6 +29,8 @@ class FlowsUpdatesFilter(
|
||||
private val shippingQueryChannel: BroadcastChannel<ShippingQueryUpdate> = BroadcastChannel(broadcastChannelsSize)
|
||||
private val preCheckoutQueryChannel: BroadcastChannel<PreCheckoutQueryUpdate> = BroadcastChannel(broadcastChannelsSize)
|
||||
private val pollChannel: BroadcastChannel<PollUpdate> = BroadcastChannel(broadcastChannelsSize)
|
||||
private val pollAnswerChannel: BroadcastChannel<PollAnswerUpdate> = BroadcastChannel(broadcastChannelsSize)
|
||||
private val unknownUpdateChannel: BroadcastChannel<Update> = BroadcastChannel(broadcastChannelsSize)
|
||||
|
||||
override val allowedUpdates: List<String>
|
||||
get() = filter.allowedUpdates
|
||||
@@ -49,7 +51,9 @@ class FlowsUpdatesFilter(
|
||||
callbackQueryChannel.createUpdateReceiver(),
|
||||
shippingQueryChannel.createUpdateReceiver(),
|
||||
preCheckoutQueryChannel.createUpdateReceiver(),
|
||||
pollChannel.createUpdateReceiver()
|
||||
pollChannel.createUpdateReceiver(),
|
||||
pollAnswerChannel.createUpdateReceiver(),
|
||||
unknownUpdateChannel.createUpdateReceiver()
|
||||
)
|
||||
|
||||
val messageFlow: Flow<MessageUpdate> = messageChannel.asFlow()
|
||||
@@ -66,4 +70,6 @@ class FlowsUpdatesFilter(
|
||||
val shippingQueryFlow: Flow<ShippingQueryUpdate> = shippingQueryChannel.asFlow()
|
||||
val preCheckoutQueryFlow: Flow<PreCheckoutQueryUpdate> = preCheckoutQueryChannel.asFlow()
|
||||
val pollFlow: Flow<PollUpdate> = pollChannel.asFlow()
|
||||
val pollAnswerFlow: Flow<PollAnswerUpdate> = pollAnswerChannel.asFlow()
|
||||
val unknownUpdateTypeFlow: Flow<Update> = unknownUpdateChannel.asFlow()
|
||||
}
|
||||
@@ -1,7 +1,19 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.utils
|
||||
|
||||
@RequiresOptIn(
|
||||
"It is possible, that bevahiour of this thing will be changed later",
|
||||
"It is possible, that behaviour of this thing will be changed later",
|
||||
RequiresOptIn.Level.WARNING
|
||||
)
|
||||
@Target(
|
||||
AnnotationTarget.CLASS,
|
||||
AnnotationTarget.CONSTRUCTOR,
|
||||
AnnotationTarget.FIELD,
|
||||
AnnotationTarget.PROPERTY,
|
||||
AnnotationTarget.PROPERTY_GETTER,
|
||||
AnnotationTarget.PROPERTY_SETTER,
|
||||
AnnotationTarget.FUNCTION,
|
||||
AnnotationTarget.TYPE,
|
||||
AnnotationTarget.TYPEALIAS,
|
||||
AnnotationTarget.TYPE_PARAMETER
|
||||
)
|
||||
annotation class PreviewFeature
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
kotlin.code.style=official
|
||||
kotlin_version=1.3.70
|
||||
kotlin_version=1.3.71
|
||||
kotlin_coroutines_version=1.3.5
|
||||
kotlin_serialisation_runtime_version=0.20.0
|
||||
klock_version=1.10.0
|
||||
@@ -7,6 +7,6 @@ uuid_version=0.1.0
|
||||
ktor_version=1.3.2
|
||||
|
||||
library_group=com.github.insanusmokrassar
|
||||
library_version=0.25.0
|
||||
library_version=0.25.1
|
||||
|
||||
gradle_bintray_plugin_version=1.8.4
|
||||
|
||||
Reference in New Issue
Block a user