[calendar] fix bot
This commit is contained in:
parent
33117d54dc
commit
49e7346713
|
@ -84,26 +84,25 @@ const timer = ms => new Promise( res => setTimeout(res, ms));
|
|||
const { day, message, image } = await (await fetch(locales[locale].url + '/api/calendar/today')).json();
|
||||
console.log('<<<', message, '>>>');
|
||||
if (!message) { continue; }
|
||||
|
||||
fs.writeFileSync(imageTmpPath, Buffer.from(await (await fetch(image)).arrayBuffer()), {encoding: 'binary'});
|
||||
let imageStream = null;
|
||||
try {
|
||||
imageStream = fs.createReadStream(imageTmpPath);
|
||||
} catch {}
|
||||
|
||||
for (let publisher of process.argv[3].split(',')) {
|
||||
console.log('Publishing: ' + publisher);
|
||||
const postId = await publishers[publisher](
|
||||
message,
|
||||
imageStream,
|
||||
lastPostId[publisher]
|
||||
);
|
||||
console.log(postId);
|
||||
lastPostId[publisher] = postId;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
continue;
|
||||
}
|
||||
|
||||
fs.writeFileSync(imageTmpPath, Buffer.from(await (await fetch(image)).arrayBuffer()), {encoding: 'binary'});
|
||||
let imageStream = null;
|
||||
try {
|
||||
imageStream = fs.createReadStream(imageTmpPath);
|
||||
} catch {}
|
||||
|
||||
for (let publisher of process.argv[3].split(',')) {
|
||||
console.log('Publishing: ' + publisher);
|
||||
const postId = await publishers[publisher](
|
||||
message,
|
||||
imageStream,
|
||||
lastPostId[publisher]
|
||||
);
|
||||
console.log(postId);
|
||||
lastPostId[publisher] = postId;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
Reference in New Issue