diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e0294176b..59783cda06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 2.2.2 +* `Utils`: + * `buildEntities` now is inline * `Behaviour Builder`: * Fixes in `CallbackQuery` triggers diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/EntitiesBuilder.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/EntitiesBuilder.kt index 6fa296a680..9a4494c8c9 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/EntitiesBuilder.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/formatting/EntitiesBuilder.kt @@ -5,19 +5,20 @@ package dev.inmo.tgbotapi.extensions.utils.formatting import dev.inmo.micro_utils.common.joinTo import dev.inmo.tgbotapi.types.message.textsources.* import dev.inmo.tgbotapi.types.chat.User +import dev.inmo.tgbotapi.utils.RiskFeature typealias EntitiesBuilderBody = EntitiesBuilder.() -> Unit val newLine = regular("\n") -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: TextSource? = null, init: EntitiesBuilderBody): TextSourcesList = EntitiesBuilder(separator).apply(init).build() +inline fun buildEntities(separator: String, init: EntitiesBuilderBody) = buildEntities(regular(separator), init) /** * This builder can be used to provide building of [TextSource]s [List] * * @see buildEntities */ -class EntitiesBuilder internal constructor( +class EntitiesBuilder @RiskFeature constructor( val separator: TextSource? = null ) { private val entitiesList: MutableTextSourcesList = mutableListOf()