mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 07:24:39 +03:00
feat: implement injectbot decorator
This commit is contained in:
parent
beeffc5088
commit
6361e537aa
@ -1,3 +1,4 @@
|
||||
export * from './inject-bot.decorator';
|
||||
export * from './telegraf-use.decorator';
|
||||
export * from './telegraf-on.decorator';
|
||||
export * from './telegraf-hears.decorator';
|
||||
|
4
lib/decorators/inject-bot.decorator.ts
Normal file
4
lib/decorators/inject-bot.decorator.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { Inject } from '@nestjs/common';
|
||||
import { TELEGRAF_PROVIDER } from '../telegraf.constants';
|
||||
|
||||
export const InjectBot = (): ParameterDecorator => Inject(TELEGRAF_PROVIDER);
|
@ -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';
|
||||
|
@ -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({
|
||||
|
@ -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],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user