diff --git a/notobot.js b/notobot.js index ba20bff6fd612ab857ffd6bc635b3ed7b3d92cca..4cfb1810966359b680802ac1e77ef4ed1f2c9416 100644 --- a/notobot.js +++ b/notobot.js @@ -226,20 +226,25 @@ async function start(){ console.log("username, password ou webhook est manquant dans conf.json"); process.exit(-1); } - try{ - while(true){ + while(true){ + try{ + const date = new Date(); + console.log(`[START] \t => \t ${date.toLocaleTimeString('fr')} : ${date.toLocaleDateString('fr')}`); + const execution = await getExecution(); await login(execution); await lookForGrades(); + }catch(e){ + if(e.response && e.response.statusCode === 401){ + console.error('[ERROR 401] -> Bad password / username ?'); + }else{ + console.error(e); + } + }finally{ await new Promise(resolve => setTimeout(resolve,1000*60*15)); //Attente de 15 min } - }catch(e){ - if(e.response && e.response.statusCode === 401){ - console.error('[ERROR 401] -> Bad password / username ?'); - }else{ - console.error(e); - } } + } start();