2020-03-19 16:21:35 +03:00
|
|
|
import { Module, DynamicModule } from '@nestjs/common';
|
|
|
|
import { TelegrafCoreModule } from './telegraf-core.module';
|
2020-01-12 14:18:48 +03:00
|
|
|
import {
|
2020-03-19 16:21:35 +03:00
|
|
|
TelegrafModuleOptions,
|
2020-01-12 14:18:48 +03:00
|
|
|
TelegrafModuleAsyncOptions,
|
|
|
|
} from './interfaces';
|
2019-02-28 11:29:26 +03:00
|
|
|
|
|
|
|
@Module({})
|
2020-01-12 01:45:10 +03:00
|
|
|
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,
|
2020-03-19 16:21:35 +03:00
|
|
|
imports: [TelegrafCoreModule.forRoot(options)],
|
2020-05-03 11:06:25 +03:00
|
|
|
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,
|
|
|
|
imports: [TelegrafCoreModule.forRootAsync(options)],
|
2020-05-03 11:06:25 +03:00
|
|
|
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
|
|
|
}
|