BaseFilter: The base of all filters

View source: R/basefilter.R

BaseFilterR Documentation

The base of all filters

Description

Base class for all Message Filters.

Usage

BaseFilter(filter)

as.BaseFilter(x, ...)

is.BaseFilter(x)

Arguments

filter

If you want to create your own filters you can call this generator passing by a filter function that takes a message as input and returns a boolean: TRUE if the message should be handled, FALSE otherwise.

x

Object to be coerced or tested.

...

Further arguments passed to or from other methods.

Details

See filtersLogic to know more about combining filter functions.

Examples

## Not run: 
# Create a filter function
text_or_command <- function(message) !is.null(message$text)

# Make it an instance of BaseFilter with its generator:
text_or_command <- BaseFilter(filter = text_or_command)

# Or by coercing it with as.BaseFilter:
text_or_command <- as.BaseFilter(function(message) !is.null(message$text))

## End(Not run)

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