add_handler: Add a handler

View source: R/dispatcher.R

add_handlerR Documentation

Add a handler

Description

Register a handler. A handler must be an instance of a subclass of Handler. All handlers are organized in groups with a numeric value. The default group is 1. All groups will be evaluated for handling an update, but only 0 or 1 handler per group will be used.

Usage

add_handler(handler, group = 1L)

Arguments

handler

A Handler instance.

group

The group identifier, must be higher or equal to 1. Default is 1.

Details

You can use the add (+) operator instead.

The priority/order of handlers is determined as follows:

  1. Priority of the group (lower group number = higher priority)

  2. The first handler in a group which should handle an update will be used. Other handlers from the group will not be used. The order in which handlers were added to the group defines the priority (the first handler added in a group has the highest priority).


telegram.bot documentation built on Sept. 7, 2022, 5:07 p.m.