function sendGoodnight() { var currentTime = new Date(); var hours = currentTime.getHours();

if (hours >= 0 && hours < 6) { return '夜深了,早点休息哦~'; } else if (hours >= 6 && hours < 12) { return '起床啦,新的一天又开始啦!'; } else if (hours >= 12 && hours < 18) { return '午后的阳光真好,不过也该休息啦~'; } else { return '晚安啦,好梦!'; } }

// 调用函数并发送晚安信息 sendGoodnight();


原文地址: https://www.cveoy.top/t/topic/m1r6 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录