nestjs-telegraf/lib/telegraf.module.ts

28 lines
710 B
TypeScript
Raw Normal View History

2021-01-02 21:40:13 +03:00
import { Module, DynamicModule } from '@nestjs/common';
import { TelegrafCoreModule } from './telegraf-core.module';
import {
TelegrafModuleOptions,
2021-01-02 21:40:13 +03:00
TelegrafModuleAsyncOptions,
} from './interfaces';
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],
};
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,
2021-01-02 21:40:13 +03:00
imports: [TelegrafCoreModule.forRootAsync(options)],
exports: [TelegrafCoreModule],
};
}
2019-02-28 11:29:26 +03:00
}