新增 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
56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
import logging
|
||
|
||
logger = logging.getLogger(__name__)
|
||
|
||
ZOOM_EMOJI_MAP = {
|
||
"👍": "thumbsup",
|
||
"👎": "thumbsdown",
|
||
"❤️": "heart",
|
||
"😂": "joy",
|
||
"😮": "open_mouth",
|
||
"😢": "cry",
|
||
"😡": "angry",
|
||
"😆": "laugh",
|
||
"😍": "heart_eyes",
|
||
"😱": "scream",
|
||
"🤔": "thinking",
|
||
"😴": "sleeping",
|
||
"😎": "sunglasses",
|
||
"🤗": "hug",
|
||
"🙏": "pray",
|
||
"💪": "muscle",
|
||
"🎉": "tada",
|
||
"🔥": "fire",
|
||
"💯": "100",
|
||
"✅": "white_check_mark",
|
||
"❌": "x",
|
||
"➕": "heavy_plus_sign",
|
||
"➖": "heavy_minus_sign",
|
||
}
|
||
|
||
|
||
def parse_reaction_event(payload: dict) -> dict | None:
|
||
inner = payload.get("payload", {}).get("object", {})
|
||
if not inner:
|
||
return None
|
||
|
||
return {
|
||
"event_type": payload.get("event", ""),
|
||
"message_id": inner.get("message_id", ""),
|
||
"reaction_name": inner.get("reaction_name", ""),
|
||
"emoji": inner.get("emoji", ""),
|
||
"user_email": inner.get("user_email", ""),
|
||
"channel_id": payload.get("payload", {}).get("channel_id", ""),
|
||
}
|
||
|
||
|
||
def emoji_to_zoom_reaction(emoji: str) -> str | None:
|
||
return ZOOM_EMOJI_MAP.get(emoji)
|
||
|
||
|
||
def zoom_reaction_to_emoji(name: str) -> str:
|
||
for emoji, rname in ZOOM_EMOJI_MAP.items():
|
||
if rname == name:
|
||
return emoji
|
||
return "👍"
|