Skip to content

Commit

Permalink
fix(#133): Moved client config into a function to avoid mutability
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Artemus authored Dec 17, 2023
1 parent 64dca02 commit 2899219
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { GatewayIntentBits, Partials } from "discord.js"

import { generalConfig, logsConfig } from "@configs"
import { ExtractLocale, Maintenance, NotBot, RequestContextIsolator } from "@guards"
import { ClientOptions } from "discordx"

export const clientConfig = {
export const clientConfig = () => ({

// to only use global commands (use @Guild for specific guild command), comment this line
botGuilds: process.env.NODE_ENV === 'development' ? [process.env.TEST_GUILD_ID] : undefined,
Expand All @@ -21,7 +22,9 @@ export const clientConfig = {
],

partials: [
Partials.Channel
Partials.Channel,
Partials.Message,
Partials.Reaction
],

// debug logs are disabled in silent mode
Expand All @@ -39,4 +42,4 @@ export const clientConfig = {
prefix: generalConfig.simpleCommandsPrefix,
}

}
});
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function run() {

// init the client
DIService.engine = tsyringeDependencyRegistryEngine.setInjector(container)
const client = new Client(clientConfig)
const client = new Client(clientConfig())

// Load all new events
discordLogs(client, { debug: false })
Expand Down

0 comments on commit 2899219

Please sign in to comment.