-
Notifications
You must be signed in to change notification settings - Fork 49
/
app.module.ts
38 lines (36 loc) · 1.18 KB
/
app.module.ts
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
import { DiscordModule } from '@discord-nestjs/core';
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { GatewayIntentBits } from 'discord.js';
import { Subject } from 'rxjs';
import { BotModule } from './bot/bot.module';
import { REGISTER_COMMAND_SUBJECT } from './register/register.constant';
import { RegisterModule } from './register/register.module';
@Module({
imports: [
ConfigModule.forRoot(),
RegisterModule,
DiscordModule.forRootAsync({
imports: [ConfigModule, RegisterModule],
useFactory: (
configService: ConfigService,
registerCommandSubject: Subject<any>,
) => ({
token: configService.get('TOKEN'),
discordClientOptions: {
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
},
registerCommandOptions: [
{
forGuild: configService.get('GUILD_ID_WITH_COMMANDS'),
trigger: () => registerCommandSubject,
removeCommandsBefore: true,
},
],
}),
inject: [ConfigService, REGISTER_COMMAND_SUBJECT],
}),
BotModule,
],
})
export class AppModule {}