All files / src/modules/bot/core NDB.module.ts

0% Statements 0/4
100% Branches 0/0
0% Functions 0/2
0% Lines 0/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48                                                                                               
import { JSONLocaleLoader } from "@/modules/shared/config/JSONLocale.loader";
import { NecordConfigService } from "@/modules/shared/config/NecordConfig.service";
import { Config } from "@/modules/shared/config/types";
import { SharedModule } from "@/modules/shared/shared.module";
import { GuildResolver, NecordLocalizationModule, NestedLocalizationAdapter } from "@necord/localization";
import { NecordPaginationModule } from "@necord/pagination";
import { Module } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { NecordModule } from "necord";
import { CommandsModule } from "../commands/Commands.module";
import { ComponentsModule } from "../components/Components.module";
import { EventsModule } from "../events/Events.module";
import { ReactionRolesModule } from "../reactionRoles/ReactionRoles.module";
import { NDBServiceProvider } from "./provider/NDBService.provider";
 
@Module({
	imports: [
		NecordModule.forRootAsync({
			inject: [ConfigService],
			useFactory: async (config: ConfigService) => ({
				...new NecordConfigService(config).createNecordOptions(),
			}),
		}),
		NecordPaginationModule.forRoot({
			allowSkip: false,
			allowTraversal: false,
		}),
		NecordLocalizationModule.forRootAsync({
			inject: [ConfigService],
			useFactory: async (config: ConfigService) => ({
				adapter: new NestedLocalizationAdapter({
					fallbackLocale: config.getOrThrow<Config["FallbackLocale"]>("FallbackLocale"),
					locales: await new JSONLocaleLoader("./src/common/Languages/").loadTranslations(),
				}),
				resolvers: GuildResolver,
			}),
		}),
		CommandsModule,
		SharedModule,
		ComponentsModule,
		EventsModule,
		ReactionRolesModule,
	],
	providers: [NDBServiceProvider],
	exports: [NDBServiceProvider],
})
export class NDBModule {}