← 返回 Skills 市场
767
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install lark-bot-listener
功能描述
Feishu/Lark message listener for real-time message processing via WebSocket. Use when users need to listen for incoming Feishu messages (text, image, file, p...
使用说明 (SKILL.md)
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()
Decorators - 消息处理装饰器
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 外均为可选):
| 参数 | 类型 | 说明 |
|---|---|---|
text |
str | 文本内容(必需) |
chat_id |
str | 会话 ID |
is_group |
bool | 是否群组消息 |
group_name |
str | 群组名称(私聊时为空) |
user_name |
str | 发送消息的用户姓名 |
装饰器参数:
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_path |
Path | 临时图片文件路径(必需) |
chat_id |
str | 会话 ID |
is_group |
bool | 是否群组消息 |
group_name |
str | 群组名称 |
user_name |
str | 发送消息的用户姓名 |
返回值:
- 返回
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_path |
Path | 临时文件路径(必需) |
chat_id |
str | 会话 ID |
is_group |
bool | 是否群组消息 |
group_name |
str | 群组名称 |
user_name |
str | 发送消息的用户姓名 |
listen - 通用消息监听器
用于监听任意类型消息(包括富文本 post)。
@listener.listen(message_type="post")
async def handle_post(ctx: MessageContext):
print(f"收到富文本消息: {ctx.content}")
MessageContext 属性:
| 属性 | 类型 | 说明 |
|---|---|---|
chat_id |
str | 会话 ID |
user_id |
str | 用户 ID |
message_type |
str | 消息类型 |
content |
str | 消息内容(文本消息为字符串,其他类型为 JSON 字符串) |
is_group |
bool | 是否群组消息 |
chat_type |
str | 会话类型 |
message_id |
str | 消息 ID |
send_message - 发送消息
发送 Markdown 格式的消息到飞书。
listener.send_message(chat_id, "**这是加粗文本**")
listener.send_message(chat_id, "普通文本\
[链接](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,处理完自动清理 - 错误隔离: 每个处理函数异常独立捕获,不影响其他函数
- 多注册: 同一消息可被多个处理函数处理
安全使用建议
Do not install or run this skill as-is. Ask the publisher for: (1) the package source/repository (e.g., GitHub or PyPI) and instructions to install a specific, signed release; (2) exact guidance for supplying Feishu credentials (environment variables or secret manager) and how tokens are stored/rotated. Before using, review the package code (or ask for a vetted upstream link), verify the package is from a trusted author, and run it in an isolated environment. Be especially cautious because the skill auto-downloads attachments and can automatically resend processed files — ensure that behavior is acceptable for your data privacy policies. If you cannot obtain a verifiable package/source and clear credential handling, consider using an alternative with published code or official SDKs.
功能分析
Type: OpenClaw Skill
Name: lark-bot-listener
Version: 0.1.0
The OpenClaw AgentSkills bundle for 'lark-bot-listener' is benign. The `SKILL.md` file describes a Feishu/Lark message listener, detailing its functionality for receiving and processing various message types (text, image, file, post) via WebSocket. It outlines the use of temporary files for image and file attachments, with explicit mention of automatic cleanup, which is a standard and necessary practice for such a skill. There are no indicators of malicious intent, such as data exfiltration, unauthorized execution, persistence mechanisms, obfuscation, or prompt injection attempts against the AI agent. The instructions are clear, aligned with the stated purpose, and do not suggest any harmful actions.
能力评估
Purpose & Capability
The skill claims to listen to Feishu/Lark messages and the docs show code that accepts app_id/app_secret and imports pywayne.lark_bot_listener. However the registry metadata declares no required credentials, no primaryEnv, and no install steps. A Feishu listener legitimately needs Feishu credentials and an installable Python package; those are missing from the declared requirements, which is incoherent.
Instruction Scope
SKILL.md contains concrete runtime instructions: import a Python package, construct LarkBotListener with app_id/app_secret, download attachments to a system temp directory (system_temp/lark_bot_temp), run an async listener, and automatically upload/send processed files. These actions are within the stated purpose, but the document gives no guidance for how credentials should be supplied or how the referenced package is installed. The file download/auto-reply behavior is expected for a message listener but raises privacy considerations (automatic download and re-send of attachments).
Install Mechanism
There is no install spec or code shipped with the skill, yet SKILL.md imports pywayne.lark_bot_listener — implying a third-party Python package is required. The registry provides no guidance on how to obtain or verify that package (no pip/install command, no homepage, no repository). That mismatch increases risk because users may be directed to install an unknown package manually.
Credentials
The documentation expects app_id and app_secret (sensitive credentials) to be supplied to LarkBotListener, but the skill declares no required environment variables or primary credential. Required secrets are therefore undocumented, which is a red flag: it's unclear how the skill expects credentials to be provided, stored, or protected. Automatic file downloads and auto-replies also mean those credentials would permit network access to your Feishu tenant and message sending.
Persistence & Privilege
The skill is not configured as always: true and does not request persistent system-wide privileges. It is instruction-only and does not declare actions that modify other skills or global agent settings. Note: agent autonomous invocation (disable-model-invocation=false) is the default and not by itself a problem.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install lark-bot-listener - 安装完成后,直接呼叫该 Skill 的名称或使用
/lark-bot-listener触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Initial release of pywayne-lark-bot-listener.
- Provides real-time Feishu/Lark message listening via WebSocket with async handling and deduplication.
- Convenient decorators for handling text, image, file, and post messages.
- Automatic download, cleanup, and optional reply for image/file handlers.
- Unified send_message API for sending Markdown messages.
- Includes robust async and error isolation features, with support for group/private messages.
- Rich documentation and code examples provided for rapid integration.
元数据
常见问题
Pywayne Lark Bot Listener 是什么?
Feishu/Lark message listener for real-time message processing via WebSocket. Use when users need to listen for incoming Feishu messages (text, image, file, p... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 767 次。
如何安装 Pywayne Lark Bot Listener?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install lark-bot-listener」即可一键安装,无需额外配置。
Pywayne Lark Bot Listener 是免费的吗?
是的,Pywayne Lark Bot Listener 完全免费(开源免费),可自由下载、安装和使用。
Pywayne Lark Bot Listener 支持哪些平台?
Pywayne Lark Bot Listener 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Pywayne Lark Bot Listener?
由 wangyendt(@wangyendt)开发并维护,当前版本 v0.1.0。
推荐 Skills