Repository navigation
feat(moderation): merge the Timeout hard action into Mute - #396
Conversation
A Mute is now a Discord timeout when its duration fits one (up to 28 days) and the guild has moderation.mute-timeout, on by default, or no muted role; otherwise it takes the muted role. The automod rules, their escalation steps and the thresholds of warnings no longer offer Timeout. A migration adds GuildModeration.mute_timeout and makes the saved Timeouts Mutes; Timeout is still read as a Mute everywhere.
|
Architecture Inside the changed components — 1 viewComponent view — Moderation dispatch How infraction listeners and commands route mutes through applyMute
Data flow Data model Review ✨ Nothing flagged · reviewed Tip Run 🪧 More tips
Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it. |
There was a problem hiding this comment.
ℹ️ No critical issues — one rollout question and two small gaps.
Reviewed changes
Reviewed the full diff of the single commit that merges Timeout into Mute for automod rules, escalation steps and warn thresholds.
applyMute/isMuteTimeout— a mute becomes a Discord timeout when its duration is 5s to 28d andmoderation.mute-timeoutis on or there is no muted role; used byModerationMessageListener.onMuteandapplyWarnThreshold.moderation.mute-timeoutsetting — newGuildModeration.mute_timeoutcolumn (defaulttrue), wired through configuration, columns, defaults and locales.- Read-side normalization — stored, API-sent, file-imported, menu-typed and legacy
Timeoutvalues are read asMute. - Removed
Timeoutspecial cases — the "needs a duration" validation, the stale-timeout import check,onTimeoutand related locale strings are gone, and tests are updated to match. - Migration
20261112T1628_merge_timeout_into_mute— adds the column idempotently and rewritesTimeoutin rule hard actions, escalation JSON steps and warn thresholds.
I found no remaining Timeout hard-action handling elsewhere in projects/. The migration SQL (ordinality-preserving jsonb_agg, guarded by @>) looks correct.
ℹ️ Default-on setting changes how existing role-based Mute rules act
The migration adds mute_timeout as DEFAULT true for every server, with the stated goal that "their timeouts stay timeouts". Servers that already had a Mute rule, escalation step or warn threshold with a duration of 5s to 28d and a muted role configured were using the muted role. They will now get a Discord timeout instead, with no change on their side. The behavior differs: the muted role is applied and restored by the bot, while a timeout is enforced by Discord and cannot be applied to members the bot cannot moderate. The PR description covers the Timeout-with-no-duration case but not this one.
Technical details
# Existing role-based Mute becomes a timeout after migration
## Affected sites
- projects/database/migrations/app/20261112T1628_merge_timeout_into_mute/migration.ts:26 — `DEFAULT true` applies to every existing guild, including ones that only ever used the muted role
- projects/bot/src/lib/moderation/actions/mute.ts:47 — `isMuteTimeout` picks the timeout whenever the setting is on and the duration fits
## Required outcome
- A decision, and a note in the PR's Breaking Changes section, on whether guilds with a muted role and existing `Mute` rules should keep role-based mutes after the migration
## Suggested approach (optional)
- Keep `DEFAULT true` for the column, but have the migration set `mute_timeout = false` for guilds that have a muted role and at least one `Mute` rule, escalation step or threshold with a fitting duration, so only guilds that had `Timeout` data or no role start on timeouts
- Or document that the flip is intentionalℹ️ No tests for the read-side Timeout → Mute normalization in storage
toRule in projects/database/src/settings/automod/storage.ts and fetchWarnThresholds in projects/database/src/settings/warnings/storage.ts now call normalizeAutoModerationHardAction, which is what keeps every pre-migration or rolled-back row working. The new tests cover the escalation normalizer, the request parser, the menu parser and the legacy converter, but nothing exercises these two storage paths or normalizeAutoModerationHardAction itself. A small test that a rule row with hardAction: 'Timeout' and a threshold row with action: 'Timeout' come back as Mute would cover the rollback scenario the PR description calls out.
ℹ️ moderationDefaultWarnThresholds description is now stale
projects/bot/src/locales/en-US/settings.json (and the matching entry in i18next.d.ts) still says the default third-warning mute is "a timeout when there is no muted role". That is no longer the rule: getDefaultWarnThresholds() always returns a Mute, which is a timeout when moderation.mute-timeout is on or there is no muted role. The sentence should point at the new setting.
claude-sonnet-5-5 | 𝕏
wolfstar-project/wolfstar#396 is merged into V7 (bbb9fce5), so the submodule leaves its pull request head for the branch.

Stacked on #208.
🔗 Linked issue
None.
❓ Type of change
📚 Description
The automod rules, their escalation steps and the warning thresholds offered both Timeout and Mute, which do the same job for a moderator. They are now one action, Mute.
A Mute is a Discord timeout when its duration fits one (5 seconds to 28 days) and the server has the new
moderation.mute-timeoutsetting on, or has no muted role. Otherwise it takes the muted role, as a permanent mute always does. The setting is on by default.applyMuteinprojects/bot/src/lib/moderation/actions/mute.tsmakes that choice for the automod and the warning thresholds, and the case is a Timeout or a Mute after what was done. A Mute no longer needs a duration.Timeout is gone from
/automod edit,/warn-thresholds addand the escalation menu, wheretimeout 1hstill reads asMute 1h. ATimeoutthat is already saved, or that the API or a configuration file still sends, is read as a Mute. The dashboard keeps working until it drops the action./timeout,/muteand the Timeout case type do not change.A rule or threshold that was a Timeout with no duration did nothing. After the migration it is a permanent mute with the muted role.
moderation.mute-timeoutis on for every server after the migration, including servers that only used the muted role. On those servers, a Mute of 5 seconds to 28 days becomes a Discord timeout instead of the role. This is intended. A server that wants the role back turns the setting off.📝 Migration
Run the migration
20261112T1628_merge_timeout_into_mutebefore this bot starts. It addsGuildModeration.mute_timeout(on for every server) and rewrites the savedTimeouthard actions, escalation steps and warning thresholds toMute.Timeoutstays in theGuildAutoModerationHardActionenum, which cannot drop a value. The rewrite is not undone by a rollback.

Confidence Score: 5/5
The PR appears safe to merge with the documented migration and intended behavior changes.Reviews (5) · Last reviewed commit: "feat(moderation): merge the Timeout hard..." · Reviewed by Greptile