matchFilter
This is an advanced function of grammY.
Takes a filter query and turns it into a predicate function that can check in constant time whether a given context object satisfies the query. The created predicate can be passed to bot
and will narrow down the context accordingly.
This function is used internally by bot
but exposed for advanced usage like the following.
ts
// Listens for updates except forwards of messages or channel posts
bot.drop(matchFilter(':forward_origin'), ctx => { ... })
Check out the documentation of bot
for examples. In addition, the website contains more information about how filter queries work in grammY.
Type Parameters
C
ts
C extends Context
Q
ts
Q extends FilterQuery
Parameters
filter
A filter query or an array of filter queries