mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 07:24:39 +03:00
b808fb646a
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
40 lines
1.1 KiB
TypeScript
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[];
|
|
}
|