29
repo/js/等到4點/main.js
Normal file
29
repo/js/等到4點/main.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
(async function () {
|
||||||
|
setGameMetrics(1920, 1080, 2);
|
||||||
|
|
||||||
|
function getTimeUntilNext4AM() {
|
||||||
|
const now = new Date();
|
||||||
|
const next4AM = new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth(),
|
||||||
|
now.getDate(),
|
||||||
|
4, 0, 0, 0
|
||||||
|
);
|
||||||
|
|
||||||
|
// 如果現在時間已經過了今天的 4 點,則計算明天的 4 點
|
||||||
|
if (now >= next4AM) {
|
||||||
|
next4AM.setDate(next4AM.getDate() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return next4AM - now;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 執行
|
||||||
|
const timeUntilNext4AM = getTimeUntilNext4AM();
|
||||||
|
log.info(`等待 ${timeUntilNext4AM / 60000} 分鐘直到下一個 4 點…`);
|
||||||
|
// 多等待1分鐘
|
||||||
|
await sleep(timeUntilNext4AM + 60000);
|
||||||
|
log.info("時間到了!現在是 4 點。");
|
||||||
|
|
||||||
|
//1 分鐘 = 60000 毫秒
|
||||||
|
})();
|
||||||
16
repo/js/等到4點/manifest.json
Normal file
16
repo/js/等到4點/manifest.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 1,
|
||||||
|
"name": "等到4點", // 名称
|
||||||
|
"version": "1.0", // 版本
|
||||||
|
"bgi_version": "1.0", // 适用于 BetterGI 的最低版本,BetterGI低于此版本会提示
|
||||||
|
"description": "等到4點,用於等到第二天4點執行其他任務", // 描述
|
||||||
|
// 作者信息
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "蜜柑魚"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 入口文件
|
||||||
|
"main": "main.js"
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user