[calendar] more resistant bot
This commit is contained in:
parent
64f24b73a7
commit
473af7cf4d
|
@ -80,9 +80,14 @@ const timer = ms => new Promise( res => setTimeout(res, ms));
|
||||||
console.log('------------');
|
console.log('------------');
|
||||||
console.log(locales[locale].name);
|
console.log(locales[locale].name);
|
||||||
|
|
||||||
|
try {
|
||||||
const { day, message, image } = await (await fetch(locales[locale].url + '/api/calendar/today')).json();
|
const { day, message, image } = await (await fetch(locales[locale].url + '/api/calendar/today')).json();
|
||||||
console.log('<<<', message, '>>>');
|
console.log('<<<', message, '>>>');
|
||||||
if (!message) { continue; }
|
if (!message) { continue; }
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
fs.writeFileSync(imageTmpPath, Buffer.from(await (await fetch(image)).arrayBuffer()), {encoding: 'binary'});
|
fs.writeFileSync(imageTmpPath, Buffer.from(await (await fetch(image)).arrayBuffer()), {encoding: 'binary'});
|
||||||
let imageStream = null;
|
let imageStream = null;
|
||||||
|
|
Reference in New Issue