新增 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
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from yuxi.channel.extensions.zalouser.types import ZaloUserReactionIcon, REACTION_ALIAS_MAP
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
REACTION_EMOJI_MAP: dict[ZaloUserReactionIcon, str] = {
|
|
ZaloUserReactionIcon.LIKE: "\U0001f44d",
|
|
ZaloUserReactionIcon.HEART: "\u2764\ufe0f",
|
|
ZaloUserReactionIcon.HAHA: "\U0001f602",
|
|
ZaloUserReactionIcon.WOW: "\U0001f62e",
|
|
ZaloUserReactionIcon.CRY: "\U0001f622",
|
|
ZaloUserReactionIcon.ANGRY: "\U0001f621",
|
|
}
|
|
|
|
|
|
def resolve_reaction(raw: str) -> ZaloUserReactionIcon | None:
|
|
alias = raw.strip().lower()
|
|
if alias in REACTION_ALIAS_MAP:
|
|
return REACTION_ALIAS_MAP[alias]
|
|
for icon in REACTION_ALIAS_MAP.values():
|
|
if icon.value.lower() == alias:
|
|
return icon
|
|
return None
|
|
|
|
|
|
def resolve_reaction_emoji(icon: ZaloUserReactionIcon) -> str:
|
|
return REACTION_EMOJI_MAP.get(icon, "")
|
|
|
|
|
|
def supported_reactions() -> list[dict]:
|
|
return [
|
|
{"alias": "like", "icon": "LIKE", "emoji": "\U0001f44d"},
|
|
{"alias": "heart", "icon": "HEART", "emoji": "\u2764\ufe0f"},
|
|
{"alias": "haha", "icon": "HAHA", "emoji": "\U0001f602"},
|
|
{"alias": "wow", "icon": "WOW", "emoji": "\U0001f62e"},
|
|
{"alias": "cry", "icon": "CRY", "emoji": "\U0001f622"},
|
|
{"alias": "angry", "icon": "ANGRY", "emoji": "\U0001f621"},
|
|
]
|