新增 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
33 lines
909 B
Python
33 lines
909 B
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from yuxi.channel.extensions.zulip.client import ZulipAsyncClient
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class ZulipStatus:
|
|
@staticmethod
|
|
async def probe_account(account: dict) -> bool:
|
|
realm_url = account.get("realm_url", "")
|
|
bot_email = account.get("bot_email", "")
|
|
bot_api_key = account.get("bot_api_key", "")
|
|
if not realm_url or not bot_email or not bot_api_key:
|
|
return False
|
|
|
|
client = ZulipAsyncClient(
|
|
realm_url=realm_url,
|
|
bot_email=bot_email,
|
|
bot_api_key=bot_api_key,
|
|
timeout=10.0,
|
|
connect_timeout=5.0,
|
|
)
|
|
try:
|
|
result = await client.get_own_user()
|
|
return result.get("result") == "success"
|
|
except Exception:
|
|
return False
|
|
finally:
|
|
await client.close()
|