TgUpdateHandler

An update processing class.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The channel where errors caught during update processing is stored with update that caused them.

Link copied to clipboard

Update flow being processed by the handler.

Link copied to clipboard

Previous invoked function qualified path (i.e., full class path).

Functions

Link copied to clipboard
suspend fun handle(update: ProcessedUpdate)

Handle the update.

suspend fun handle(update: ProcessedUpdate, block: FunctionalHandlingBlock)

Functional handling dsl

Link copied to clipboard
suspend fun parse(update: String): Deferred<ProcessedUpdate?>

A method to parse update from string.

Link copied to clipboard
suspend fun parseAndHandle(update: String): Job?

A method for handling updates from a string. Define processing behavior before calling, see setBehaviour.

Link copied to clipboard
suspend fun TgUpdateHandler.runExceptionHandler(dispatcher: CoroutineDispatcher = PROCESSING_DISPATCHER, delay: Long = 100, block: ExceptionHandler): Job

Runs exception handler loop.

Link copied to clipboard

A function for defining the behavior to handle updates.

Link copied to clipboard
suspend fun setListener(allowedUpdates: List<UpdateType>? = null, block: HandlingBehaviourBlock)

Function to define the actions that will be applied to updates when they are being processed. When set, it starts an update processing cycle.

Link copied to clipboard
suspend fun stopListener()

Stops listening of new updates.