nestjs-telegraf/src/telegraf.module.ts

28 lines
704 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({})
2022-11-20 14:13:48 +03:00
export class GrammyModule {
2020-05-03 11:06:25 +03:00
public static forRoot(options: TelegrafModuleOptions): DynamicModule {
2019-02-28 11:29:26 +03:00
return {
2022-11-20 14:13:48 +03:00
module: GrammyModule,
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 {
2022-11-20 14:13:48 +03:00
module: GrammyModule,
2020-03-19 16:21:35 +03:00
imports: [TelegrafCoreModule.forRootAsync(options)],
2020-05-03 11:06:25 +03:00
exports: [TelegrafCoreModule],
};
}
2019-02-28 11:29:26 +03:00
}