Skip to main content
Module

x/grammy/mod.ts>Composer#drop

The Telegram Bot Framework.
Very Popular
Go to Latest
method Composer.prototype.drop
import { Composer } from "https://deno.land/x/grammy@v1.10.1/mod.ts";

This is an advanced method of grammY.

Registers middleware behind a custom filter function that operates on the context object and decides whether or not to execute the middleware. In other words, the middleware will only be executed if the given predicate returns false for the given context object. Otherwise, it will be skipped and the next middleware will be executed. Note that the predicate may be asyncronous, i.e. it can return a Promise of a boolean.

This method is the same using filter (normal usage) with a negated predicate.

Parameters

predicate: (ctx: C) => MaybePromise<boolean>

The predicate to check

...middleware: Array<Middleware<C>>

The middleware to register