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

commonMain.com.github.insanusmokrassar.TelegramBotAPI.utils.Matrix.kt Maven / Gradle / Ivy

There is a newer version: 0.28.3
Show newest version
package com.github.insanusmokrassar.TelegramBotAPI.utils

import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.Matrix

fun  row(block: RowBuilder.() -> Unit): List {
    return RowBuilder().also(block).row
}

fun  MatrixBuilder.row(block: RowBuilder.() -> Unit) {
    add(RowBuilder().also(block).row)
}

fun  matrix(block: MatrixBuilder.() -> Unit): Matrix {
    return MatrixBuilder().also(block).matrix
}

class RowBuilder {
    private val mutRow: MutableList = ArrayList()
    val row: List
        get() = mutRow

    fun add(t: T) = mutRow.add(t)
}

class MatrixBuilder {
    private val mutMatrix: MutableList> = ArrayList()
    val matrix: Matrix
        get() = mutMatrix

    fun add(t: List) = mutMatrix.add(t)
    operator fun plus(t: List) = add(t)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy