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

40 lines
1.1 KiB
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';
2020-04-24 18:52:54 +03:00
import {
TelegrafOptions,
LaunchPollingOptions,
LaunchWebhookOptions,
2021-01-02 15:47:17 +03:00
TelegrafOptions,
} from 'telegraf/typings/telegraf';
2021-01-02 01:27:01 +03:00
import { Middleware } from 'telegraf/typings/composer';
2021-01-02 02:00:10 +03:00
import { Context } from './context.interface';
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?: TelegrafOptions;
2020-04-24 18:52:54 +03:00
launchOptions?: {
polling?: LaunchPollingOptions;
webhook?: LaunchWebhookOptions;
};
2021-01-02 01:27:01 +03:00
botName?: string;
include?: Function[];
2021-01-02 02:00:10 +03:00
middlewares?: ReadonlyArray<Middleware<Context>>;
disableGlobalCatch?: boolean;
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'> {
2021-01-02 01:27:01 +03:00
botName?: string;
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
}