From 12232257068033f15f0871faa3afb6fb9158d209 Mon Sep 17 00:00:00 2001 From: AlexInCube Date: Sat, 3 Aug 2024 19:23:16 +0300 Subject: [PATCH] 3.4.0-dev-20 Client intents now is separated from the main.ts file --- src/ClientIntents.ts | 13 +++++++++++++ src/audioplayer/tests/AudioServices.test.ts | 3 ++- src/main.ts | 16 ++++------------ 3 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 src/ClientIntents.ts diff --git a/src/ClientIntents.ts b/src/ClientIntents.ts new file mode 100644 index 0000000..2507409 --- /dev/null +++ b/src/ClientIntents.ts @@ -0,0 +1,13 @@ +import { GatewayIntentBits } from 'discord.js'; + +export const clientIntents: Array = [ + GatewayIntentBits.Guilds, + GatewayIntentBits.GuildPresences, + GatewayIntentBits.GuildMembers, + GatewayIntentBits.GuildVoiceStates, + GatewayIntentBits.GuildMessages, + GatewayIntentBits.MessageContent, + GatewayIntentBits.DirectMessages, + GatewayIntentBits.DirectMessageTyping, + GatewayIntentBits.GuildModeration +]; diff --git a/src/audioplayer/tests/AudioServices.test.ts b/src/audioplayer/tests/AudioServices.test.ts index 7bb3e73..13b4050 100644 --- a/src/audioplayer/tests/AudioServices.test.ts +++ b/src/audioplayer/tests/AudioServices.test.ts @@ -6,9 +6,10 @@ import { LoadPlugins } from '../LoadPlugins.js'; import '../../EnvironmentVariables.js'; import { loggerWarn } from '../../utilities/logger.js'; import * as process from 'node:process'; +import { clientIntents } from '../../ClientIntents.js'; let distube: DisTube; -const djsClient: Client = new Client({ intents: [] }); +const djsClient: Client = new Client({ intents: clientIntents }); before(async () => { loggerWarn('If you want to run all this tests successfully, provide all optional .env variables'); diff --git a/src/main.ts b/src/main.ts index 57e6d70..0632094 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,8 @@ +import { clientIntents } from './ClientIntents.js'; + loggerSend(`Starting bot on version ${process.env.npm_package_version}`); -import { Client, GatewayIntentBits, Partials } from 'discord.js'; +import { Client, Partials } from 'discord.js'; import { loggerError, loggerSend } from './utilities/logger.js'; import { loginBot } from './utilities/loginBot.js'; import { AudioPlayerCore } from './audioplayer/AudioPlayerCore.js'; @@ -11,17 +13,7 @@ await loadLocale(); import { handlersLoad } from './handlers/handlersLoad.js'; const client = new Client({ - intents: [ - GatewayIntentBits.Guilds, - GatewayIntentBits.GuildPresences, - GatewayIntentBits.GuildMembers, - GatewayIntentBits.GuildVoiceStates, - GatewayIntentBits.GuildMessages, - GatewayIntentBits.MessageContent, - GatewayIntentBits.DirectMessages, - GatewayIntentBits.DirectMessageTyping, - GatewayIntentBits.GuildModeration - ], + intents: clientIntents, partials: [Partials.Message, Partials.Channel, Partials.Reaction] });