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

eu.vendeli.tgbot.interfaces.features.EntitiesFeature.kt Maven / Gradle / Ivy

There is a newer version: 6.6.0
Show newest version
package eu.vendeli.tgbot.interfaces.features

import eu.vendeli.tgbot.interfaces.IActionState
import eu.vendeli.tgbot.types.MessageEntity
import eu.vendeli.tgbot.utils.builders.EntitiesBuilder

/**
 * Entities feature, see [Features article](https://github.com/vendelieu/telegram-bot/wiki/Features)
 *
 * @param Return Action class itself.
 */
interface EntitiesFeature : IActionState, Feature {
    @Suppress("UNCHECKED_CAST")
    private val thisAsReturn: Return
        get() = this as Return

    /**
     * Entities adding DSL
     */
    fun entities(block: EntitiesBuilder.() -> Unit): Return {
        parameters["entities"] = EntitiesBuilder().apply(block).listOfEntities
        return thisAsReturn
    }

    /**
     * Add Entities directly
     */
    fun entities(entities: List): Return {
        parameters["entities"] = entities
        return thisAsReturn
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy