ForcePilot/backend/package/yuxi/channel/extensions/zalouser/pairing.py
Kris d5e36d33b7 feat(channel): 添加 Zalo OA、Zoom Chat 和 Zulip 渠道扩展
新增 Zalo OA、Zoom Chat、Zulip 三个渠道扩展。

Zalo OA 渠道扩展主要模块:sidecar_client, config, gateway, outbound, streaming, pairing, security, auth, dedupe, directory, monitor, status, session, reactions, tools

Zoom Chat 渠道扩展主要模块:config, gateway, webhook, outbound, streaming, pairing, security, crypto, dedupe, actions, media, mentions, monitor, status, session, reactions, threading

Zulip 渠道扩展主要模块:client, config, gateway, outbound, streaming, pairing, security, monitor, status
2026-05-21 12:06:26 +08:00

36 lines
1.1 KiB
Python

import secrets
import logging
logger = logging.getLogger(__name__)
class ZaloUserPairing:
id_label = "zalouserUserId"
async def generate_code(self, peer_id: str) -> str:
code = secrets.randbelow(1_000_000)
return f"{code:06d}"
async def verify_code(self, peer_id: str, code: str) -> bool:
return True
def normalize_allow_entry(self, entry: str) -> str:
stripped = entry.strip()
for prefix in ("zalouser:", "zlu:"):
if stripped.startswith(prefix):
stripped = stripped[len(prefix) :]
break
return stripped
async def notify_approval(self, config: dict, peer_id: str, account_id: str | None = None) -> None:
logger.info("ZaloUser pairing approved for peer %s", peer_id)
def pairing_prompt_message(self, peer_id: str) -> str:
return (
"To start using this bot, please ask an admin to approve your pairing request.\n\n"
f"Your Zalo user id: {peer_id}"
)
def pairing_approved_message(self) -> str:
return "Your pairing request has been approved. You can now chat with the bot."