Input

@Serializable(with = Checklist.Input.Companion::class)
data class Input(val title: String, val tasks: List<ChecklistTask.Input>, val parseMode: ParseMode? = null, val titleTextSources: List<TextSource> = emptyList(), val othersCanAddTasks: Boolean = false, val othersCanCompleteTasks: Boolean = false) : Checklist(source)

Constructors

Link copied to clipboard
constructor(title: String, tasks: List<ChecklistTask.Input>, parseMode: ParseMode? = null, titleTextSources: List<TextSource> = emptyList(), othersCanAddTasks: Boolean = false, othersCanCompleteTasks: Boolean = false)
constructor(text: String, tasks: List<ChecklistTask.Input>, parseMode: ParseMode? = null, othersCanAddTasks: Boolean = false, othersCanCompleteTasks: Boolean = false)
constructor(titleTextSources: List<TextSource>, tasks: List<ChecklistTask.Input>, othersCanAddTasks: Boolean = false, othersCanCompleteTasks: Boolean = false)
constructor(tasks: List<ChecklistTask.Input>, othersCanAddTasks: Boolean = false, othersCanCompleteTasks: Boolean = false, builderBody: EntitiesBuilderBody)

Types

Link copied to clipboard
object Companion : KSerializer<Checklist.Input>

Properties

Link copied to clipboard
@SerialName(value = "others_can_add_tasks")
open override val othersCanAddTasks: Boolean
Link copied to clipboard
@SerialName(value = "others_can_mark_tasks_as_done")
open override val othersCanCompleteTasks: Boolean
Link copied to clipboard
@SerialName(value = "parse_mode")
val parseMode: ParseMode?
Link copied to clipboard
@SerialName(value = "tasks")
open override val tasks: List<ChecklistTask.Input>
Link copied to clipboard
open override val text: String
Link copied to clipboard
open override val textSources: List<TextSource>

Full list of TextSources

Link copied to clipboard
@SerialName(value = "title")
open override val title: String
Link copied to clipboard
@SerialName(value = "title_entities")
open override val titleTextSources: List<TextSource>

Functions

Link copied to clipboard
fun TextedWithTextSources.parseCommandsWithArgs(argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex): Map<String, Array<String>>

Parse commands and their args. Logic will find command, get all subsequent data as args until new command

Link copied to clipboard

Parse text sources to find commands with their arguments. This method will skip all the text sources before first command and all following text sources until the next command will be guessed as an args of last found command

Link copied to clipboard
fun TextedWithTextSources.parseCommandsWithNamedArgs(argsSeparator: String, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex): Map<String, List<Pair<String, String>>>
fun TextedWithTextSources.parseCommandsWithNamedArgs(argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex): Map<String, List<Pair<String, String>>>

Uses parseCommandsWithArgs to create base argsSeparator split args for commands and map their as k-v pairs. Sample: