Skip to content

Discord chat: a welcome message by DM when the chat opens for someone - #450

Merged
TripleU613 merged 1 commit into
mainfrom
discord-chat/welcome
Nov 25, 2026
Merged

TripleU613 merged 1 commit into
mainfrom
discord-chat/welcome

Conversation

@TripleU613

Copy link
Copy Markdown
Owner

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

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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T19:10:57.236984Z b711bab PR opened
🔒 Security Review ✅ Completed 2026-11-25T19:12:07.520331Z b711bab PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +78 to +79
PluginStore.set(STORE, welcome_key(discord_id), true)
send_welcome(discord_id, links[discord_id])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +73 to +75
recent
.reject { |member| done.include?(welcome_key(member.dig("user", "id"))) }
.first(WELCOMES_PER_RUN)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@TripleU613
TripleU613 merged commit 570549e into main Nov 25, 2026
8 checks passed
@TripleU613
TripleU613 deleted the discord-chat/welcome branch November 25, 2026 19:17
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