# Send Pywayne Lark Bot Listener to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "lark-bot-listener",
    "name": "Pywayne Lark Bot Listener",
    "source": "tencent",
    "type": "skill",
    "category": "通讯协作",
    "sourceUrl": "https://clawhub.ai/wangyendt/lark-bot-listener",
    "canonicalUrl": "https://clawhub.ai/wangyendt/lark-bot-listener",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/lark-bot-listener",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=lark-bot-listener",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/lark-bot-listener"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/lark-bot-listener",
    "downloadUrl": "https://openagent3.xyz/downloads/lark-bot-listener",
    "agentUrl": "https://openagent3.xyz/skills/lark-bot-listener/agent",
    "manifestUrl": "https://openagent3.xyz/skills/lark-bot-listener/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/lark-bot-listener/agent.md"
  }
}
```
## Documentation

### Pywayne Lark Bot Listener

飞书消息监听器，通过 WebSocket 实时接收和处理飞书消息。

### Quick Start

from pywayne.lark_bot_listener import LarkBotListener

# 初始化监听器
listener = LarkBotListener(
    app_id="your_app_id",
    app_secret="your_app_secret",
    message_expiry_time=60  # 消息去重过期时间（秒）
)

# 处理文本消息
@listener.text_handler()
async def handle_text(text: str):
    print(f"收到消息: {text}")

# 启动监听
listener.run()

### text_handler

文本消息处理装饰器，直接传递文本内容。

@listener.text_handler(group_only=False, user_only=False)
async def handle_text(text: str, chat_id: str, is_group: bool, group_name: str, user_name: str):
    print(f"收到来自 {user_name} 的消息: {text}")
    listener.send_message(chat_id, f"已收到：{text}")

参数说明（除 text 外均为可选）：

参数类型说明textstr文本内容（必需）chat_idstr会话 IDis_groupbool是否群组消息group_namestr群组名称（私聊时为空）user_namestr发送消息的用户姓名

装饰器参数：

group_only=True: 只处理群组消息
user_only=True: 只处理私聊消息

### image_handler

图片消息处理装饰器，自动下载图片到临时文件并清理。

from pathlib import Path
import cv2
import tempfile

@listener.image_handler()
async def handle_image(image_path: Path, user_name: str) -> Path:
    # 处理图片
    img = cv2.imread(str(image_path))
    # ...处理逻辑...
    # 返回新图片路径会自动发送回去，返回 None 则不发送
    return image_path

参数说明（除 image_path 外均为可选）：

参数类型说明image_pathPath临时图片文件路径（必需）chat_idstr会话 IDis_groupbool是否群组消息group_namestr群组名称user_namestr发送消息的用户姓名

返回值：

返回 Path: 自动上传并发送新图片
返回 None: 不发送任何图片

### file_handler

文件消息处理装饰器，自动下载文件到临时文件并清理。

@listener.file_handler()
async def handle_file(file_path: Path, user_name: str) -> Path:
    # 处理文件
    with open(file_path, 'r') as f:
        content = f.read()
    # ...处理逻辑...
    return file_path  # 返回文件路径会自动发送回去

参数说明（除 file_path 外均为可选）：

参数类型说明file_pathPath临时文件路径（必需）chat_idstr会话 IDis_groupbool是否群组消息group_namestr群组名称user_namestr发送消息的用户姓名

### listen - 通用消息监听器

用于监听任意类型消息（包括富文本 post）。

@listener.listen(message_type="post")
async def handle_post(ctx: MessageContext):
    print(f"收到富文本消息: {ctx.content}")

MessageContext 属性：

属性类型说明chat_idstr会话 IDuser_idstr用户 IDmessage_typestr消息类型contentstr消息内容（文本消息为字符串，其他类型为 JSON 字符串）is_groupbool是否群组消息chat_typestr会话类型message_idstr消息 ID

### send_message - 发送消息

发送 Markdown 格式的消息到飞书。

listener.send_message(chat_id, "**这是加粗文本**")
listener.send_message(chat_id, "普通文本\\n[链接](https://example.com)")

### 完整示例

from pywayne.lark_bot_listener import LarkBotListener
from pathlib import Path

listener = LarkBotListener(
    app_id="your_app_id",
    app_secret="your_app_secret"
)

# 文本消息 - AI 回复示例
@listener.text_handler()
async def handle_text(text: str, chat_id: str, user_name: str):
    # 处理逻辑...
    listener.send_message(chat_id, f"收到来自 {user_name} 的消息")

# 图片消息 - 自动下载和清理
@listener.image_handler()
async def handle_image(image_path: Path):
    # image_path 是临时文件，处理完会自动清理
    print(f"处理图片: {image_path}")

# 文件消息 - 自动下载和清理
@listener.file_handler(group_only=True)
async def handle_file(file_path: Path, group_name: str):
    print(f"收到文件: {file_path} 来自 {group_name}")

# 富文本消息
@listener.listen(message_type="post")
async def handle_post(ctx: MessageContext):
    import json
    post_content = json.loads(ctx.content)
    print(f"收到富文本: {post_content}")

# 启动监听
listener.run()

### 注意事项

异步处理: 所有处理函数使用 async/await 语法
消息去重: 每个处理函数独立去重，默认 60 秒过期
临时文件: 图片和文件下载到 系统临时目录/lark_bot_temp，处理完自动清理
错误隔离: 每个处理函数异常独立捕获，不影响其他函数
多注册: 同一消息可被多个处理函数处理
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: wangyendt
- Version: 0.1.0
## Source health
- Status: healthy
- Source download looks usable.
- Yavira can redirect you to the upstream package for this source.
- Health scope: source
- Reason: direct_download_ok
- Checked at: 2026-04-30T16:55:25.780Z
- Expires at: 2026-05-07T16:55:25.780Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/lark-bot-listener)
- [Send to Agent page](https://openagent3.xyz/skills/lark-bot-listener/agent)
- [JSON manifest](https://openagent3.xyz/skills/lark-bot-listener/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/lark-bot-listener/agent.md)
- [Download page](https://openagent3.xyz/downloads/lark-bot-listener)