该提交实现了支持企业微信、微信公众号、个人微信桥接三种模式的完整微信渠道适配器,包含以下核心模块: 1. 基础认证与配置相关:auth_adapter、config_reload、setup_contract等 2. 消息处理与格式转换:format、attachment_adapter、outbound_adapter等 3. 多模式客户端支持:wecom/mp子模块,包含加解密、消息收发能力 4. 辅助能力:限速器、防抖、会话绑定、事件映射、模板渲染等 5. 扩展能力:二维码登录、消息读取、特权用户、心跳监控等 实现了完整的微信生态对接能力,支持消息收发、事件处理、API调用限流、配置热重载等功能。
61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from yuxi.channels.meta import ChannelMeta
|
|
|
|
WECHAT_META = ChannelMeta(
|
|
id="wechat",
|
|
label="微信",
|
|
selection_label="微信 (WeChat)",
|
|
docs_path="docs/channels/wechat",
|
|
docs_label="WeChat 文档",
|
|
blurb="微信渠道适配器,支持企业微信/公众号/个人微信桥接三种模式",
|
|
order=8,
|
|
aliases=["weixin", "WeChat"],
|
|
detail_label="WeChat 微信",
|
|
system_image="wechat",
|
|
markdown_capable=False,
|
|
exposure="configured",
|
|
show_configured=True,
|
|
show_in_setup=True,
|
|
quickstart_allow_from=[],
|
|
force_account_binding=False,
|
|
prefer_session_lookup_for_announce_target=False,
|
|
prefer_over=False,
|
|
)
|
|
|
|
WECHAT_CAPABILITIES: dict[str, Any] = {
|
|
"chatTypes": ["direct", "group"],
|
|
"polls": False,
|
|
"reactions": False,
|
|
"edit": False,
|
|
"unsend": False,
|
|
"reply": True,
|
|
"effects": False,
|
|
"groupManagement": True,
|
|
"threads": False,
|
|
"media": True,
|
|
"streaming": False,
|
|
"tts": {"voice": {"enabled": True, "synthesis_target": "voice-note"}},
|
|
"nativeCommands": False,
|
|
"blockStreaming": False,
|
|
}
|
|
|
|
WECHAT_MESSAGE_CAPABILITIES: dict[str, bool] = {
|
|
"presentation": False,
|
|
"delivery-pin": False,
|
|
}
|
|
|
|
|
|
def get_meta() -> ChannelMeta:
|
|
return WECHAT_META
|
|
|
|
|
|
def get_capabilities() -> dict[str, Any]:
|
|
return dict(WECHAT_CAPABILITIES)
|
|
|
|
|
|
def get_message_capabilities() -> dict[str, bool]:
|
|
return dict(WECHAT_MESSAGE_CAPABILITIES)
|