Skip to content

feat(discord): route GUILD_MEMBER_ADD events to agents#24000

Open
pdd-cli wants to merge 2 commits intoopenclaw:mainfrom
pdd-cli:feat/discord-member-add-events-pr
Open

feat(discord): route GUILD_MEMBER_ADD events to agents#24000
pdd-cli wants to merge 2 commits intoopenclaw:mainfrom
pdd-cli:feat/discord-member-add-events-pr

Conversation

@pdd-cli
Copy link

@pdd-cli pdd-cli commented Feb 22, 2026

Summary

  • Adds DiscordMemberAddListener that fires when a user joins a Discord guild and delivers a system event to the matched agent session
  • Gated on the existing intents.guildMembers privileged intent flag (must also be enabled in Discord Developer Portal)
  • Opt-in per guild via memberJoinNotifications: "on" (default: "off" to avoid high-volume floods on existing deployments)

Motivation

Without this, the only way to react to member joins was a polling cron that called the Discord REST API directly every few minutes — unreliable, leaks the bot token into process args, and caused welcome messages to arrive hours or days late.

Config

{
  "channels": {
    "discord": {
      "intents": { "guildMembers": true },
      "guilds": {
        "YOUR_GUILD_ID": {
          "memberJoinNotifications": "on"
        }
      }
    }
  }
}

Test plan

  • pnpm tsgo — no errors
  • pnpm test src/discord/monitor/ — 118 tests pass
  • Manually verified listener registration log line on gateway restart: [discord] GuildMembers intent enabled — member-add listener registered

Closes #23978

🤖 Generated with Claude Code

Greptile Summary

Adds support for Discord GUILD_MEMBER_ADD events by introducing a new DiscordMemberAddListener that fires system events when users join guilds. The implementation follows existing patterns from the reaction listener, includes proper opt-in configuration (memberJoinNotifications: "on"), and correctly gates the feature on the guildMembers privileged intent.

  • Introduced DiscordMemberJoinNotificationMode type with "off" (default) and "on" values
  • Added new listener class following the established pattern (timing instrumentation, error handling)
  • Routes events to agent sessions using guildId and memberRoleIds for proper agent selection
  • Skips bot accounts and the bot user itself
  • Conditionally registers listener only when intents.guildMembers is enabled

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation follows established patterns from existing listeners (reactions, presence), includes proper opt-in defaults to prevent spam, respects existing privileged intent gating, and the author confirmed tests pass (118 tests in src/discord/monitor/). No logic errors or security issues detected.
  • No files require special attention

Last reviewed commit: aa948ec

(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!

@openclaw-barnacle openclaw-barnacle bot added channel: discord Channel integration: discord size: S labels Feb 22, 2026
@pdd-cli pdd-cli force-pushed the feat/discord-member-add-events-pr branch from aa948ec to 7a01a67 Compare February 23, 2026 00:16
@pdd-cli pdd-cli force-pushed the feat/discord-member-add-events-pr branch 2 times, most recently from adc3184 to b18f307 Compare February 26, 2026 18:53
Prompt Driven added 2 commits February 28, 2026 10:55
Adds a DiscordMemberAddListener that fires when a user joins a Discord
guild and delivers a system event to the matched agent session. Gated on
the existing intents.guildMembers privileged intent flag (must also be
enabled in the Discord Developer Portal). Opt-in per guild via
memberJoinNotifications: 'on' (default: 'off' to avoid high-volume
floods on existing deployments).

Closes openclaw#23978
@pdd-cli pdd-cli force-pushed the feat/discord-member-add-events-pr branch from b18f307 to ad3a2c7 Compare February 28, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(discord): route GUILD_MEMBER_ADD events to agents

1 participant