mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 19:48:43 +00:00
inline buildEntities
This commit is contained in:
parent
0a0a7cea0e
commit
c68b148d5e
@ -2,6 +2,8 @@
|
||||
|
||||
## 2.2.2
|
||||
|
||||
* `Utils`:
|
||||
* `buildEntities` now is inline
|
||||
* `Behaviour Builder`:
|
||||
* Fixes in `CallbackQuery` triggers
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user