@puregram/hear
Version:
simple implementation of hearing messages system for puregram
18 lines (17 loc) • 706 B
TypeScript
import 'reflect-metadata';
import type { MessageContext } from 'puregram';
import { Middleware } from 'middleware-io';
import { HearConditions, ContextMatch } from './types';
export declare class HearManager<C extends MessageContext> {
private composer;
private fallbackHandler;
private composed;
constructor();
get length(): number;
get middleware(): Middleware<C & ContextMatch>;
hear(hearConditions: HearConditions<C & ContextMatch>, handler: Middleware<C & ContextMatch>): this;
command(command: string, handler: Middleware<C>): this;
/** A handler that is called when handlers are not found */
onFallback(handler: Middleware<C>): this;
private recompose;
}