Closed ArtemOsuskyi closed 10 months ago
Hi! Try to add DiscordModule.forFeature()
to module imports
import { DiscordModule } from '@discord-nestjs/core';
import { Module } from '@nestjs/common';
import { QuestCommand } from './commands/quest/quest.command';
import { QuestCreateSubCommand } from './commands/quest/quest-create.sub-command';
import { QuestClaimSubCommand } from './commands/quest/quest-claim.sub-command';
@Module({
imports: [DiscordModule.forFeature()],
providers: [QuestCommand, QuestCreateSubCommand, QuestClaimSubCommand],
})
export class BotModule {}
Here's the code for the module I use commands with, it doesn't start up even with imported DiscordModule.forFeature()
To avoid any further confusion, here's the app.module.ts
:
import { Module } from '@nestjs/common';
import { DiscordModule } from '@discord-nestjs/core';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { GatewayIntentBits } from 'discord.js';
import { BotModule } from './bot/bot.module';
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
}),
DiscordModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => {
return {
token: configService.get<string>('DISCORD_BOT_TOKEN'),
discordClientOptions: {
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
],
},
};
},
}),
BotModule,
],
})
export class AppModule {}
Check that you only have 1 version of the library installed in the repository
Reinstalled @discord-nestjs/core
and @discord-nestjs/common
and issue got fixed. Thank you, sorry for the inconvenience!
Describe the bug Starting an app causes Nest to throw an error
Nest can't resolve dependencies of the SlashCommandPipe (?, __class_transformer_options__). Please make sure that the argument ReflectMetadataProvider at index [0] is available in the BotModule context.
during startup. Using NestJS version from@discord-nestjs/schematics:application
template (v10.0.0)Tried to do so far
To Reproduce Steps to reproduce the behavior:
@InteractionEvent(SlashCommandPipe)
in any command params.npm run start:dev