2021-01-02 21:40:13 +03:00
|
|
|
import { Module, DynamicModule } from '@nestjs/common';
|
|
|
|
import { TelegrafCoreModule } from './telegraf-core.module';
|
2020-12-29 22:41:06 +03:00
|
|
|
import {
|
|
|
|
TelegrafModuleOptions,
|
2021-01-02 21:40:13 +03:00
|
|
|
TelegrafModuleAsyncOptions,
|
2020-01-12 14:18:48 +03:00
|
|
|
} from './interfaces';
|
2020-12-29 22:41:06 +03:00
|
|
|
|
2021-01-02 21:40:13 +03:00
|
|
|
@Module({})
|
|
|
|
export class TelegrafModule {
|
2020-05-03 11:06:25 +03:00
|
|
|
public static forRoot(options: TelegrafModuleOptions): DynamicModule {
|
2019-02-28 11:29:26 +03:00
|
|
|
return {
|
2020-01-12 01:15:32 +03:00
|
|
|
module: TelegrafModule,
|
2021-01-02 21:40:13 +03:00
|
|
|
imports: [TelegrafCoreModule.forRoot(options)],
|
|
|
|
exports: [TelegrafCoreModule],
|
2020-01-12 14:18:48 +03:00
|
|
|
};
|
2019-02-28 11:29:26 +03:00
|
|
|
}
|
2020-01-12 01:36:53 +03:00
|
|
|
|
2020-03-19 16:21:35 +03:00
|
|
|
public static forRootAsync(
|
|
|
|
options: TelegrafModuleAsyncOptions,
|
|
|
|
): DynamicModule {
|
2020-01-12 01:36:53 +03:00
|
|
|
return {
|
2020-03-19 16:21:35 +03:00
|
|
|
module: TelegrafModule,
|
2021-01-02 21:40:13 +03:00
|
|
|
imports: [TelegrafCoreModule.forRootAsync(options)],
|
|
|
|
exports: [TelegrafCoreModule],
|
2020-01-12 14:18:48 +03:00
|
|
|
};
|
2020-01-12 01:36:53 +03:00
|
|
|
}
|
2019-02-28 11:29:26 +03:00
|
|
|
}
|