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:
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user