nestjs-telegraf
nestjs-telegraf copied to clipboard
Not working properly in Nestjs 10.0.0 version
Not working properly in Nestjs 10.0.0 version
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"https-proxy-agent": "^7.0.1",
"nestjs-telegraf": "^2.7.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"socks-proxy-agent": "^8.0.1",
"telegraf": "^4.12.2"
}
@Module({
imports: [
TelegrafModule.forRoot({
token: token,
include: [BotModule],
}),
UserModule,
BotModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule{}
@Module({
providers: [BotUpdate, BotService],
})
export class BotModule {}
error message
Error: Nest can't resolve dependencies of the BotUpdate (?, BotService). Please make sure that the argument testBot at index [0] is available in the BotModule context.
Potential solutions:
- Is BotModule a valid NestJS module?
- If testBot is a provider, is it part of the current BotModule?
- If testBot is exported from a separate @Module, is that module imported within BotModule?
@Module({
imports: [ /* the Module containing testBot */ ]
})
Everything seems to be working properly on my end.
I think testBot
should be inside the providers
section of BotModule, such as to:
@Module({
providers: [BotUpdate, BotService, testBot],
})
export class BotModule {}
I cannot tell what testBot
is. Is it a service?
any update on this? I faced the same problem
Everything seems to be working properly on my end.
I think
testBot
should be inside theproviders
section of BotModule, such as to:@Module({ providers: [BotUpdate, BotService, testBot], }) export class BotModule {}
I cannot tell what
testBot
is. Is it a service?
in my case it is the bot name specified in the @InjectBot()
decorator
@erosiners Have you solved this problem? I also encountered the same problem.
@evilsprut When injecting the bot, I will be prompted to report an error. I think this is a mistake.
code:
constructor(
private readonly configService: ConfigService,
@InjectBot('health') private bot: Telegraf
) {}
Error:
Please make sure that the argument "healthBot" at index [5] is available in the HealthModule context.
Potential solutions:
- Is HealthModule a valid NestJS module?
- If "healthBot" is a provider, is it part of the current HealthModule?
- If "healthBot" is exported from a separate @Module, is that module imported within HealthModule?
@Module({
imports: [ /* the Module containing "healthBot" */ ]
})
And I don’t know where to solve this healthBot?