webhook-promo-scheduler
使用反垃圾邮件分类帐安排促销/警报消息并将其发送到 Discord Webhook URL。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~marcia-assistant-webhook-promo-schedulercURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~marcia-assistant-webhook-promo-scheduler/file -o marcia-assistant-webhook-promo-scheduler.md## webhook-promo-scheduler
Schedule and send promo/alert messages to a Discord webhook URL with an anti-spam ledger.
### What it does
- Posts to a Discord webhook (JSON payload with `content`)
- Maintains a JSONL ledger to enforce **max 1 successful post per day per channel**
- Provides a rotation mode that cycles through a message list
- Supports `--dry-run` so you can validate cadence/ledger without sending anything
### Positioning (best angle)
- Ship updates without becoming a spammer (or leaking a webhook): strict cadence + audit trail.
### Files
- `scripts/post_webhook.py` : Discord webhook POST helper (stdlib only)
- `scripts/ledger.py` : JSONL ledger helpers (stdlib only)
- `scripts/promo_scheduler.py` : CLI tool (stdlib only)
### Ledger
- Default: `~/.openclaw/webhook-promo-ledger.jsonl`
- Override: `--ledger-path /path/to/ledger.jsonl`
- JSONL fields (per line): `date`, `channel`, `status`, `hash`
### Safety
- The CLI **refuses to print** the webhook URL.
- Logs redact any webhook URL if it would appear.
- Recommended: keep the webhook in a private channel, rotate it if leaked, and use `--dry-run` before enabling live sends.
### FAQ (security)
**Q: This exposes a Discord webhook — is that dangerous?**
A: Treat it like a password. This tool won’t print it, supports secret injection, and has `--dry-run` + a ledger so you can validate behavior before turning on live posting. If you want zero direct exposure, put a relay (Cloudflare Worker / Supabase Edge Function) in front and keep the real webhook private.
### Usage
One-shot post:
```bash
python3 {baseDir}/scripts/promo_scheduler.py post \
--webhook-url <URL> \
--channel openclaw-discord \
--message "Hello from OpenClaw!"
```
Draft rotation:
```bash
python3 {baseDir}/scripts/promo_scheduler.py rotate \
--webhook-url <URL> \
--channel openclaw-discord \
--messages-file messages.txt
```
`messages.txt` format:
- One message per non-empty line
- Lines starting with `#` are ignored
---
## 中文说明
## webhook-promo-scheduler
使用反垃圾邮件分类账,将促销/警报消息安排并发送到 Discord Webhook URL。
### 功能说明
- 向 Discord webhook 发送消息(包含 `content` 的 JSON 负载)
- 维护一个 JSONL 分类账,以强制实施**每个频道每天最多发送 1 条成功消息**
- 提供循环模式,可遍历消息列表
- 支持 `--dry-run`,让你无需发送任何内容即可验证发送节奏/分类账
### 定位(最佳角度)
- 在不沦为垃圾邮件发送者(或泄露 webhook)的前提下推送更新:严格的发送节奏 + 审计跟踪。
### 文件
- `scripts/post_webhook.py`:Discord webhook POST 辅助工具(仅使用标准库)
- `scripts/ledger.py`:JSONL 分类账辅助工具(仅使用标准库)
- `scripts/promo_scheduler.py`:CLI 工具(仅使用标准库)
### 分类账
- 默认:`~/.openclaw/webhook-promo-ledger.jsonl`
- 覆盖:`--ledger-path /path/to/ledger.jsonl`
- JSONL 字段(每行):`date`、`channel`、`status`、`hash`
### 安全性
- CLI **拒绝打印** webhook URL。
- 日志会对任何可能出现的 webhook URL 进行脱敏处理。
- 建议:将 webhook 保存在私有频道中,泄露时进行轮换,并在启用实际发送前使用 `--dry-run`。
### 常见问题(安全)
**问:这会暴露 Discord webhook——这危险吗?**
答:把它当作密码来对待。本工具不会打印它,支持密钥注入,并提供 `--dry-run` + 分类账,让你在开启实际发送前验证行为。如果你想完全避免直接暴露,可在前面放置一个中继(Cloudflare Worker / Supabase Edge Function),并将真实的 webhook 保持私有。
### 用法
一次性发送:
```bash
python3 {baseDir}/scripts/promo_scheduler.py post \
--webhook-url <URL> \
--channel openclaw-discord \
--message "Hello from OpenClaw!"
```
草稿循环:
```bash
python3 {baseDir}/scripts/promo_scheduler.py rotate \
--webhook-url <URL> \
--channel openclaw-discord \
--messages-file messages.txt
```
`messages.txt` 格式:
- 每个非空行一条消息
- 以 `#` 开头的行将被忽略