Skip to content

Reflect AFK/DND status in Rich Presence (small_image + [AFK] suffix)#8

Draft
PrEvIeS wants to merge 1 commit intoezbooz:mainfrom
PrEvIeS:upstream-pr/afk-status
Draft

Reflect AFK/DND status in Rich Presence (small_image + [AFK] suffix)#8
PrEvIeS wants to merge 1 commit intoezbooz:mainfrom
PrEvIeS:upstream-pr/afk-status

Conversation

@PrEvIeS
Copy link
Copy Markdown

@PrEvIeS PrEvIeS commented May 5, 2026

Summary

Detect AFK/DND mode toggles from Client.txt and reflect them in Discord Rich Presence:

  • AFK ON → append [AFK] to the state string and swap the small image to afk.
  • AFK OFF → restore the exact small image that was active when AFK turned on (snapshot survives a level-up that happens inside the AFK window).

Detected log lines:

  • : AFK mode is now ON. Autoreply "..."
  • : AFK mode is now OFF
  • : DND mode is now ON. Autoreply "..."
  • : DND mode is now OFF

Diff scope

+48 / −2 in main.py. Two new optional kwargs on update_rpc keep every existing call site byte-identical — the only new code path is gated behind a regex_afk.search(line) match, so non-AFK lines run through unchanged.

Asset requirement

Upload an afk.png to the Discord developer portal under the application's Rich Presence assets so the small_image="afk" lookup resolves. README addendum incoming as a follow-up if helpful.

Test plan

  • Type /afk on in chat → Discord status shows ... [AFK] and the AFK icon.
  • Level up while AFK → details update, [AFK] and AFK icon persist for the AFK transition; subsequent level/area pings revert to default behaviour (this PR keeps the diff minimal — full "AFK suffix on every update" can be a follow-up).
  • Type /afk off → Discord restores the exact pre-AFK class icon (Witch / Infernalist / etc.).
  • Same for /dnd on and /dnd off.

Backport notes

This is a hand-backport of a feature developed in a hexagonal-DDD fork (src/poe2_rpc/). The upstream-facing diff is intentionally surgical and stays inside monitor_log() + update_rpc().

🤖 Backport prepared with Claude Code

Detect `: AFK mode is now ON. Autoreply "..."` and `: AFK mode is now OFF`
(also DND variants) from Client.txt and reflect that state in Discord
Rich Presence.

- AFK ON: append "[AFK]" to the state string and replace the small_image
  with "afk". The previous small_image (derived from the player's class
  / ascendency) is snapshotted so AFK OFF can restore EXACTLY this value
  even if a level-up happened during the AFK window.
- AFK OFF: restore the snapshotted small_image; clear the snapshot.

`update_rpc()` gains two optional kwargs (`small_image_override`,
`afk_suffix`) that default to the pre-existing behaviour, so all current
call sites stay byte-identical. Implementation is fully gated behind the
new `regex_afk` match — non-AFK lines hit zero new code paths.

Note: requires uploading an `afk.png` asset to the Discord developer
portal under the application's Rich Presence assets (see README).
PrEvIeS added a commit to PrEvIeS/Path-Of-Exile-2-RPC that referenced this pull request May 5, 2026
…in EN/RU/UA

The 4-PR upstream campaign (panvex-b6p) is feature-complete on this stacked
branch. Updates the user-facing READMEs and CLAUDE.md to reflect the four
shipped capabilities:

- Official PoE2 client support (Steam + PathOfExile.exe)
- Owner auto-pin (party-mate disambiguation)
- AFK / DND status with small-image override + restore
- Background tray service + Windows Startup shortcut

README.md / README.ru.md / README.ua.md
- Add explicit Features bullets for all four capabilities.
- Flip the To-Do checklist (now 5/5 complete).
- RU/UA translations get the new "Run as a background service" section
  to match the English README that was added during PR-4.

CLAUDE.md
- Replace the four open-work items with checked-off equivalents and a
  pointer to the upstream draft PRs (ezbooz#6, ezbooz#7, ezbooz#8, ezbooz#9). Notes that the
  remaining work is the end-of-campaign Windows live-smoke pass.
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