Skill: jiajiaoy/daily-history (version 1.0.2)

--- name: daily-history description: "Today in history — 3–5 major events on this date with context and lasting impact. Bilingual EN/CN timeline card. Daily morning push." keywords: - 历史上的今天 - 今天发生了什么 - 历史事件 - 大事记 - 历史 - on this day - today in history - this day in history - historical events today - history timeline - world history - China history metadata: openclaw: runtime: node: ">=18" --- # Today in History / 历史上的今天 Generate a beautiful visual timeline of significant historical events that happened on today's date. ## Workflow 1. **Get today's date** — Determine the month and day. 2. **Search for events** — Use `web_search` to find 5-6 notable events that happened on this date across different centuries and categories. Query: `"on this day [month] [day] history events"`. Try to cover: science/tech, politics, culture, sports, and notable births/deaths. 3. **Curate and translate** — Select the 5 most interesting/diverse events. Write each as a concise 1-2 sentence description in both English and Chinese. 4. **Generate the visual** — Create a single-file HTML artifact. ## Visual Design Requirements Create a vertical timeline layout, full-viewport: - **Layout**: Vertical timeline with alternating left-right event cards. Timeline line runs down the center. Year markers on the timeline. - **Typography**: Use a distinguished font pair — a bold condensed display font for years (e.g., Oswald, Bebas Neue) and an elegant body font for descriptions (e.g., Source Serif Pro, Lora). - **Color scheme**: Deep, rich palette — think aged paper tones, or a modern editorial look with dark backgrounds and gold/amber accents. Rotate themes. - **Event cards**: Each card has: Year (large), Event title (bold), Description (EN + CN), and a category icon (emoji: 🔬 science, 🏛️ politics, 🎨 culture, ⚽ sports, 👤 people). - **Animation**: Cards should fade and slide in on load with staggered delays. Timeline line draws itself downward. - **Header**: "历史上的今天 / Today in History" with today's full date (e.g., "April 2 / 4月2日"). - **Ad-ready zone**: `<div id="ad-slot-middle">` between 3rd and 4th event (min-height 90px, centered). `<div id="ad-slot-bottom">` at page bottom. - **Footer**: "Powered by ClawCode" at bottom. ## Content Guidelines - Mix different centuries — don't cluster in one era - Include at least one event relevant to China or Asia - Include at least one science/technology event - Keep descriptions concise but vivid — make history feel alive ## Output Save as `/mnt/user-data/outputs/daily-history.html` and present to user. --- ## 推送管理 ```bash # 开启每日推送（早晚各一次） node scripts/push-toggle.js on <userId> # 自定义时间和渠道 node scripts/push-toggle.js on <userId> --morning 08:00 --evening 20:00 --channel feishu # 关闭推送 node scripts/push-toggle.js off <userId> # 查看推送状态 node scripts/push-toggle.js status <userId> ``` 支持渠道：`telegram` / `feishu` / `slack` / `discord`

path: README.md
content: # Daily History — Today in History Skill

> Significant events that happened on this date in history — bilingual EN/CN visual timeline.

[![clawhub](https://img.shields.io/badge/clawhub-daily--history-blue)](https://clawhub.ai/skills/daily-history)
[![openclaw](https://img.shields.io/badge/openclaw-skill-orange)](https://openclaw.ai)

## What it does

Daily History surfaces the most significant events that occurred on today's date throughout history — wars, discoveries, births, political milestones, natural disasters — presented as a beautiful bilingual timeline.

**Morning push** — 3–5 major historical events for today's date  
**Context** — why each event mattered and its lasting impact  
**Bilingual** — Chinese and English output  
**Visual** — timeline card format for easy sharing

## Installation

```bash
openclaw install daily-history
```

## Usage

```bash
openclaw run daily-history morning
openclaw run daily-history evening
```

## Keywords

today in history · this day in history · on this day · historical events · daily history · history facts · 历史上的今天 · 今天发生了什么 · 大事记 · 历史事件

---

Built for [OpenClaw](https://openclaw.ai) · Published on [clawhub.ai](https://clawhub.ai/skills/daily-history)


path: scripts/evening-push.js
content: #!/usr/bin/env node
'use strict';
const fs=require('fs'),path=require('path');
const USERS_DIR=path.join(__dirname,'../data/users');
const VOCAB_THEMES=["情感词汇", "科学词汇", "艺术文化", "商业词汇", "自然生态", "哲学词汇", "日常生活"];
function sanitizeId(v){if(typeof v!=='string'||!/^[a-zA-Z0-9_-]{1,128}$/.test(v)){console.error('❌ 无效userId');process.exit(1);}return v;}
function safeUserPath(u){const r=path.resolve(USERS_DIR,u+'.json');if(!r.startsWith(path.resolve(USERS_DIR)+path.sep)){console.error('❌ 非法路径');process.exit(1);}return r;}
function loadUser(u){const f=safeUserPath(u);return fs.existsSync(f)?JSON.parse(fs.readFileSync(f,'utf8')):{}}
const userId=sanitizeId(process.argv[2]||'default');
loadUser(userId);
const now=new Date();
const WEEKDAYS=['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
const MONTHS_EN=['January','February','March','April','May','June','July','August','September','October','November','December'];
const wd=now.getDay();
const date=`${now.getFullYear()}-${String(now.getMonth()+1).padStart(2,'0')}-${String(now.getDate()).padStart(2,'0')}`;
const weekday=WEEKDAYS[wd];
const month=now.getMonth()+1;
const day=now.getDate();
const month_en=MONTHS_EN[now.getMonth()];
const tomorrow_weekday=WEEKDAYS[(wd+1)%7];
const vocab_theme=VOCAB_THEMES[wd];
const tomorrow_vocab_theme=VOCAB_THEMES[(wd+1)%7];
console.log(`今日历史深读（${month}月${day}日）：从今天的历史事件中选1个最值得深挖的，进行深度回顾。搜索详细资料，呈现：事件背景、关键经过、历史影响、现代启示。中英双语，800字以内，叙事生动。`);


path: scripts/morning-push.js
content: #!/usr/bin/env node
'use strict';
const fs=require('fs'),path=require('path');
const USERS_DIR=path.join(__dirname,'../data/users');
const VOCAB_THEMES=["情感词汇", "科学词汇", "艺术文化", "商业词汇", "自然生态", "哲学词汇", "日常生活"];
function sanitizeId(v){if(typeof v!=='string'||!/^[a-zA-Z0-9_-]{1,128}$/.test(v)){console.error('❌ 无效userId');process.exit(1);}return v;}
function safeUserPath(u){const r=path.resolve(USERS_DIR,u+'.json');if(!r.startsWith(path.resolve(USERS_DIR)+path.sep)){console.error('❌ 非法路径');process.exit(1);}return r;}
function loadUser(u){const f=safeUserPath(u);return fs.existsSync(f)?JSON.parse(fs.readFileSync(f,'utf8')):{}}
const userId=sanitizeId(process.argv[2]||'default');
loadUser(userId);
const now=new Date();
const WEEKDAYS=['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
const MONTHS_EN=['January','February','March','April','May','June','July','August','September','October','November','December'];
const wd=now.getDay();
const date=`${now.getFullYear()}-${String(now.getMonth()+1).padStart(2,'0')}-${String(now.getDate()).padStart(2,'0')}`;
const weekday=WEEKDAYS[wd];
const month=now.getMonth()+1;
const day=now.getDate();
const month_en=MONTHS_EN[now.getMonth()];
const tomorrow_weekday=WEEKDAYS[(wd+1)%7];
const vocab_theme=VOCAB_THEMES[wd];
const tomorrow_vocab_theme=VOCAB_THEMES[(wd+1)%7];
console.log(`请搜索历史上的今天 ${month}月${day}日 相关内容，生成历史上的今天推送。选取5个跨越不同年代、不同领域的事件，每条含年份、标题（中英）、2句描述。至少含1个中国/亚洲事件、1个科技事件。`);


path: scripts/push-toggle.js
content: #!/usr/bin/env node
'use strict';
const fs=require('fs'),path=require('path');
const SKILL='daily-history',DEFAULT_MORNING='08:00',DEFAULT_EVENING='20:00';
const USERS_DIR=path.join(__dirname,'../data/users');
const ALLOWED_CH=new Set(['telegram','feishu','slack','discord']);
function sanitizeId(v){if(typeof v!=='string'||!/^[a-zA-Z0-9_-]{1,128}$/.test(v)){console.error('❌ 无效userId');process.exit(1);}return v;}
function sanitizeTime(v,l){if(!/^\d{1,2}:\d{2}$/.test(v)){console.error('❌ 无效'+l);process.exit(1);}const[h,m]=v.split(':').map(Number);if(h>23||m>59){console.error('❌ 无效'+l);process.exit(1);}return{h,m};}
function safeUserPath(u){const r=path.resolve(USERS_DIR,u+'.json');if(!r.startsWith(path.resolve(USERS_DIR)+path.sep)){console.error('❌ 非法路径');process.exit(1);}return r;}
function loadUser(u){const f=safeUserPath(u);return fs.existsSync(f)?JSON.parse(fs.readFileSync(f,'utf8')):{}}
function saveUser(u,d){fs.mkdirSync(USERS_DIR,{recursive:true});fs.writeFileSync(safeUserPath(u),JSON.stringify(d,null,2),'utf8');}
function enablePush(userId,opts){
  userId=sanitizeId(userId);
  const user=loadUser(userId);
  const mt=opts.morning||user.morningTime||DEFAULT_MORNING;
  const et=opts.evening||user.eveningTime||DEFAULT_EVENING;
  const{h:mh,m:mm}=sanitizeTime(mt,'--morning');
  const{h:eh,m:em}=sanitizeTime(et,'--evening');
  const ch=opts.channel||user.channel||'telegram';
  if(!ALLOWED_CH.has(ch)){console.error('❌ 不支持渠道:'+ch);process.exit(1);}
  const sk=`agent:main:${ch}:direct:${userId}`;
  console.log('__OPENCLAW_CRON_ADD__:'+JSON.stringify({name:`${SKILL}-morning-${userId}`,cronExpr:`${mm} ${mh} * * *`,tz:'Asia/Shanghai',session:'isolated',sessionKey:sk,channel:ch,to:userId,announce:true,timeoutSeconds:180,message:`node ${path.join(__dirname,'morning-push.js')} ${userId}`}));
  console.log('__OPENCLAW_CRON_ADD__:'+JSON.stringify({name:`${SKILL}-evening-${userId}`,cronExpr:`${em} ${eh} * * *`,tz:'Asia/Shanghai',session:'isolated',sessionKey:sk,channel:ch,to:userId,announce:true,timeoutSeconds:180,message:`node ${path.join(__dirname,'evening-push.js')} ${userId}`}));
  saveUser(userId,{...user,morningTime:mt,eveningTime:et,channel:ch,pushEnabled:true,updatedAt:new Date().toISOString()});
  console.log(`\n✅ ${SKILL} 推送已开启\n⏰ 早推: ${mt}  🌙 晚推: ${et}  📡 渠道: ${ch}\n关闭: node push-toggle.js off ${userId}`);
}
function disablePush(userId){
  userId=sanitizeId(userId);
  console.log(`__OPENCLAW_CRON_RM__:${SKILL}-morning-${userId}`);
  console.log(`__OPENCLAW_CRON_RM__:${SKILL}-evening-${userId}`);
  const user=loadUser(userId);
  saveUser(userId,{...user,pushEnabled:false,updatedAt:new Date().toISOString()});
  console.log(`✅ ${SKILL} 推送已关闭`);
}
function showStatus(userId){
  userId=sanitizeId(userId);
  const u=loadUser(userId);
  console.log(`\n📡 ${SKILL} — ${userId}\n状态: ${u.pushEnabled?'✅ 开启':'❌ 关闭'}  早推: ${u.morningTime||DEFAULT_MORNING}  晚推: ${u.eveningTime||DEFAULT_EVENING}  渠道: ${u.channel||'telegram'}\n`);
}
if(require.main!==module)return;
const[cmd,uid,...rest]=process.argv.slice(2);
if(!cmd||!uid){console.log('用法: node push-toggle.js on|off|status <userId>');process.exit(1);}
const opts={};
const mi=rest.indexOf('--morning');if(mi!==-1)opts.morning=rest[mi+1];
const ei=rest.indexOf('--evening');if(ei!==-1)opts.evening=rest[ei+1];
const ci=rest.indexOf('--channel');if(ci!==-1)opts.channel=rest[ci+1];
if(cmd==='on')enablePush(uid,opts);
else if(cmd==='off')disablePush(uid);
else if(cmd==='status')showStatus(uid);
else{console.error('❌ 未知命令:'+cmd);process.exit(1);}


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)