mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
commit
57d2fe85c5
@ -1,5 +1,12 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 2.2.2
|
||||||
|
|
||||||
|
* `Utils`:
|
||||||
|
* `buildEntities` now is inline
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* Fixes in `CallbackQuery` triggers
|
||||||
|
|
||||||
## 2.2.1
|
## 2.2.1
|
||||||
|
|
||||||
* `Versions`:
|
* `Versions`:
|
||||||
|
@ -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=2.2.1
|
library_version=2.2.2
|
||||||
|
@ -6,10 +6,9 @@ import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
|||||||
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CallbackQueryFilterByUser
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.filters.CallbackQueryFilterByUser
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.*
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByUserCallbackQueryMarkerFactory
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByUserCallbackQueryMarkerFactory
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.asCallbackQueryUpdate
|
import dev.inmo.tgbotapi.extensions.utils.asCallbackQueryUpdate
|
||||||
import dev.inmo.tgbotapi.types.queries.callback.*
|
import dev.inmo.tgbotapi.types.queries.callback.*
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
@ -111,7 +110,7 @@ suspend fun <BC : BehaviourContext> BC.onDataCallbackQuery(
|
|||||||
markerFactory: MarkerFactory<in DataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
markerFactory: MarkerFactory<in DataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DataCallbackQuery>
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DataCallbackQuery>
|
||||||
) = onDataCallbackQuery(
|
) = onDataCallbackQuery(
|
||||||
initialFilter = initialFilter + {
|
initialFilter = initialFilter * {
|
||||||
it.data.matches(dataRegex)
|
it.data.matches(dataRegex)
|
||||||
},
|
},
|
||||||
subcontextUpdatesFilter,
|
subcontextUpdatesFilter,
|
||||||
@ -239,7 +238,7 @@ suspend fun <BC : BehaviourContext> BC.onInlineMessageIdDataCallbackQuery(
|
|||||||
markerFactory: MarkerFactory<in InlineMessageIdDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
markerFactory: MarkerFactory<in InlineMessageIdDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, InlineMessageIdDataCallbackQuery>
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, InlineMessageIdDataCallbackQuery>
|
||||||
) = onInlineMessageIdDataCallbackQuery(
|
) = onInlineMessageIdDataCallbackQuery(
|
||||||
initialFilter = initialFilter + {
|
initialFilter = initialFilter * {
|
||||||
it.data.matches(dataRegex)
|
it.data.matches(dataRegex)
|
||||||
},
|
},
|
||||||
subcontextUpdatesFilter,
|
subcontextUpdatesFilter,
|
||||||
@ -367,7 +366,7 @@ suspend fun <BC : BehaviourContext> BC.onMessageDataCallbackQuery(
|
|||||||
markerFactory: MarkerFactory<in MessageDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
markerFactory: MarkerFactory<in MessageDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MessageDataCallbackQuery>
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MessageDataCallbackQuery>
|
||||||
) = onMessageDataCallbackQuery(
|
) = onMessageDataCallbackQuery(
|
||||||
initialFilter = initialFilter + {
|
initialFilter = initialFilter * {
|
||||||
it.data.matches(dataRegex)
|
it.data.matches(dataRegex)
|
||||||
},
|
},
|
||||||
subcontextUpdatesFilter,
|
subcontextUpdatesFilter,
|
||||||
|
@ -5,19 +5,20 @@ package dev.inmo.tgbotapi.extensions.utils.formatting
|
|||||||
import dev.inmo.micro_utils.common.joinTo
|
import dev.inmo.micro_utils.common.joinTo
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.*
|
import dev.inmo.tgbotapi.types.message.textsources.*
|
||||||
import dev.inmo.tgbotapi.types.chat.User
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
|
||||||
typealias EntitiesBuilderBody = EntitiesBuilder.() -> Unit
|
typealias EntitiesBuilderBody = EntitiesBuilder.() -> Unit
|
||||||
val newLine = regular("\n")
|
val newLine = regular("\n")
|
||||||
|
|
||||||
fun buildEntities(separator: TextSource? = null, init: EntitiesBuilderBody): TextSourcesList = EntitiesBuilder(separator).apply(init).build()
|
inline fun buildEntities(separator: TextSource? = null, init: EntitiesBuilderBody): TextSourcesList = EntitiesBuilder(separator).apply(init).build()
|
||||||
fun buildEntities(separator: String, init: EntitiesBuilderBody) = buildEntities(regular(separator), init)
|
inline fun buildEntities(separator: String, init: EntitiesBuilderBody) = buildEntities(regular(separator), init)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This builder can be used to provide building of [TextSource]s [List]
|
* This builder can be used to provide building of [TextSource]s [List]
|
||||||
*
|
*
|
||||||
* @see buildEntities
|
* @see buildEntities
|
||||||
*/
|
*/
|
||||||
class EntitiesBuilder internal constructor(
|
class EntitiesBuilder @RiskFeature constructor(
|
||||||
val separator: TextSource? = null
|
val separator: TextSource? = null
|
||||||
) {
|
) {
|
||||||
private val entitiesList: MutableTextSourcesList = mutableListOf()
|
private val entitiesList: MutableTextSourcesList = mutableListOf()
|
||||||
|
Loading…
Reference in New Issue
Block a user