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-use.decorator';
|
||||||
export * from './telegraf-on.decorator';
|
export * from './telegraf-on.decorator';
|
||||||
export * from './telegraf-hears.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 Stage from 'telegraf/stage';
|
||||||
export * as WizardScene from 'telegraf/scenes/wizard';
|
export * as WizardScene from 'telegraf/scenes/wizard';
|
||||||
|
|
||||||
export * from './telegraf.module';
|
|
||||||
export * from './interfaces';
|
|
||||||
export * from './decorators';
|
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 { Module, DynamicModule, Provider, Type } from '@nestjs/common';
|
||||||
import {
|
import {
|
||||||
TelegrafModuleOptions,
|
TelegrafModuleOptions,
|
||||||
@ -10,7 +11,6 @@ import {
|
|||||||
} from './telegraf.constants';
|
} from './telegraf.constants';
|
||||||
import { TelegrafMetadataAccessor } from './telegraf-metadata.accessor';
|
import { TelegrafMetadataAccessor } from './telegraf-metadata.accessor';
|
||||||
import { TelegrafExplorer } from './telegraf.explorer';
|
import { TelegrafExplorer } from './telegraf.explorer';
|
||||||
import { DiscoveryModule } from '@nestjs/core';
|
|
||||||
import { TelegrafProvider } from './telegraf.provider';
|
import { TelegrafProvider } from './telegraf.provider';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
|
@ -7,10 +7,11 @@ import {
|
|||||||
|
|
||||||
@Module({})
|
@Module({})
|
||||||
export class TelegrafModule {
|
export class TelegrafModule {
|
||||||
public static forRoot(options?: TelegrafModuleOptions): DynamicModule {
|
public static forRoot(options: TelegrafModuleOptions): DynamicModule {
|
||||||
return {
|
return {
|
||||||
module: TelegrafModule,
|
module: TelegrafModule,
|
||||||
imports: [TelegrafCoreModule.forRoot(options)],
|
imports: [TelegrafCoreModule.forRoot(options)],
|
||||||
|
exports: [TelegrafCoreModule],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ export class TelegrafModule {
|
|||||||
return {
|
return {
|
||||||
module: TelegrafModule,
|
module: TelegrafModule,
|
||||||
imports: [TelegrafCoreModule.forRootAsync(options)],
|
imports: [TelegrafCoreModule.forRootAsync(options)],
|
||||||
|
exports: [TelegrafCoreModule],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user