← Back to Skills Marketplace
wangyendt

Pywayne Lark Bot

by wangyendt · GitHub ↗ · v0.1.0
cross-platform ⚠ suspicious
841
Downloads
0
Stars
2
Active Installs
1
Versions
Install in OpenClaw
/install lark-bot
Description
Feishu/Lark Bot API wrapper for full-featured Feishu bot interactions. Use when users need to send messages (text, image, audio, file, post, interactive, sha...
README (SKILL.md)

Pywayne Lark Bot

飞书机器人模块,提供完整飞书 API 交互功能,包括消息发送、文件管理、用户/群组查询和消息监听。

Quick Start

from pywayne.lark_bot import LarkBot, TextContent

# 初始化
bot = LarkBot(app_id="your_app_id", app_secret="your_app_secret")

# 发送文本消息到用户
bot.send_text_to_user(user_open_id="user_xxx", text="Hello!")

# 发送文本消息到群聊
bot.send_text_to_chat(chat_id="oc_xxx", text="Group message")

TextContent - 文本格式化工具

创建各种文本格式,用于发送带格式的文本消息。

Mentions

# @所有人
at_all = TextContent.make_at_all_pattern()

# @指定用户
at_user = TextContent.make_at_someone_pattern(user_open_id="user_xxx", username="张三", id_type="open_id")

Text Styles

# 加粗、斜体、下划线、删除线
bold = TextContent.make_bold_pattern("粗体")
italic = TextContent.make_italian_pattern("斜体")
underline = TextContent.make_underline_pattern("下划线")
strikethrough = TextContent.make_delete_line_pattern("删除线")

# 超链接
link = TextContent.make_url_pattern("https://example.com", "点击访问")

LarkBot - 消息发送与查询

推荐路径:发送 Markdown(优先使用)

优先使用 send_markdown_to_chat,它会自动处理大文本分包,并支持两种路由:

  • prefer="card_v2"(默认):发送 schema 2.0 interactive 卡片,适合绝大多数 Markdown 场景
  • prefer="post":发送 post 富文本;可设置 table_fallback="code_block" 将 Markdown 表格稳定降级
md = """
# 发布说明

- 新增对账接口
- 修复支付重试逻辑

| 模块 | 状态 |
| --- | --- |
| API | 完成 |
| FE  | 测试中 |
"""

# 默认走 card_v2(推荐)
bot.send_markdown_to_chat(
    chat_id="oc_xxx",
    md_text=md,
    title="版本进度",
    prefer="card_v2"
)

# 需要 post 时切换路由
bot.send_markdown_to_chat(
    chat_id="oc_xxx",
    md_text=md,
    title="版本进度",
    prefer="post",
    table_fallback="code_block"
)

发送消息

Text Message

bot.send_text_to_user(user_open_id, "私聊消息")
bot.send_text_to_chat(chat_id, "群聊消息")

Image Message

# 上传图片
image_key = bot.upload_image("/path/to/image.jpg")

# 发送图片
bot.send_image_to_user(user_open_id, image_key)
bot.send_image_to_chat(chat_id, image_key)

Audio / Media / File Message

# 上传文件
file_key = bot.upload_file("/path/to/file.pdf", file_type="pdf")

# 发送音频
bot.send_audio_to_user(user_open_id, file_key)

# 发送多媒体
bot.send_media_to_chat(chat_id, file_key)

# 发送文件
bot.send_file_to_user(user_open_id, file_key)

Post (Rich Text) Message

from pywayne.lark_bot import PostContent

post = PostContent(title="富文本标题")

# 添加内容
line = post.make_text_content("这是粗体文本", styles=["bold"])
post.add_content_in_new_line(line)

# 发送
bot.send_post_to_user(user_open_id, post.get_content())
bot.send_post_to_chat(chat_id, post.get_content())

Interactive Card Message

# 直接传原始 interactive 卡片
card = {
    "header": {"title": {"content": "卡片标题", "tag": "plain_text"}},
    "elements": [...]
}
bot.send_interactive_to_user(user_open_id, card)
bot.send_interactive_to_chat(chat_id, card)

CardContentV2(schema 2.0 卡片构造器)

from pywayne.lark_bot import CardContentV2

card = CardContentV2(title="日报", template="blue")
card.add_markdown("# 今日进展\
\
- 完成接口联调\
- 修复2个问题")
card.add_hr()
card.add_image(img_key="img_xxx")

bot.send_interactive_to_chat(chat_id, card.get_card())

Share Message

# 分享群聊
bot.send_shared_chat_to_user(user_open_id, shared_chat_id)
bot.send_shared_chat_to_chat(chat_id, shared_chat_id)

# 分享用户
bot.send_shared_user_to_user(user_open_id, shared_user_id)
bot.send_shared_user_to_chat(chat_id, shared_user_id)

PostContent - 富文本构建器

post = PostContent(title="标题")

# 可用内容类型
text = post.make_text_content("文本", styles=["bold", "underline"])
link = post.make_link_content("链接文字", "https://example.com")
at = post.make_at_content(user_open_id)
img = post.make_image_content(image_key="img_xxx")
media = post.make_media_content(file_key="file_xxx", image_key="thumb_xxx")
emoji = post.make_emoji_content(emoji_type="OK")
hr = post.make_hr_content()
code_block = post.make_code_block_content(language="python", text="print('hello')")
markdown = post.make_markdown_content("**Markdown**")

# 添加内容
post.add_content_in_new_line(text)
post.add_contents_in_line([link, at])  # 同一行添加多个元素
# 推荐:直接添加 markdown,支持分块与表格降级
md = """
## 迭代计划
| 任务 | 状态 |
| --- | --- |
| A   | done |
| B   | doing |
"""
post.add_markdown(md, table_as="code_block", max_chunk_bytes=8000)

文件操作

# 上传
image_key = bot.upload_image("/path/to/image.jpg")
file_key = bot.upload_file("/path/to/file.pdf", file_type="pdf")

# 下载
bot.download_image(image_key, "/save/path/image.jpg")
bot.download_file(file_key, "/save/path/file.pdf")

# 下载消息中的所有资源
resources = bot.download_message_resources(
    message_id="msg_xxx",
    message_content='{"image_key":"img_xxx"}',
    save_dir="/save/dir"
)

用户与群组查询

# 获取用户信息
users = bot.get_user_info(emails=["[email protected]"], mobiles=["13800138000"])

# 获取群组列表
groups = bot.get_group_list()

# 通过群名获取群ID
chat_ids = bot.get_group_chat_id_by_name("项目讨论组")

# 获取群成员
members = bot.get_members_in_group_by_group_chat_id(chat_id)

# 通过群成员名获取 open_id
member_ids = bot.get_member_open_id_by_name(chat_id, "张三")

# 获取群名和用户名
chat_name, user_name = bot.get_chat_and_user_name(chat_id, user_id)

LarkBotListener - 消息监听

飞书消息监听器,用于实时接收和处理消息。

from pywayne.lark_bot_listener import LarkBotListener
from pathlib import Path

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

文本消息处理

@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}")

图片消息处理

@listener.image_handler(group_only=True)
async def handle_image(image_path: Path, chat_id: str, user_name: str):
    print(f"收到图片: {image_path}")
    # 处理图片...

文件消息处理

@listener.file_handler()
async def handle_file(file_path: Path, chat_id: str, user_name: str):
    print(f"收到文件: {file_path}")
    # 处理文件...

通用消息监听

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

启动监听

listener.run()

监听器参数说明

Handler 参数(除必需参数外均为可选):

Handler 必需参数 可选参数
text_handler text chat_id, is_group, group_name, user_name
image_handler image_path chat_id, is_group, group_name, user_name
file_handler file_path chat_id, is_group, group_name, user_name

装饰器参数

  • message_type: 消息类型("text", "image", "file", "post")
  • group_only=True: 只监听群组消息
  • user_only=True: 只监听私聊消息

注意事项

  1. 所有处理函数使用 async/await 语法
  2. 消息会去重(默认 60 秒)
  3. 图片和文件下载到临时目录,处理完及时清理
  4. 每个处理函数异常独立捕获,不影响其他函数
Usage Guidance
This package is an instruction-only description of a Python Feishu/Lark wrapper but includes no code or install instructions and fails to declare the Feishu credentials it demonstrably uses. Before installing or using it: 1) Ask the publisher for the actual package source (PyPI name or a trustworthy GitHub repo) and verify the code matches the documentation. 2) If you must install, prefer an official release (PyPI or GitHub release) and review the source for unexpected network, filesystem, or credential-handling behavior. 3) Do not paste app_id/app_secret into unknown UIs; supply credentials only to vetted code and follow least-privilege practices. 4) Be cautious about enabling any listener/webhook the code asks you to run—understand what network ports are opened and whether it exposes secrets or message payloads to third parties. If the author cannot provide a clear, verifiable package/source and install steps, treat this skill as untrusted.
Capability Analysis
Type: OpenClaw Skill Name: lark-bot Version: 0.1.0 The skill bundle is classified as suspicious due to its extensive file system and network interaction capabilities, which, while plausible for a full-featured bot, present a significant risk if misused by an AI agent. The `SKILL.md` documents functions like `upload_image`, `upload_file`, `download_image`, `download_file`, and `download_message_resources`, allowing arbitrary file reading and writing. Additionally, the `LarkBotListener` can handle incoming files, further increasing file system interaction. Although the `SKILL.md` itself does not contain explicit malicious instructions or prompt injection attempts, these powerful capabilities could be exploited by a malicious prompt to an agent, leading to data exfiltration or unauthorized file manipulation on the host system.
Capability Assessment
Purpose & Capability
The skill claims to be a full-featured Feishu/Lark bot wrapper (pywayne.lark_bot) and shows examples that require a Python package and Feishu credentials, but the skill bundle contains no code, no package, and no install spec. It's unclear whether the runtime environment will actually have the referenced 'pywayne' package or who provides it. A legitimate wrapper skill would normally include the code or a clear, trustworthy install mechanism.
Instruction Scope
The SKILL.md contains concrete runtime examples that require providing app_id/app_secret, uploading/downloading local files, and running a message listener (which implies opening network endpoints). The instructions themselves don't tell the agent to search system files or environment beyond explicit examples, but they assume access to local file paths and long-lived credentials. The listener examples (truncated) suggest actions with network exposure but lack guidance about binding addresses, webhook URLs, or security.
Install Mechanism
There is no install specification and no code files; however the instructions import 'pywayne.lark_bot' and related modules. Without an install step or included code, the instructions cannot be executed in a clean environment unless the package is preinstalled by other means. This mismatch is an incoherence risk (either the package is expected to exist on the host or the SKILL.md is incomplete).
Credentials
The SKILL.md examples require app_id and app_secret (clear credentials for Feishu) and perform file uploads/downloads, but the skill metadata declares no required environment variables, no primary credential, and no config paths. That omission is a mismatch: the skill needs credentials to work but doesn't request or describe how they should be provided, which could lead users to supply secrets in an ad-hoc, unsafe way.
Persistence & Privilege
The skill is not marked 'always:true' and is user-invocable; there is no install action, no writes to other skills' config, and no elevated privilege requests in the metadata. Persistence and privileged presence are not requested by the skill package itself.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install lark-bot
  3. After installation, invoke the skill by name or use /lark-bot
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.1.0
- Initial public release of pywayne-lark-bot. - Provides comprehensive Feishu/Lark bot API wrapper for sending messages (including Markdown, image, audio, file, post, interactive cards, and share), with advanced Markdown handling and auto chunking. - Supports file upload/download and robust user/group info querying. - Includes LarkBotListener for asynchronous message listening with flexible handler decorators and built-in de-duplication. - Offers extensive message formatting utilities (mention, text styles, rich post/card builders) and fallback strategies for Markdown tables. - Complete usage examples and reference included in documentation.
Metadata
Slug lark-bot
Version 0.1.0
License
All-time Installs 2
Active Installs 2
Total Versions 1
Frequently Asked Questions

What is Pywayne Lark Bot?

Feishu/Lark Bot API wrapper for full-featured Feishu bot interactions. Use when users need to send messages (text, image, audio, file, post, interactive, sha... It is an AI Agent Skill for Claude Code / OpenClaw, with 841 downloads so far.

How do I install Pywayne Lark Bot?

Run "/install lark-bot" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Pywayne Lark Bot free?

Yes, Pywayne Lark Bot is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Pywayne Lark Bot support?

Pywayne Lark Bot is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Pywayne Lark Bot?

It is built and maintained by wangyendt (@wangyendt); the current version is v0.1.0.

💬 Comments