// Daily Global News Summary Job // Runs every day at 7:30 AM Beijing time // Sends news to: Yaxing_feng@dgmaorui.com const { web_search } = require('./tools'); const { message } = require('./tools'); async function getDailyNews() { try { // Search for today's global news const news = await web_search({ query: '2026年2月2日 全球新闻 重大事件', count: 10 }); return news; } catch (error) { console.error('Error fetching news:', error); return null; } } async function sendNewsEmail(news) { try { // Format news summary const summary = formatNewsSummary(news); // Send email (this would use your email service) // For now, we'll log the summary console.log('Daily News Summary for Yaxing_feng@dgmaorui.com:'); console.log(summary); // TODO: Integrate with email service // await sendEmail({ // to: 'Yaxing_feng@dgmaorui.com', // subject: '每日全球新闻摘要', // body: summary // }); } catch (error) { console.error('Error sending email:', error); } } function formatNewsSummary(news) { // Format news into readable summary let summary = '📅 每日全球新闻摘要\n\n'; summary += `日期: ${new Date().toLocaleDateString('zh-CN')}\n\n`; if (news && news.results) { news.results.forEach((item, index) => { summary += `${index + 1}. ${item.title}\n`; summary += ` ${item.description}\n\n`; }); } summary += '\n---\n'; summary += '此邮件由 OpenClaw 自动发送'; return summary; } // Main function async function main() { console.log('Starting daily news job...'); const news = await getDailyNews(); if (news) { await sendNewsEmail(news); console.log('Daily news job completed successfully'); } else { console.log('Failed to fetch news'); } } // Export for cron job module.exports = { main };