openclaw/src/discord
Kentaro Kuribayashi 3e07bd8b48
feat(discord): add configurable privileged Gateway Intents (GuildPresences, GuildMembers) (#2266)
* feat(discord): add configurable privileged Gateway Intents (GuildPresences, GuildMembers)

Add support for optionally enabling Discord privileged Gateway Intents
via config, starting with GuildPresences and GuildMembers.

When `channels.discord.intents.presence` is set to true:
- GatewayIntents.GuildPresences is added to the gateway connection
- A PresenceUpdateListener caches user presence data in memory
- The member-info action includes user status and activities
  (e.g. Spotify listening activity) from the cache

This enables use cases like:
- Seeing what music a user is currently listening to
- Checking user online/offline/idle/dnd status
- Tracking user activities through the bot API

Both intents require Portal opt-in (Discord Developer Portal →
Privileged Gateway Intents) before they can be used.

Changes:
- config: add `channels.discord.intents.{presence,guildMembers}`
- provider: compute intents dynamically from config
- listeners: add DiscordPresenceListener (extends PresenceUpdateListener)
- presence-cache: simple in-memory Map<userId, GatewayPresenceUpdate>
- discord-actions-guild: include cached presence in member-info response
- schema: add labels and descriptions for new config fields

* fix(test): add PresenceUpdateListener to @buape/carbon mock

* Discord: scope presence cache by account

---------

Co-authored-by: kugutsushi <kugutsushi@clawd>
Co-authored-by: Shadow <hi@shadowing.dev>
2026-01-26 10:39:54 -06:00
..
monitor feat(discord): add configurable privileged Gateway Intents (GuildPresences, GuildMembers) (#2266) 2026-01-26 10:39:54 -06:00
accounts.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
api.test.ts fix: harden discord rate-limit handling 2026-01-24 08:43:28 +00:00
api.ts fix: harden discord rate-limit handling 2026-01-24 08:43:28 +00:00
audit.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
audit.ts fix: surface match metadata in audits and slack logs 2026-01-18 00:50:36 +00:00
chunk.test.ts fix: paragraph-aware newline chunking (#1726) 2026-01-25 13:24:19 +00:00
chunk.ts fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
directory-live.ts refactor: centralize discord api errors 2026-01-20 17:28:19 +00:00
gateway-logging.test.ts chore(discord): restore gateway log context 2026-01-13 04:40:22 +00:00
gateway-logging.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
index.ts feat: unify poll support 2026-01-06 04:51:05 +00:00
monitor.gateway.test.ts Discord: harden gateway resilience 2026-01-08 16:52:44 -06:00
monitor.gateway.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
monitor.slash.test.ts feat(discord): add configurable privileged Gateway Intents (GuildPresences, GuildMembers) (#2266) 2026-01-26 10:39:54 -06:00
monitor.test.ts fix(discord): autoThread ack reactions + exec approval null handling (#1511) 2026-01-23 20:01:15 +00:00
monitor.tool-result.accepts-guild-messages-mentionpatterns-match.test.ts test: cover explicit mention gating across channels 2026-01-24 11:09:33 +00:00
monitor.tool-result.sends-status-replies-responseprefix.test.ts fix: unify inbound dispatch pipeline 2026-01-23 22:58:54 +00:00
monitor.ts refactor(channels): share channel config matching 2026-01-17 23:03:51 +00:00
probe.intents.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
probe.ts fix: normalize abort signals for fetch 2026-01-21 17:29:46 +00:00
resolve-channels.test.ts feat(channels): add resolve command + defaults 2026-01-18 01:00:24 +00:00
resolve-channels.ts refactor: centralize discord api errors 2026-01-20 17:28:19 +00:00
resolve-users.ts refactor: centralize discord api errors 2026-01-20 17:28:19 +00:00
send.channels.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.creates-thread.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.emojis-stickers.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.guild.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.messages.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.outbound.ts fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
send.permissions.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.reactions.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.sends-basic-channel-messages.test.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.shared.ts fix: newline chunking across channels 2026-01-25 04:11:36 +00:00
send.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
send.types.ts refactor(discord): split send pipeline 2026-01-14 05:39:55 +00:00
targets.test.ts refactor(channels): unify target parsing 2026-01-18 00:31:42 +00:00
targets.ts refactor(channels): unify target parsing 2026-01-18 00:31:42 +00:00
token.test.ts fix: prefer config tokens over env for discord/telegram 2026-01-16 23:13:00 +00:00
token.ts fix: prefer config tokens over env for discord/telegram 2026-01-16 23:13:00 +00:00