feat(): multiple instances support

This commit is contained in:
Alexander Bukhalo
2021-01-02 01:27:01 +03:00
parent b1a6e50f8f
commit ccb2db0106
14 changed files with 263 additions and 122 deletions

View File

@@ -1,2 +1,3 @@
export * from './context.interface';
export * from './telegraf-options.interface';
export * from './update-metadata.interface';

View File

@@ -4,6 +4,7 @@ import {
LaunchPollingOptions,
LaunchWebhookOptions,
} from 'telegraf/typings/telegraf';
import { Middleware } from 'telegraf/typings/composer';
export interface TelegrafModuleOptions {
token: string;
@@ -12,6 +13,9 @@ export interface TelegrafModuleOptions {
polling?: LaunchPollingOptions;
webhook?: LaunchWebhookOptions;
};
botName?: string;
include?: Function[];
middlewares?: ReadonlyArray<Middleware<any>>;
}
export interface TelegrafOptionsFactory {
@@ -20,6 +24,7 @@ export interface TelegrafOptionsFactory {
export interface TelegrafModuleAsyncOptions
extends Pick<ModuleMetadata, 'imports'> {
botName?: string;
useExisting?: Type<TelegrafOptionsFactory>;
useClass?: Type<TelegrafOptionsFactory>;
useFactory?: (

View File

@@ -0,0 +1,6 @@
export interface UpdateMetadata {
name: string;
type: string;
methodName: string;
callback?: Function | Record<string, any>;
}