Add 'business' profile type and category

Business accounts are cli profiles with businessAddress=True, so each connecting
customer gets their own group chat (handled via the existing chat UI) with an
optional welcome auto-reply. New BUSINESS_TYPES, a /business page + sidebar entry,
and a business variant of the create form. profile/chat pages route via a
_category helper. Adds business_test.py (customer connects -> lands in a business
group, not a direct contact) — passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jon
2026-06-05 17:09:00 +01:00
parent 6232c1589d
commit 609e91c6de
5 changed files with 160 additions and 11 deletions

View File

@@ -132,9 +132,10 @@ def group_member_count(g: dict) -> int:
return g.get("groupSummary", {}).get("currentMembers", 0)
BOT_TYPES = ["echo", "broadcast", "support", "directory", "deadmans"]
USER_TYPES = ["user"]
ALL_TYPES = BOT_TYPES + USER_TYPES
BOT_TYPES = ["echo", "broadcast", "support", "directory", "deadmans"]
USER_TYPES = ["user"]
BUSINESS_TYPES = ["business"] # cli accounts with a business address (per-customer group chats)
ALL_TYPES = BOT_TYPES + USER_TYPES + BUSINESS_TYPES
@dataclass
@@ -468,6 +469,13 @@ async def _run_bot(
settings: dict = {"businessAddress": False, "autoAccept": {"acceptIncognito": False}}
if bot_type == "user":
pass # plain user: auto-accept on, no auto-reply
elif bot_type == "business":
# business account: each connecting customer becomes a group chat the
# operator handles in the UI. Optional welcome auto-reply if configured.
settings["businessAddress"] = True
welcome = (config.get("welcome_message") or "").strip()
if welcome:
settings["autoReply"] = {"type": "text", "text": welcome}
elif bot_type == "support":
settings["businessAddress"] = True
welcome = config.get("welcome_message", f"Welcome to {name} support.")