BaseFilter: The base of all filters

Description Usage Arguments Details Examples

View source: R/basefilter.R

Description

Base class for all Message Filters.

Usage

1
2
3
4
5

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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)

ebeneditos/telegram.bot documentation built on Dec. 2, 2018, 1:18 p.m.