Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

refactor: localize audit-log reasons and the remaining user-facing strings - #124

Merged
rnxm merged 1 commit into
devfrom
refactor/hardcoded-strings
Nov 12, 2026
Merged

rnxm merged 1 commit into
devfrom
refactor/hardcoded-strings

Conversation

@rnxm

@rnxm rnxm commented Nov 12, 2026

Copy link
Copy Markdown
Member

Moved to localization/en.l10n.json

Where Keys
Moderation audit-log reasons (kick, ban, unban, unban when a case closes, unmute without a case) mod.kick.reason, mod.ban.reason, mod.unban.reason, mod.unban.case_reason, mod.unmute.reason
Level role reward reasons level_reward.reason, level_reward.replace_reason
Level leaderboard "User {id}" fallback level_unknown_user
Ticket category name and the open/close/category reasons ticket.strings.*
Snapshot restore failure DM to the owner snapshot.restore_failed
AutoMod case reason the existing, unused automod.reasons.<feature> keys, replacing f"[AutoMod] {feature.title()} rule violation"

Case reasons go through the new Case._audit_reason(key), which renders the key with moderator and case.

Fix

  • Audit log showed a raw placeholder: mod.mute.reason is "Muted by {moderator.name}", but it was rendered with only mute=…, so the audit log showed the literal {moderator.name}.

Left as they are

  • Error handler messages in core/bot.py, as you asked.
  • Config CLI (cogs/config.py, config_subcommands/), because it's temporary.
  • Owner-only admin.py output: developer commands, not user-facing.
  • Ticket button default labels: persistent views need them at registration. The labels users actually see already come from ticket.buttons.* when the message is sent.

Tests

  • tests/test_audit_reasons.py checks that the moderation reasons name the moderator.
  • ruff format --check, ruff check, ty check and pytest all pass (371 passed).

🤖 Generated with Claude Code

…rings

Moved to localization/en.l10n.json:
- moderation audit-log reasons: mod.kick.reason, mod.ban.reason,
  mod.unban.reason, mod.unban.case_reason, mod.unmute.reason
  (Case._audit_reason renders them with the moderator);
- level reward reasons (level_reward.*) and the leaderboard's unknown-user
  fallback (level_unknown_user);
- ticket category name and channel/category reasons (ticket.strings.*);
- the snapshot restore failure DM (snapshot.restore_failed);
- AutoMod case reasons now use the existing automod.reasons.* keys instead
  of f"[AutoMod] {feature.title()} rule violation".

Fix: mod.mute.reason ("Muted by {moderator.name}") was rendered with only
mute=..., so the audit log showed the literal placeholder.

Kept as they are: the error handler's messages (by request), the config
CLI (temporary) and the owner-only admin commands' output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rnxm
rnxm merged commit f7ecdfa into dev Nov 12, 2026
6 checks passed
@rnxm
rnxm deleted the refactor/hardcoded-strings branch November 12, 2026 11:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant