This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Repository navigation
Conversation
rnxm
commented
Nov 13, 2026
Member
- fix issue with unban command
- restructure moderation module
- fix issues and readability regarding localization modules
- create object to store guild settings present in the database
- fix small issues regarding the economy module
- add test for localization keys (english only)
- add tests for modules that previously didn't have any
- defer commands that might be heavy to fit in 3sec response time frame
- updates regarding production administration (proxy, better clustering)
Ban.from_db filtered only by user and guild, so unban loaded every case the user had (warns, mutes, kicks), coerced them into Ban objects, and deactivated or deleted all of them. Filter by type=BAN and active=true. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cogs/mod.py becomes the cogs/mod/ package. CaseStore is now the only code
that touches the cases table: it builds the right Case subclass from a row,
applies the guild's retention policy on close, and keeps the expiry
schedule in step. Commands and AutoMod open, close, edit and look up cases
through it instead of Case classmethods and get_cog("Moderation").manager.
Behaviour changes:
- unmute finds active mute cases directly instead of matching the exact
timeout timestamp; it handles manual timeouts (no case) and cases whose
timeout was already lifted, with new localization keys.
- Closing an already inactive case no longer repeats its side effects
(unban, timeout removal, DMs).
- case info shows inactive cases instead of reporting them as not found.
- Uncached users on stored cases are fetched instead of becoming None.
- AutoMod still sends its violation notice when it can't open a case.
Also:
- load_cogs loads cogs/<pkg>/__init__.py when it defines setup().
- Database tests run against a throwaway PostgreSQL 16 (testcontainers,
marked db); CI requires them via REQUIRE_DB_TESTS.
- Add GLOSSARY.md (case terms and settled decisions) and point AGENTS.md
and docs/agents/domain.md at it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add core/locale.py with resolve_locale(): guild override, then the user's client locale for interactions, then the guild's preferred locale, then "en", normalised to the two-letter codes the l10n files are named after. custom_response, the help command and Command.from_command/from_ctx used four different rule sets (only help honoured the user's client locale; custom_response passed "en-US" style codes). They now all call the resolver. Command.from_ctx delegates to from_command instead of duplicating it. The level card label no longer hardcodes "szint"/"lvl": the existing Hungarian string moves to hu.l10n.json under level_card.label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o it core/settings.py adds GuildSetting/GuildSettings: a per-guild cache that loads lazily (or is preloaded at startup), and whose set() persists the value, updates this instance and announces INVALIDATE_SETTING on the existing event bus so other instances reload it. Writers no longer touch caches or the event bus. Moved onto it: - prefix and locale override (preloaded; Bot.prefix_cache/locale_cache are now read-only views), replacing cache_prefixes/cache_locales and the hand-coded INVALIDATE_PREFIX/INVALIDATE_LOCALE handlers; - mod case retention, replacing RetentionCache, set_guild_retention and INVALIDATE_MOD_CONFIG. Loading a guild with no row now creates it, so defaults come from the column defaults rather than Python literals. Fixes: - In debug mode the on_message prefix gate checked the guild prefix while fetch_prefix only accepts "?"; it now checks "?". - ?!config prefix --mention could never be turned off (store_true with default True); flags defaulting to on now get --no-<name>. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LogSettings (cogs/log.py) is now the log configuration guild setting and the only writer of the log table; the Logging cog and the config log commands both use it. LogConfig becomes an immutable dataclass. GuildSetting gains an on_change hook; the log setting uses it to keep Bot.message_logging_guilds in step, replacing refresh_logging_guilds and INVALIDATE_LOG_CONFIG. Fixes: - Changing log config on one cluster left other clusters' Logging config cache stale until restart (only message_logging_guilds was refreshed). - enable_log didn't refresh message_logging_guilds, so deletion/edit logging only started buffering messages after a restart. - The config commands' fallback SQL (used when the Logging cog wasn't loaded) wrote modules = ARRAY['*'], which nothing read as "all", so logging was on with no modules. '*' (also the column default) now means every module; removing a module from '*' expands it first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replaces the last cog-level setting caches: - AutoMod: _config_cache -> "automod" setting (whole-value set()). - JoinLeave: _join_cache/_leave_cache -> "join"/"leave" settings. - Level: guild_configs, role_rewards, channel_overrides, guild_role_overrides, role_overrides -> "level.config", "level.rewards" and "level.overrides" (one LevelOverrides per guild). GuildSetting gains changed(guild_id) for writers that keep their targeted SQL (COALESCE upserts, single-column updates): it refreshes this instance and announces the change. The saver is now optional; set() refuses on settings without one. None of these caches were invalidated across clusters before; a change on one cluster now reaches the others. Level setters no longer patch cached objects in place. AutoMod settings are now passed to the jsonb codec as a dict instead of a pre-serialised string (which the codec encoded again as a JSON string); from_row already reads both forms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CustomResponse dropped `ephemeral` for anything that wasn't a raw discord.Interaction, so ctx.send() never sent an ephemeral response even for slash commands. It now keeps it when the Context has an interaction. Context.send also honours `delete_after` set in a localization key (it was filtered out with the other non-send kwargs). Bot.before_invoke/after_invoke overrode discord.py's hook *decorators*, so they were never registered and never ran: the auto-defer, the loading reaction and the guild-row creation there were dead code. Removed; the guild row is created by fetch_prefix and on_guild_join. Message visibility stays configurable per message (localization now, dashboard later); recorded in GLOSSARY.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EconomyHelper is replaced by Ledger (credit, debit, move, transfer, balance), where each operation is one transaction over row-locked accounts, locked in user-id order. Balance is a small dataclass instead of get_balance's int | tuple. Fixes: - deposit/withdraw ran two separate transactions (remove, then add). - Shop.buy granted the role before charging and checked the balance outside any transaction; it now charges first, grants, and refunds if the role can't be given. - pay locked rows that might not exist yet; transfer creates accounts under the lock. - removemoney sent both the error and the success message on insufficient funds. - Accounts were created with check-then-insert and no unique key, so concurrent first-time credits could create duplicate rows. A migration merges existing duplicates (summing balances), makes cash/bank NOT NULL and adds UNIQUE (guild_id, user_id). - "??? xd" for paying yourself is now the pay.errors.self key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cogs no longer edit rendered embeds.
- CustomResponse.get_list renders list messages: the first embed field is
the row template, the rest is the empty state, {page}/{pages} work in
title/description/footer, and page_size splits rows into pages. It
replaces four hand-rolled copies (economy leaderboard, shop list, level
leaderboard, case list).
- The debt notice in balance and slots.lose is now driven by a {debt}
placeholder that is None when not in debt (the formatter drops the line,
convert_embeds drops the empty field) instead of remove_field(2).
- The level leaderboard's hardcoded "Page x/y" footer moves to
levels_leaderboard.footer.
Fixes:
- slots: every loss without debt raised AttributeError (it rendered with
convert_embeds=False and then read .fields on a dict).
- Rows whose only line was dropped produced empty field values, which
Discord rejects; get_list drops them like convert_embeds does.
- Case list rows now use the None-dropping formatter, so "Expires: None"
lines disappear.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Subcommand names were looked up by their bare name (HybridGroup.add_command and _localize_app_command_attributes overrode the key), so all groups shared top-level strings like "remove" and "list", and most subcommand names had no key at all. Every command and group now uses <l10n_key>-name; the en values that were placeholders (caserem, casedel, userinfo, chinfo, ...) are set to the command's real name, and the 15 now-unused shared strings are removed. GroupCog names keep their top-level strings (discord.py builds those groups). - core/slash_localization.py: command_key() is the one key rule, lookup() the one nested lookup (replacing _has_l10n_key, _resolve_fallback_name and the translator's own walk). - core/hybrid.py: HybridCommand/HybridGroup share _CommandOptions; groups are localized in __init__, because CogMeta's copies re-run __init__ and lost the localization applied in group(); commented-out group() removed. - /loop's choices get keys (loop-args-mode-*). - core/argument.py, core/bot.py and cogs/help.py imported slash_command_localization by name, binding the None it holds before the bot loads localizations, so their localized branches never ran. They now read the module attribute. - hu: caseinfo.name was "infó" (would rename /case), emojiinfo.name "info"; both set from the existing hu strings for the old shared keys. - tests/test_slash_keys.py fails when any slash key doesn't resolve in en. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tests/test_message_keys.py scans cogs/, core/ and helpers/ for send / reply / get_message / get_list / custom_response(...) calls whose first argument is a key literal and fails when the key is missing from localization/en.l10n.json (f-string keys are skipped). It found one: /info channel on a category sent info.channel.category, which didn't exist, so users got the raw key. Added the key, built from the Category arg's fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dSettings - Ticket config is now the "ticket" guild setting (ticket_config_setting). It was re-read from the database on every ticket action. get_ticket_config loses its test-only workarounds (inspect.isawaitable around fetchrow, try/except TypeError around dict(row), and the `if not self.bot.db` guard). - The ticket config commands write through _write(), which runs the SQL and reports the change, so caches here and on other instances refresh. - Giveaways read level_config_setting(...).is_on instead of querying level_config directly; the default (on) comes from GuildLevelConfig, as in the Level cog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The giveaway now caches the level config setting even when the Level cog isn't loaded, so the config commands' fallback SQL reports its writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…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>
CaseStore built each case with its own get_user / fetch_user calls, so a listing of N cases whose moderators weren't cached made N sequential API calls. _from_rows now collects the distinct user IDs, takes cached users, and fetches the rest concurrently (at most 5 at a time), once each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 new tests for cogs that had none: - info: user/member/DM branches, role default and missing role, channel info by channel type, unicode vs unknown emoji, template code parsing and the snapshot-code fallback; - setup/admin: prefix validation and save, extension reload/load/unload success and failure replies, the l10nreload path guard; - voice: format_ms, progress bar (live streams, clamping), loop modes and cycling, seek bounds, _get_player guards; - snapshot: captured payload shape, create/get round trip on Postgres; - log: _send skips unconfigured guilds and disabled modules, prefers the per-event channel, and on_member_join delivers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing defers slash commands automatically (the old before_invoke hook never ran), so commands that do slow work before their first reply fail with "The application did not respond". These now call ctx.defer() (a no-op for prefix commands): level (rank card render), snapshot and snapshot load, voice play, info ip and info template. Their replies are public, which matches what they send today. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: rnxm <63553775+rnxm@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: rnxm <63553775+rnxm@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: rnxm <63553775+rnxm@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Production can now run Gelbpunkt's gateway-proxy, which holds the shard connections and replays READY/GUILD_CREATE from its cache when the bot connects. A deploy restarts only the bot and sends no IDENTIFY. - DISCORD_GATEWAY_URL points discord.py at the proxy and skips the 5-second IDENTIFY spacing; SHARD_COUNT is required and checked against the proxy's /shard-count at startup. - The proxy is a compose service behind the gateway-proxy profile, pinned by digest; `just deploy` never touches it, `just deploy-proxy` recreates it. - MIGRATE_ON_START=false skips the boot-time migration in production. - Remove the bot-side RESUME machinery (SessionPersister, launch_shard override, session save on close, IDENTIFY lock): a fresh process that RESUMEs gets no READY or GUILD_CREATE and starts with an empty cache. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`just deploy` now checks out the latest v* release tag (prereleases excluded), or the tag or branch passed to it, instead of resetting to origin/main. Restores the explicit SHARD_COUNT requirement behind the gateway proxy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.