Skip to content

Commit

Permalink
3.4.0-dev-20
Browse files Browse the repository at this point in the history
Client intents now is separated from the main.ts file
  • Loading branch information
AlexInCube committed Aug 3, 2024
1 parent 61d0eb8 commit 1223225
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
13 changes: 13 additions & 0 deletions src/ClientIntents.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { GatewayIntentBits } from 'discord.js';

export const clientIntents: Array<GatewayIntentBits> = [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageTyping,
GatewayIntentBits.GuildModeration
];
3 changes: 2 additions & 1 deletion src/audioplayer/tests/AudioServices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
16 changes: 4 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -11,17 +13,7 @@ await loadLocale();
import { handlersLoad } from './handlers/handlersLoad.js';

const client = new Client<true>({
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]
});

Expand Down

0 comments on commit 1223225

Please sign in to comment.