fix WhatsApp group chat support and self-message handling

Bridge: allow fromMe messages in groups, include participant field in
message queue, bind to 0.0.0.0 for network access, QR served as HTML.

Adapter: process registered group messages (route to Claude), extract
participant for user identification, fix unbound 'phone' variable.

Tested end-to-end: WhatsApp group chat with Claude working. 442 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MoltBot Service
2026-02-13 22:31:22 +00:00
parent 80502b7931
commit 624eb095f1
5 changed files with 51 additions and 34 deletions

View File

@@ -276,17 +276,19 @@ class TestHandleIncoming:
mock_route.assert_not_called()
@pytest.mark.asyncio
async def test_group_registered_skip(self, _set_owned):
async def test_group_registered_routed(self, _set_owned):
client = _mock_client()
client.post.return_value = _mock_httpx_response(json_data={"ok": True})
msg = {
"from": "group123@g.us",
"participant": "5511999990000@s.whatsapp.net",
"text": "Hello",
"pushName": "User",
"isGroup": True,
}
with patch("src.adapters.whatsapp.route_message") as mock_route:
with patch("src.adapters.whatsapp.route_message", return_value=("Hi!", False)) as mock_route:
await handle_incoming(msg, client)
mock_route.assert_not_called()
mock_route.assert_called_once()
@pytest.mark.asyncio
async def test_clear_command(self, _set_owned):