diff --git a/lib/decorators/index.ts b/lib/decorators/index.ts index 340866c..37dcea4 100644 --- a/lib/decorators/index.ts +++ b/lib/decorators/index.ts @@ -1,3 +1,4 @@ +export * from './inject-bot.decorator'; export * from './telegraf-use.decorator'; export * from './telegraf-on.decorator'; export * from './telegraf-hears.decorator'; diff --git a/lib/decorators/inject-bot.decorator.ts b/lib/decorators/inject-bot.decorator.ts new file mode 100644 index 0000000..84f1c50 --- /dev/null +++ b/lib/decorators/inject-bot.decorator.ts @@ -0,0 +1,4 @@ +import { Inject } from '@nestjs/common'; +import { TELEGRAF_PROVIDER } from '../telegraf.constants'; + +export const InjectBot = (): ParameterDecorator => Inject(TELEGRAF_PROVIDER); diff --git a/lib/index.ts b/lib/index.ts index deb7819..deb2848 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -5,6 +5,7 @@ export * as session from 'telegraf/session'; export * as Stage from 'telegraf/stage'; export * as WizardScene from 'telegraf/scenes/wizard'; -export * from './telegraf.module'; -export * from './interfaces'; export * from './decorators'; +export * from './interfaces'; +export * from './telegraf.module'; +export * from './telegraf.provider'; diff --git a/lib/telegraf-core.module.ts b/lib/telegraf-core.module.ts index 49b2ee4..9be69ed 100644 --- a/lib/telegraf-core.module.ts +++ b/lib/telegraf-core.module.ts @@ -1,3 +1,4 @@ +import { DiscoveryModule } from '@nestjs/core'; import { Module, DynamicModule, Provider, Type } from '@nestjs/common'; import { TelegrafModuleOptions, @@ -10,7 +11,6 @@ import { } from './telegraf.constants'; import { TelegrafMetadataAccessor } from './telegraf-metadata.accessor'; import { TelegrafExplorer } from './telegraf.explorer'; -import { DiscoveryModule } from '@nestjs/core'; import { TelegrafProvider } from './telegraf.provider'; @Module({ diff --git a/lib/telegraf.module.ts b/lib/telegraf.module.ts index a0c34de..fb3cdeb 100644 --- a/lib/telegraf.module.ts +++ b/lib/telegraf.module.ts @@ -7,10 +7,11 @@ import { @Module({}) export class TelegrafModule { - public static forRoot(options?: TelegrafModuleOptions): DynamicModule { + public static forRoot(options: TelegrafModuleOptions): DynamicModule { return { module: TelegrafModule, imports: [TelegrafCoreModule.forRoot(options)], + exports: [TelegrafCoreModule], }; } @@ -20,6 +21,7 @@ export class TelegrafModule { return { module: TelegrafModule, imports: [TelegrafCoreModule.forRootAsync(options)], + exports: [TelegrafCoreModule], }; } }