Repository navigation
Add /closing-time, posted automatically when the space closes - #81
Merged
Merged
Conversation
Members can post a configurable closing-time message. The same send path runs automatically after a confirmed space-closed announcement. Both no-op when the destination channel is unset, off, or none.
Admins set the reminder in a Discord modal. Pixel writes data/closing-time.md atomically; on Azure that path is the Files share.
Two Pixels on one token made /closing-time post and then fail the interaction ACK. Log that as discord.duplicate_handler instead of a crash.
The form opens with the saved reminder when one exists, so admins can tweak it. beforeForm may now return field values for that.
NinjaLikesCheez
marked this pull request as ready for review
October 10, 2026 16:02
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.
Members can post a closing-time reminder with
/closing-time. The same send path runs automatically after a confirmed space-closed announcement. Admins set the text with/admin closing-time set.Behaviour
features/closing-time), one send path: both the slash command and the space-closed hook announceclosing.timethrough the Announcer. The Discord adapter publishes it; the feature never talks to Discord./closing-timeaccess.minTier:member. Posts to a configured channel (typically members). No new capability./admin closing-time setaccess.minTier:admin. Opens a modal; if a message is already saved, the modal is prefilled so it can be tweaked. The submitted text is written atomically toPIXEL_DATA_DIR/closing-time.md. On Azure that directory is the Files share (/app/persist/data) — the write persists there; there is no extra sync step./closing-timereplies privately that it is off; the auto path logsclosing_time.disabledand does not fail space-close. Admins can still set the text.just registermust be re-run after this rename so Discord lists/admin closing-time setinstead of/admin set closing-time.Configure
DISCORD_CLOSING_TIME_CHANNEL_ID— a Discord channel ID, or unset /off/noneto disable both post paths/admin closing-time set(modal, prefilled when a message is already saved), or editdata/closing-time.md/PIXEL_CLOSING_TIME_FILE. Missing or empty → built-in English default. Pixel reads the file each time it posts.The body is a file, not an env var, because it is typically a multi-line checklist (awkward in
.envand Azure settings) and is not a secret. Do not put door codes or passwords in it. Operator text in the portabletextfield goes throughescapeMarkdown; Discord posts the body as written with mentions off (same idea as/schedule).Auth
No new capability. Does not touch
core/access*,core/identity*,core/registry*orservices/access-config*.Needs a human reviewer:
core/command.tsandcore/dispatcher.ts—beforeFormmay now returnvaluesso a form can open with saved text. Access checks are unchanged.Live try on pixel-dev
After the first deploy,
/closing-timeshowed Discord's "I don't know that command" / an interaction error and then still posted. That was two Pixels on the Pixel Dev token: Azurepixel-dev--0000008plus a leftover localpixel-maincontainer (schedule-posts worktree, same app/guild). The leftover instance is stopped. Azure is one healthy replica. Discord 40060/10062 is now logged asdiscord.duplicate_handlerinstead of reported as a crash.Retry
/closing-timeand/admin closing-time seton Pixel Dev after this revision is deployed and registered. Do not also runjust devor another container on that token.Tests
just checkpassed (1649 tests). FakeCommandContextand fake announcer. Dispatcher tests for guest/member deny, admin write, and modal prefill.Off
origin/main. Not mixed with Tailscale / #76.