ForcePilot/backend/package/yuxi/channel/extensions/messenger/quick_reply.py

27 lines
668 B
Python
Raw Normal View History

QUICK_REPLY_MAX = 13
QUICK_REPLY_TITLE_MAX = 20
QUICK_REPLY_PAYLOAD_MAX = 1000
def build_text_quick_reply(title: str, payload: str, image_url: str = "") -> dict:
result: dict = {
"content_type": "text",
"title": title[:QUICK_REPLY_TITLE_MAX],
"payload": payload[:QUICK_REPLY_PAYLOAD_MAX],
}
if image_url:
result["image_url"] = image_url
return result
def build_location_quick_reply() -> dict:
return {"content_type": "location"}
def build_user_phone_quick_reply() -> dict:
return {"content_type": "user_phone_number"}
def build_user_email_quick_reply() -> dict:
return {"content_type": "user_email"}