mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 23:44:39 +03:00
35 lines
944 B
TypeScript
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[];
|
|
}
|