Implement leave announcement for banned members and enhance moderation notifications
- Added a `leaveAnnounceBan` field to the `WelcomeConfig` model, allowing for optional announcements in the leave channel when a member is banned. - Updated the leave handling logic to check for bans and send a notice in the leave channel if the `leaveAnnounceBan` toggle is enabled. - Enhanced moderation actions (kick and ban) to notify the affected user via DM with the reason for the action. - Introduced a new `notifyModerationTargetDm` function to streamline DM notifications for moderation actions. - Updated the WebUI to include a toggle for the `leaveAnnounceBan` feature, improving user configurability. - Improved localization for new messages related to moderation notifications and leave announcements in both English and German. - Documented changes in phase tracking to reflect the new leave announcement feature and moderation notification enhancements.
This commit is contained in:
@@ -8,7 +8,7 @@ import { t, tf } from '@nexumi/shared';
|
||||
import type { SlashCommand } from '../../types.js';
|
||||
import { requirePermission } from '../../permissions.js';
|
||||
import { assertModerableMember } from '../../hierarchy.js';
|
||||
import { applyWarnEscalation, createCase, createWarning } from './service.js';
|
||||
import { applyWarnEscalation, createCase, createWarning, notifyModerationTargetDm } from './service.js';
|
||||
import { parseDuration, parseTimeoutDuration, tryParseDuration } from './duration.js';
|
||||
import { getGuildLocale } from '../../i18n.js';
|
||||
import { promptDestructiveConfirmation } from './confirmations.js';
|
||||
@@ -133,6 +133,13 @@ const kickCommand: SlashCommand = {
|
||||
const reason = reasonFrom(interaction, locale);
|
||||
const hierarchy = await assertModerableMember(interaction, user.id, locale, 'kick');
|
||||
if (!hierarchy.ok || !hierarchy.member) return;
|
||||
await notifyModerationTargetDm({
|
||||
user,
|
||||
guildName: interaction.guild!.name,
|
||||
reason,
|
||||
locale,
|
||||
action: 'kick'
|
||||
});
|
||||
await hierarchy.member.kick(reason);
|
||||
const modCase = await createCase(context, {
|
||||
guildId: interaction.guildId!,
|
||||
|
||||
Reference in New Issue
Block a user