Update smzdm_task.js

This commit is contained in:
Hex
2023-11-17 16:52:21 +08:00
parent 2eabfcab6c
commit cbd5fdcfb1

View File

@@ -1557,48 +1557,50 @@ class SmzdmTaskBot extends SmzdmBot {
} }
} }
!(async () => { if (require.main === module) {
const cookies = getEnvCookies(); !(async () => {
const cookies = getEnvCookies();
if (cookies === false) { if (cookies === false) {
$.log('\n请先设置 SMZDM_COOKIE 环境变量'); $.log('\n请先设置 SMZDM_COOKIE 环境变量');
return; return;
}
let notifyContent = '';
for (let i = 0; i < cookies.length; i++) {
const cookie = cookies[i];
if (!cookie) {
continue;
} }
if (i > 0) { let notifyContent = '';
$.log();
await wait(10, 30); for (let i = 0; i < cookies.length; i++) {
$.log(); const cookie = cookies[i];
if (!cookie) {
continue;
}
if (i > 0) {
$.log();
await wait(10, 30);
$.log();
}
const sep = `\n****** 账号${i + 1} ******\n`;
$.log(sep);
const bot = new SmzdmTaskBot(cookie);
const msg = await bot.run();
notifyContent += `${sep}${msg}\n`;
} }
const sep = `\n****** 账号${i + 1} ******\n`; $.log();
$.log(sep); await notify.sendNotify($.name, notifyContent);
})().catch((e) => {
const bot = new SmzdmTaskBot(cookie); $.log('', `${$.name}, 失败! 原因: ${e}!`, '')
const msg = await bot.run(); }).finally(() => {
$.done();
notifyContent += `${sep}${msg}\n`; });
} }
$.log();
await notify.sendNotify($.name, notifyContent);
})().catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
}).finally(() => {
$.done();
});
module.exports = { module.exports = {
SmzdmTaskBot, SmzdmTaskBot,