From cc687c79adc7e5cf17039fdbe45e5cb5ae202498 Mon Sep 17 00:00:00 2001 From: "Bernd (Hermes)" Date: Mon, 10 Aug 2026 10:29:48 +0200 Subject: [PATCH] send_clarify(): chunk buttons into max 3 per attachment row Matches the Archivar-Clarify pattern (MAX_BUTTONS_PER_ROW = 3, line 5085). Instead of one attachment with all actions, split into multiple attachments each with max 3 buttons. The 'Other' button counts as one of the 3. Example: 4 choices + Other = 5 buttons -> 2 attachments: [1 2 3] + [4 Other] --- plugin/adapter.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugin/adapter.py b/plugin/adapter.py index 90341a8..3a37bcd 100644 --- a/plugin/adapter.py +++ b/plugin/adapter.py @@ -7547,12 +7547,24 @@ class RocketChatAdapter(BasePlatformAdapter): "style": "default", }) - # Create attachment with buttons + # Create attachment(s) with buttons — max 3 per row (UX: mobile readability) + MAX_BUTTONS_PER_ROW = 3 attachments = [{ "color": "#1d74f5", "title": "Please choose an option:", "actions": buttons, }] + if len(buttons) > MAX_BUTTONS_PER_ROW: + attachments = [] + for i in range(0, len(buttons), MAX_BUTTONS_PER_ROW): + chunk = buttons[i:i + MAX_BUTTONS_PER_ROW] + attachments.append({ + "color": "#1d74f5", + "actions": chunk, + }) + # First attachment gets the title + if attachments: + attachments[0]["title"] = "Please choose an option:" # Send message with buttons success = await self._post_message_with_retry(real_room_id, text, attachments=attachments)