nestjs-telegraf/lib/interfaces/telegraf-options.interface.ts

25 lines
771 B
TypeScript
Raw Normal View History

2020-03-19 16:21:35 +03:00
import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
import { Middleware, Context } from 'telegraf';
import { TelegrafLaunchOption, TelegrafOption } from '../telegraf.types';
2020-01-12 01:15:32 +03:00
export interface TelegrafModuleOptions<C extends Context = Context> {
2020-03-19 16:21:35 +03:00
token: string;
options?: TelegrafOption;
launchOptions?: TelegrafLaunchOption;
middlewares?: Middleware<C>[];
2020-01-12 01:15:32 +03:00
}
export interface TelegrafOptionsFactory {
2020-03-19 16:21:35 +03:00
createTelegrafOptions(): TelegrafModuleOptions;
2020-01-12 01:15:32 +03:00
}
export interface TelegrafModuleAsyncOptions
extends Pick<ModuleMetadata, 'imports'> {
2020-03-19 16:21:35 +03:00
useExisting?: Type<TelegrafOptionsFactory>;
useClass?: Type<TelegrafOptionsFactory>;
useFactory?: (
...args: any[]
2020-03-19 16:21:35 +03:00
) => Promise<TelegrafModuleOptions> | TelegrafModuleOptions;
inject?: any[];
2020-01-12 01:15:32 +03:00
}