nestjs-telegraf/lib/interfaces/telegraf-options.interface.ts
Alexander Bukhalo b808fb646a Merge branch 'feature/v2' of github.com:bukhalo/nestjs-telegraf into feature/multiple-instances
 Conflicts:
	lib/decorators/inject-bot.decorator.ts
	lib/index.ts
	lib/interfaces/context.interface.ts
	lib/interfaces/index.ts
	lib/interfaces/telegraf-options.interface.ts
	lib/services/metadata-accessor.service.ts
	lib/services/updates-explorer.service.ts
	lib/telegraf-core.module.ts
	lib/telegraf.constants.ts
	package-lock.json
2021-01-02 16:46:01 +03:00

40 lines
1.1 KiB
TypeScript

import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
import { Middleware, Context } from 'telegraf';
import {
TelegrafOptions,
LaunchPollingOptions,
LaunchWebhookOptions,
TelegrafOptions,
} from 'telegraf/typings/telegraf';
import { Middleware } from 'telegraf/typings/composer';
import { Context } from './context.interface';
export interface TelegrafModuleOptions<C extends Context = Context> {
token: string;
options?: TelegrafOptions;
launchOptions?: {
polling?: LaunchPollingOptions;
webhook?: LaunchWebhookOptions;
};
botName?: string;
include?: Function[];
middlewares?: ReadonlyArray<Middleware<Context>>;
disableGlobalCatch?: boolean;
middlewares?: 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[];
}