Skip to content

Add restraining orders, jail system, and matr clear guild reset - #9

Merged
CommunityPoke merged 1 commit into
mainfrom
devin/restraining-orders-jail
Oct 18, 2026
Merged

CommunityPoke merged 1 commit into
mainfrom
devin/restraining-orders-jail

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Adds a restraining-order → jail pipeline and a matr clear guild 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 after MATRIMONY_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, …; ship is exempt as read-only) — is blocked and posts a Press charges / Let it slide discord.ui.View for the protected user only (120s). Charges → jail; decline/timeout → order stands.

Jail. jail.py holds the discord-free logic: sentence_seconds scales 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 (including divorce/disown/block) and get a rotating quip; inmates can marry/adopt/interact with each other. Jail proposals (proposals.jail flag, migrated column) write to separate jail_partners/jail_children tables — never the real tree — and release_inmate dissolves them both directions on release with divorce/abandonment notices.

Expiry. A tasks.loop (every MATRIMONY_JAIL_SWEEP, default 20s) runs jail.sweep_expiry(store, now) — a pure function of the store and an injected clock — then _announce_expiry posts 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_guild deletes 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 touch partners/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 /matr root group caps at 25 children, so anniversary moved into the fun subgroup (/matr fun anniversary); prefix !matr anniversary is unchanged. restrain is top-level, clear joined admin.

Tests

python -m pytest tests: 182 passed (42 new in tests/test_jail.py covering 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 full clear permission/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

- 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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@CommunityPoke
CommunityPoke merged commit 77f3880 into main Oct 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant