eu.vendeli.tgbot.utils.builders.EntitiesBuilder.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of telegram-bot Show documentation
Show all versions of telegram-bot Show documentation
Telegram Bot API wrapper, with handy Kotlin DSL.
package eu.vendeli.tgbot.utils.builders
import eu.vendeli.tgbot.types.EntityType
import eu.vendeli.tgbot.types.MessageEntity
/**
* Entities builder which is used in EntitiesFeature
*/
class EntitiesBuilder {
internal val listOfEntities = mutableListOf()
/**
* Add new entity
*
* @param type
* @param offset
* @param length
* @param url
* @param user
* @param language
*/
fun entity(
type: EntityType,
offset: Int,
length: Int,
block: EntityData.() -> Unit = {},
) {
EntityData().apply(block).also {
listOfEntities.add(MessageEntity(type, offset, length, it.url, it.user, it.language))
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy