Repository navigation
Add restraining orders, jail system, and matr clear guild reset - #9
Merged
Merged
Conversation
- restrain: 1h orders blocking all targeted actions; violation prompts the protected user to press charges (button view, 120s) - jail: severity-scaled sentences (light fun random 1-5m; slap 10, adopt/makeparent 15, bite/punch 20, stab 25, marry 30); inmates can only act on other inmates via ephemeral jail_partners/jail_children tables dissolved on release - tasks.loop sweep (20s, configurable) handles order expiry, release, and dissolution notices; core is jail.sweep_expiry(store, now) - clear: Manage-Server-only, Confirm/Cancel view (60s); resets guild-scoped state only - global family tree and blocks untouched - slash tree: restrain top-level, clear in admin, anniversary moved to fun subgroup (25-child cap) - 42 new tests; 182 total, ruff clean Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a restraining-order → jail pipeline and a
matr clearguild reset, all enforced at the shared command entry point so prefix and slash invocations behave identically.Restraining orders.
!matr restrain @user(slash:/matr restrain) files an order that lapses afterMATRIMONY_RESTRAINING_ORDER_TTL(default 3600s; refiling renews). While active, every targeted action the restrained user aims at the protected one — proposals (marry/adopt/makeparent) and all targeted fun actions (hug,slap,poke,punch,stab,flirt,date, …;shipis exempt as read-only) — is blocked and posts a Press charges / Let it slidediscord.ui.Viewfor the protected user only (120s). Charges → jail; decline/timeout → order stands.Jail.
jail.pyholds the discord-free logic:sentence_secondsscales by severity — light fun actions roll random 1–5 min (documented in README); majors are fixed (slap 10, adopt/makeparent 15, bite/punch 20, stab 25, marry 30; unlisted defaults 15). Jailed users can't act on non-jailed users (includingdivorce/disown/block) and get a rotating quip; inmates can marry/adopt/interact with each other. Jail proposals (proposals.jailflag, migrated column) write to separatejail_partners/jail_childrentables — never the real tree — andrelease_inmatedissolves them both directions on release with divorce/abandonment notices.Expiry. A
tasks.loop(everyMATRIMONY_JAIL_SWEEP, default 20s) runsjail.sweep_expiry(store, now)— a pure function of the store and an injected clock — then_announce_expiryposts order-lapse and release/dissolution embeds to the channels where things were filed.matr clear(slash:/matr admin clear). Manage-Server-only (commands.has_permissions+app_commands.default_permissions), shows a warning embed with Confirm reset / Cancel (60s, invoker only; timeout/Cancel no-ops).Clear scope decision:
clear_guilddeletes guild-scoped rows only — guild settings (prefix, incest), proposals, notices, restraining orders, and that guild's jail sentences (inmates released, their jail relationships dissolved). It deliberately does not touchpartners/children/blocks: the family tree and block lists are global across servers with no guild attribution, so wiping them would destroy other guilds' data — the narrowest reading of "reset this guild." This is documented in the code, README, and this description.Slash tree note: the
/matrroot group caps at 25 children, soanniversarymoved into thefunsubgroup (/matr fun anniversary); prefix!matr anniversaryis unchanged.restrainis top-level,clearjoinedadmin.Tests
python -m pytest tests: 182 passed (42 new intests/test_jail.pycovering order file/expire/renew, severity mapping, accept/decline/lapsed charges, jail blocking, inmate-to-inmate relationships, ephemeral-relationship dissolution, sweep with injected clock, announcements, and the fullclearpermission/confirm/cancel/timeout/scope matrix).ruff check .: clean.Link to Devin session: https://app.devin.ai/sessions/ab2748c10a7a43058d0cffd7727fd92f
Open in Devin Desktop: https://app.devin.ai/desktop/session/ab2748c10a7a43058d0cffd7727fd92f?variant=devin
Requested by: @CommunityPoke