Repository navigation
Allow scheduled messages to mention people - #240
Merged
Merged
Conversation
…sions Closes #239 - Remove boolean mentions field from ChannelPost - Add mention detection for @everyone/@here, roles, and users - Check permissions for each mention type at schedule time - Re-check permissions at post time using creator's Discord ID - User and role mentions allowed for anyone with schedule-posts capability - @everyone/@here requires Mention Everyone permission - Remove 'Pings: on/off' toggle from schedule draft UI - Apply to all post types (messages, polls, attendance polls) The bot now detects what mention types are present in the content and validates them against the scheduling user's permissions in the target channel. At post time, permissions are re-checked to ensure the creator still has the required access. Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
- Remove mentions: false from all message posts - Fix channel-poster type narrowing for send/messages - Fix toDiscordMessage test call signature - Run biome format on all changed files Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
…rom schema
- Restore interpolate regex (was broken by sed removing spaces in {})
- Restore JWT token regex in scrub.ts (was broken by sed changing {8,} to {8})
- Restore info-content placeholder regex
- Remove mentions: z.boolean() from ChannelPost schema
- Fix YAML syntax in test fixtures (add space before closing brace)
Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
NinjaLikesCheez
marked this pull request as ready for review
November 25, 2026 17:40
Comment on lines
99
to
104
| z.strictObject({ | ||
| kind: z.literal("message"), | ||
| text: z.string().min(1).max(MAX_MESSAGE_LENGTH), | ||
| mentions: z.boolean(), | ||
| }), | ||
| z.strictObject({ | ||
| kind: z.literal("poll"), |
There was a problem hiding this comment.
Bug: Removing mentions from a z.strictObject schema causes schema validation failure on existing persisted schedule YAML files containing legacy mentions keys.
Severity: CRITICAL
Suggested Fix
Allow legacy mentions keys in the schema and strip them (e.g. by making mentions: z.boolean().optional() or using .passthrough()/.strip()), or add a migration step before validation in ScheduleStore.#load().
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/services/schedules.ts#L99-L104
Potential issue: Removing `mentions: z.boolean()` from the message variant of
`postSchema` causes validation to fail on existing schedules stored in
`data/schedules.yaml`. Because `postSchema` uses `z.strictObject`, any legacy schedule
with a `mentions` key triggers an unrecognized key error during `ScheduleStore.#load()`.
This marks the store with a problem state, preventing all schedules from executing or
being edited until the file is manually corrected.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
Closes #239
Summary
This PR implements the feature requested in Sentry feedback PIXEL-2B to allow scheduled messages to mention and ping specific people.
Changes
Core functionality
src/core/mentions.ts): Detects@everyone,@here, role mentions (<@&id>), and user mentions (<@id>) in post contentschedule-postscapability (member tier)@everyone/@hererequires theMention EveryoneDiscord permission in the target channelUI changes
Technical implementation
mentions: booleanfield fromChannelPosttypeChannelPosterto accept creator reference and re-fetch permissions at post timeTesting
@everyone/@herewith various permission combinationsMigration notes