All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.vendeli.tgbot.utils.builders.EntitiesBuilder.kt Maven / Gradle / Ivy

There is a newer version: 6.6.0
Show newest version
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