修正第26章: 通用图片发送方法(非特指NAS)

This commit is contained in:
2026-04-17 11:53:06 +08:00
parent 4fefe2541b
commit 542b38586f

View File

@@ -1146,39 +1146,30 @@ obsidian help
- 如果 Obsidian 未运行,会报错或无响应 - 如果 Obsidian 未运行,会报错或无响应
- 内容中换行用 `\n`,制表符用 `\t` - 内容中换行用 `\n`,制表符用 `\t`
## 26. NAS 照片发送到 Telegram (2026-04-17) ## 26. OpenClaw 发送图片到 Telegram (2026-04-17)
### 功能 ### 功能
从 NAS 照片目录(/Users/weishen/mnt/volume1/homes/shenwei/Photos/)复制照片并通过 Telegram 发送给用户 通过 OpenClaw 将本地图片发送到 Telegram。
### 前置要求 ### 前置要求
- NAS 照片目录已挂载到 `/Users/weishen/mnt/volume1/` - Telegram bot 已配置account: bot1
- Telegram bot 已配置account: bot1, target: 5038825565 - 目标 chat ID比利哥: 5038825565
### 操作步骤 ### 操作步骤
#### 1. 查找照片 #### 1. 复制图片到 media 目录
```bash ```bash
# 查看照片目录结构 cp /path/to/image.png ~/.openclaw/media/inbound/
ls /Users/weishen/mnt/volume1/homes/shenwei/Photos/MobileBackup/
# 查找具体照片
find /Users/weishen/mnt/volume1/homes/shenwei/Photos/MobileBackup/ -type f -name "*.jpg" | head -5
``` ```
#### 2. 复制到 media 目录 #### 2. 通过 OpenClaw 发送
```bash
cp /path/to/photo.jpg ~/.openclaw/media/inbound/
```
#### 3. 通过 OpenClaw 发送
```bash ```bash
/opt/homebrew/bin/openclaw message send \ /opt/homebrew/bin/openclaw message send \
--account bot1 \ --account bot1 \
--channel telegram \ --channel telegram \
--target 5038825565 \ --target 5038825565 \
--media ~/.openclaw/media/inbound/photo.jpg \ --media ~/.openclaw/media/inbound/image.png \
--message "📷 照片说明" --message "说明文字"
``` ```
### 参数说明 ### 参数说明
@@ -1194,19 +1185,15 @@ cp /path/to/photo.jpg ~/.openclaw/media/inbound/
### 示例 ### 示例
```bash ```bash
# 复制并发送 # 复制并发送
cp "/Users/weishen/mnt/volume1/homes/shenwei/Photos/MobileBackup/5MP-9A3/2003/01/IMG_20030101_000059_151.jpg" ~/.openclaw/media/inbound/ cp ~/Downloads/photo.jpg ~/.openclaw/media/inbound/
/opt/homebrew/bin/openclaw message send --account bot1 --channel telegram --target 5038825565 --media ~/.openclaw/media/inbound/IMG_20030101_000059_151.jpg --message "📷 2003年照片" /opt/homebrew/bin/openclaw message send --account bot1 --channel telegram --target 5038825565 --media ~/.openclaw/media/inbound/photo.jpg --message "📷 测试图片"
``` ```
### 照片目录结构 ### 注意事项
``` - 图片支持 jpg、png、gif 等常见格式
/Users/weishen/mnt/volume1/homes/shenwei/Photos/ - 临时文件放在 `~/.openclaw/media/inbound/` 目录
├── MobileBackup/ # 手机备份 - 文件名避免中文,建议用英文或数字
│ ├── 5MP-9A3/ # 设备名
│ │ └── 2003/
│ │ └── 01/
│ │ └── IMG_*.jpg
│ └── ... │ └── ...
├── Canon_DIGITAL_IXUS_400/ ├── Canon_DIGITAL_IXUS_400/
├── Canon_EOS_400D_DIGITAL/ ├── Canon_EOS_400D_DIGITAL/