nestjs-telegraf/lib/interfaces/telegraf-options.interface.ts
2021-01-05 13:36:12 +03:00

35 lines
944 B
TypeScript

import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
import { Middleware, Context } from 'telegraf';
import {
TelegrafOptions,
LaunchPollingOptions,
LaunchWebhookOptions,
} from 'telegraf/typings/telegraf';
export interface TelegrafModuleOptions<C extends Context = Context> {
token: string;
botName?: string;
options?: TelegrafOptions;
launchOptions?: {
polling?: LaunchPollingOptions;
webhook?: LaunchWebhookOptions;
};
include?: Function[];
middlewares?: ReadonlyArray<Middleware<C>>;
}
export interface TelegrafOptionsFactory {
createTelegrafOptions(): TelegrafModuleOptions;
}
export interface TelegrafModuleAsyncOptions
extends Pick<ModuleMetadata, 'imports'> {
botName?: string;
useExisting?: Type<TelegrafOptionsFactory>;
useClass?: Type<TelegrafOptionsFactory>;
useFactory?: (
...args: any[]
) => Promise<TelegrafModuleOptions> | TelegrafModuleOptions;
inject?: any[];
}