fix(discord): send online presence on ready when no custom presence is configured#31333
fix(discord): send online presence on ready when no custom presence is configured#31333Sid-Qin wants to merge 1 commit intoopenclaw:mainfrom
Conversation
…s configured
When neither activity nor status was configured, resolveDiscordPresenceUpdate
returned null. The ReadyListener skipped the updatePresence call, so
Discord never received a presence update and showed the bot as offline.
Return a minimal { status: "online" } presence instead of null so the
gateway always sends a presence update on connect.
Closes openclaw#31260
Made-with: Cursor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e151b1ba2
ℹ️ 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".
|
|
||
| if (!hasActivity && !hasStatus) { | ||
| return null; | ||
| return { since: null, activities: [], status: "online", afk: false }; |
There was a problem hiding this comment.
Update legacy tests for default online presence
This change makes resolveDiscordPresenceUpdate({}) return a non-null object, but src/discord/monitor/monitor.test.ts:714-716 still asserts the no-config case is null, so the Discord monitor test suite becomes internally inconsistent and will fail when run (pnpm test). Please update or remove that legacy assertion so CI reflects the new behavior instead of flagging this as a regression.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR fixes the Discord bot offline status issue by ensuring a presence update is sent even when no custom presence configuration exists. The change is minimal and well-executed:
Confidence Score: 5/5
Last reviewed commit: 9e151b1 |
|
Superseded by #33277 (consolidated presence/health work). Please follow the new PR. |
|
Superceded by existing commits on main |
Summary
resolveDiscordPresenceUpdatenow returns a minimal{ status: "online" }presence object when neitheractivitynorstatusis configured, instead of returningnull. This ensuresDiscordStatusReadyListeneralways callsgateway.updatePresence()on connect.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Security Impact (required)
NoNoNo(presence update was already sent when configured; now it also fires when unconfigured)NoNoRepro + Verification
Environment
Steps
activityorstatusfieldsExpected
Actual
Evidence
New test file
presence.test.tswith 6 test cases:Human Verification (required)
Compatibility / Migration
Yes— bots with explicit presence config are unaffected. Bots without config will now appear online instead of offline.NoNoFailure Recovery (if this breaks)
nullinresolveDiscordPresenceUpdatewhen no config is setsrc/discord/monitor/presence.tsRisks and Mitigations
status: "invisible"explicitly to hide the bot. The previous behavior was undocumented and almost certainly unintentional.