The dashboard offered seven switches that nothing read: they promised a behaviour the bot did not have, which is worse than offering nothing. Every setting is now declared once, with its type, its bounds and its explanation, and the services read it: the welcome message and its wording, the automatic role, departure notices, the private notice sent to a sanctioned member, the default mute duration, how much history a ban erases, whether a closed ticket is deleted or archived, and an optional role mention on the Gitea notifications. A test walks the sources and fails when a declared key is read nowhere, so the list cannot drift back into decoration. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
22 lines
737 B
JavaScript
22 lines
737 B
JavaScript
import { Events } from 'discord.js';
|
|
import { readSetting } from '../config/guild-settings.js';
|
|
import { createLogger } from '../core/logger.js';
|
|
import {
|
|
assignMemberRole,
|
|
sendWelcome,
|
|
sendWelcomeDirectMessage,
|
|
} from '../services/members/member-service.js';
|
|
|
|
const log = createLogger('members');
|
|
|
|
export const name = Events.GuildMemberAdd;
|
|
|
|
/** Welcome message, resources and default role (M7-T01..T04). */
|
|
export async function execute(client, member) {
|
|
log.info('Member joined', { userId: member.id, guildId: member.guild.id });
|
|
|
|
await assignMemberRole(member);
|
|
await sendWelcome(client, member);
|
|
if (readSetting('welcome.directMessage', member.guild.id)) await sendWelcomeDirectMessage(member);
|
|
}
|