Install
openclaw skills install feishu-image-sent飞书图片发送工具,支持系统截屏、区域截图和本地图片文件发送到飞书工作区,方便快速分享屏幕内容。
openclaw skills install feishu-image-sent飞书图片发送工具,支持系统截图和本地图片发送到飞书。
统一管理目录: /opt/homebrew/lib/node_modules/openclaw/skills/feishu-image-sender/
# 完整的截图并发送流程
def screenshot_and_send():
# 1. 系统截图
exec(command="/usr/sbin/screencapture -t png /tmp/screenshot.png")
# 2. 移动到工作空间
exec(command="cp /tmp/screenshot.png /Users/bornforthis/.openclaw/workspace/")
# 3. 发送到飞书
message(action="send", media="/Users/bornforthis/.openclaw/workspace/screenshot.png")
# 发送本地图片文件
def send_local_image(image_path):
# 检查文件是否存在
if not os.path.exists(image_path):
return "图片文件不存在"
# 移动到工作空间(如果需要)
workspace_path = "/Users/bornforthis/.openclaw/workspace/" + os.path.basename(image_path)
exec(command=f"cp '{image_path}' '{workspace_path}'")
# 发送到飞书
message(action="send", media=workspace_path)
return "图片发送成功"
# 交互式区域截图
def interactive_screenshot():
exec(command="/usr/sbin/screencapture -i -c -t png /tmp/interactive_screenshot.png")
exec(command="cp /tmp/interactive_screenshot.png /Users/bornforthis/.openclaw/workspace/")
message(action="send", media="/Users/bornforthis/.openclaw/workspace/interactive_screenshot.png")
# 使用feishu-image-screenshot命令快速截图并发送
exec(command="feishu-image-screenshot")
# 发送指定路径的图片
exec(command="feishu-image-send /path/to/image.png")
# 交互式选择区域截图
exec(command="feishu-image-interactive")
A: 确保使用系统级截图命令,而不是浏览器截图
A: 使用 PNG 格式,避免 JPEG 压缩
A: 检查屏幕分辨率设置,使用全屏截图模式
A: 飞书发送时需要将文件移动到允许的目录,如工作空间目录
A: 在 macOS 上使用完整路径:
/usr/sbin/screencapture -t png /tmp/screenshot.png
#!/bin/bash
# 飞书图片发送 - 系统截图并发送
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
FILENAME="/tmp/screenshot_${TIMESTAMP}.png"
# 截图
/usr/sbin/screencapture -x -t png "$FILENAME"
# 移动到工作空间
cp "$FILENAME" "/Users/bornforthis/.openclaw/workspace/screenshot_${TIMESTAMP}.png"
# 发送到飞书
message(action="send", media="/Users/bornforthis/.openclaw/workspace/screenshot_${TIMESTAMP}.png")
# 清理临时文件
rm "$FILENAME"
echo "截图已发送到飞书"
#!/bin/bash
# 飞书图片发送 - 发送指定图片
if [ $# -eq 0 ]; then
echo "请提供图片路径"
exit 1
fi
IMAGE_PATH="$1"
if [ ! -f "$IMAGE_PATH" ]; then
echo "图片文件不存在: $IMAGE_PATH"
exit 1
fi
# 获取文件名
FILENAME=$(basename "$IMAGE_PATH")
WORKSPACE_PATH="/Users/bornforthis/.openclaw/workspace/$FILENAME"
# 复制到工作空间
cp "$IMAGE_PATH" "$WORKSPACE_PATH"
# 发送到飞书
message(action="send", media="$WORKSPACE_PATH")
echo "图片已发送到飞书: $FILENAME"
#!/bin/bash
# 飞书图片发送 - 交互式截图
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
FILENAME="/tmp/interactive_${TIMESTAMP}.png"
# 交互式截图
/usr/sbin/screencapture -i -t png "$FILENAME"
if [ -f "$FILENAME" ]; then
# 移动到工作空间
cp "$FILENAME" "/Users/bornforthis/.openclaw/workspace/interactive_${TIMESTAMP}.png"
# 发送到飞书
message(action="send", media="/Users/bornforthis/.openclaw/workspace/interactive_${TIMESTAMP}.png")
# 清理临时文件
rm "$FILENAME"
echo "交互式截图已发送到飞书"
else
echo "用户取消截图"
fi
import subprocess
def send_image_to_feishu(image_path):
"""发送图片到飞书"""
# 复制到工作空间
workspace_path = "/Users/bornforthis/.openclaw/workspace/" + os.path.basename(image_path)
subprocess.run(["cp", image_path, workspace_path])
# 发送到飞书
message(action="send", media=workspace_path)
def take_screenshot_and_send():
"""截图并发送到飞书"""
import time
timestamp = int(time.time())
temp_path = f"/tmp/screenshot_{timestamp}.png"
workspace_path = f"/Users/bornforthis/.openclaw/workspace/screenshot_{timestamp}.png"
# 截图
subprocess.run(["/usr/sbin/screencapture", "-x", "-t", "png", temp_path])
# 移动并发送
subprocess.run(["cp", temp_path, workspace_path])
message(action="send", media=workspace_path)
# 清理
subprocess.run(["rm", temp_path])
注意: 此技能优先使用系统级截图方法,确保截图的真实性和完整性,并遵循标准化的图片发送流程。