From baf8db059b4fedeab95e33b4f08f617e81ffdcfd Mon Sep 17 00:00:00 2001 From: nocode Date: Sun, 13 Sep 2026 12:19:09 +0200 Subject: [PATCH] feat(discord): create client with required gateway intents Refs: #21 --- src/core/client.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/core/client.js diff --git a/src/core/client.js b/src/core/client.js new file mode 100644 index 0000000..d140b96 --- /dev/null +++ b/src/core/client.js @@ -0,0 +1,24 @@ +import { Client, Collection, GatewayIntentBits, Partials } from 'discord.js'; + +/** + * Only the intents required by the bot (M2-T02): + * - Guilds: slash commands, channels, roles + * - GuildMembers (privileged): welcome, departures, role assignment + * - GuildModeration: ban/kick audit events + * - GuildMessages: /clear and ticket channels + * MessageContent is intentionally not requested. + */ +export function createClient() { + const client = new Client({ + intents: [ + GatewayIntentBits.Guilds, + GatewayIntentBits.GuildMembers, + GatewayIntentBits.GuildModeration, + GatewayIntentBits.GuildMessages, + ], + partials: [Partials.GuildMember], + }); + + client.commands = new Collection(); + return client; +}