Joining the trigger channel must feel instant and never leave orphan channels behind, so the ownership is stored in SQLite, empty channels are deleted after a short grace period and a startup sweep cleans up whatever a restart left behind.
27 lines
825 B
JavaScript
27 lines
825 B
JavaScript
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
|
|
* - GuildVoiceStates: temporary voice channels (M14)
|
|
* MessageContent is intentionally not requested.
|
|
*/
|
|
export function createClient() {
|
|
const client = new Client({
|
|
intents: [
|
|
GatewayIntentBits.Guilds,
|
|
GatewayIntentBits.GuildMembers,
|
|
GatewayIntentBits.GuildModeration,
|
|
GatewayIntentBits.GuildMessages,
|
|
GatewayIntentBits.GuildVoiceStates,
|
|
],
|
|
partials: [Partials.GuildMember],
|
|
});
|
|
|
|
client.commands = new Collection();
|
|
return client;
|
|
}
|