feat: customize Discord lifecycle reactions - #29954
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused lifecycle configuration and documentation work. The requested behavior is still absent on current main: plugins/platforms/discord/adapter.py:1964-1986 still gates reactions as a boolean and emits fixed 👀/✅/❌ values.
Problems
- This branch changes the former adapter at
gateway/platforms/discord.pyand the former YAML bridge ingateway/config.py. Commitcc8e5ec2afbfd10a3cff4e710210dd9ecae64a33moved both live surfaces into the bundled plugin. Current YAML handling isplugins/platforms/discord/adapter.py:8229-8291; current lifecycle handling isplugins/platforms/discord/adapter.py:1964-1986. - The PR is currently conflicting with
main, so its implementation cannot reach the active Discord adapter without a targeted port.
Suggested changes
- Port the resolver/lifecycle edits to
plugins/platforms/discord/adapter.pyand serialize the YAML mapping in that module's_apply_yaml_confighook. - Consolidate with the duplicate feature work identified in the member comment on #29954: #22100.
Automated hermes-sweeper review.
| logger.debug("[%s] remove_reaction failed (%s): %s", self.name, emoji, e) | ||
| return False | ||
|
|
||
| def _reaction_config(self) -> Optional[Dict[str, Optional[str]]]: |
There was a problem hiding this comment.
Current main no longer loads this module: commit cc8e5ec2afbfd10a3cff4e710210dd9ecae64a33 moved the active adapter to plugins/platforms/discord/adapter.py. Port this resolver and the lifecycle-hook edits there; current main's live hooks remain at lines 1964-1986.
| os.environ["DISCORD_AUTO_THREAD"] = str(discord_cfg["auto_thread"]).lower() | ||
| if "reactions" in discord_cfg and not os.getenv("DISCORD_REACTIONS"): | ||
| os.environ["DISCORD_REACTIONS"] = str(discord_cfg["reactions"]).lower() | ||
| reactions_cfg = discord_cfg["reactions"] |
There was a problem hiding this comment.
The Discord YAML-to-env bridge was moved out of gateway/config.py by cc8e5ec2afbfd10a3cff4e710210dd9ecae64a33. Apply this mapping serialization in plugins/platforms/discord/adapter.py::_apply_yaml_config instead; that is the active current-main config path.
Summary
discord.reactions/DISCORD_REACTIONSto be a per-lifecycle emoji mappingnull/false-ish values to disable individual processing/success/failure reactionsTest Plan
python -m pytest tests/gateway/test_discord_reactions.py tests/gateway/test_config.py -q -o 'addopts='python -m ruff check gateway/platforms/discord.py gateway/config.py hermes_cli/config.py tests/gateway/test_discord_reactions.py tests/gateway/test_config.py