Repository navigation
Discord chat: a welcome message by DM when the chat opens for someone - #450
Conversation
discord_chat_welcome_message is sent once, as a direct message, to each
member whose linked account lets them in, with {username} filled in. Only
people who joined the server in the last 7 days are welcomed, at most 10
per run so a launch rush isn't throttled as spam. A member is marked
welcomed before the message goes out, so closed direct messages aren't
retried every minute. Blank, the default, sends nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BUGDaR7qv2d8CuVp7UGSTs
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b711babf72
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| PluginStore.set(STORE, welcome_key(discord_id), true) | ||
| send_welcome(discord_id, links[discord_id]) |
There was a problem hiding this comment.
Keep retryable welcome failures eligible
If DM creation or delivery raises a retryable failure—such as a rate limit that exceeds call's retry policy, a Discord 5xx response, or a network timeout—the member is already recorded as welcomed. The exception aborts the run, but every later run filters this member out, so the scheduled job cannot actually “pick up where this one stopped” and the welcome is permanently lost. Persist the marker only after successful delivery or after confirming a non-retryable closed-DM response.
Useful? React with 👍 / 👎.
| recent | ||
| .reject { |member| done.include?(welcome_key(member.dig("user", "id"))) } | ||
| .first(WELCOMES_PER_RUN) |
There was a problem hiding this comment.
Enforce the documented per-minute welcome limit
This limits welcomes per invocation rather than per minute. Besides the scheduled job in app/jobs/scheduled/discord_chat_sync_members.rb, every discord_chat_* setting change enqueues another sync from sub_plugins/discord_chat.rb; those jobs are merely serialized by the mutex, so two or more invocations within one minute each select the next ten recipients and can send well over the documented limit. Track the send window across runs or otherwise rate-limit the actual deliveries.
Useful? React with 👍 / 👎.
Re-opened from #447.
discord_chat_welcome_message(blank = off): one DM per newly let-in member, {username} filled, joined in the last 7 days only, 10 per run, marked done before sending so closed DMs are not retried.🤖 Generated with Claude Code
https://claude.ai/code/session_01BUGDaR7qv2d8CuVp7UGSTs