nestjs-telegraf/lib/telegraf.module.ts

28 lines
710 B
TypeScript
Raw Normal View History

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