1.5 KiB
1.5 KiB
Moderation Module
- Case IDs are sequential strings formatted as
CASE-XXXX(zero-padded to 4 digits). Generated by querying the latest case and incrementing. Not a DB sequence -- concurrent inserts could theoretically collide, but in practice moderation actions are low-frequency. - Only
WARNtype cases are created withactive: true. All other case types (TIMEOUT, BAN, KICK, NOTE) default toactive: false. Theactiveflag is specifically for tracking unresolved warnings. issueWarninghas two side effects beyond creating the case:- DM notification: sends the user a warning embed via DM. Fails silently if the user has DMs disabled. Controlled by
config.dmOnWarn(defaults to true if unset). - Auto-timeout: if active warning count >=
autoTimeoutThreshold, the user is automatically timed out for 24 hours and a separateTIMEOUTcase is created withmoderatorId: "0"(system). The timeout target (Discord GuildMember) is passed in from the command layer.
- DM notification: sends the user a warning embed via DM. Fails silently if the user has DMs disabled. Controlled by
clearCasesetsactive: falseand records who cleared it and why. It works on any case type, not just warnings.- The service does not perform Discord actions (kick, ban, timeout) directly -- it only manages database records. The bot command layer is responsible for calling Discord APIs and then recording cases here. The one exception is auto-timeout in
issueWarning, where the Discord member object is passed in. searchCasessupports pagination vialimit/offset(default limit 50).