From 7e5f93d14dcad2669509e16370b74843910f52ee Mon Sep 17 00:00:00 2001 From: William Date: Mon, 29 Oct 2018 22:11:28 +0000 Subject: [PATCH 1/4] some refactoring --- notifier.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notifier.js b/notifier.js index a4cad4f..6f30dde 100644 --- a/notifier.js +++ b/notifier.js @@ -13,9 +13,9 @@ console.log(strings.READY); function getHQStatus() { setTimeout(() => { fetch('https://api-quiz.hype.space/shows/now?type=hq') - .then((response) => response.json()) - .then((json) => { - if (json.active == true) { + .then(response => response.json()) + .then(json => { + if(json.active == true) { console.log(strings.LIVE); notifier.notify({ title: strings.NOTIFIER_TITLE, From 357c21e3f01ac819717c310d078525ae6af2260f Mon Sep 17 00:00:00 2001 From: William Date: Mon, 29 Oct 2018 22:13:13 +0000 Subject: [PATCH 2/4] support for hq sports / further games (1/2) --- notifier.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/notifier.js b/notifier.js index 6f30dde..2120f8e 100644 --- a/notifier.js +++ b/notifier.js @@ -12,18 +12,18 @@ console.log(strings.READY); */ function getHQStatus() { setTimeout(() => { - fetch('https://api-quiz.hype.space/shows/now?type=hq') - .then(response => response.json()) - .then(json => { - if(json.active == true) { - console.log(strings.LIVE); - notifier.notify({ - title: strings.NOTIFIER_TITLE, - message: strings.NOTIFIER_MESSAGE, - icon: './assets/HQ.png', - }, () => process.exit(0)); - } else console.log(strings.NOT_LIVE); - }); + fetch(`https://api-quiz.hype.space/shows/now?type=${config.type}`).then(response => response.json()).then(json => { + if(json.active == true) { + console.log(strings.LIVE); + notifier.notify({ + title: strings.NOTIFIER_TITLE, + message: strings.NOTIFIER_MESSAGE, + icon: './assets/HQ.png', + }, () => process.exit(0)); + } else { + console.log(strings.NOT_LIVE); + } + }); getHQStatus(); }, config.interval * 1000); } From cdce9776f24e65559dc987f2fc9bf8e4f2f7f1cc Mon Sep 17 00:00:00 2001 From: William Date: Mon, 29 Oct 2018 22:15:06 +0000 Subject: [PATCH 3/4] support for hq sports / further games (2/2) --- config.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index a25700b..735fd6f 100644 --- a/config.json +++ b/config.json @@ -1,3 +1,4 @@ { - "interval": 1 -} \ No newline at end of file + "interval": 1, + "type": "hq" +} From c5370b636fb39417c3276b3403e3abcf84d557e2 Mon Sep 17 00:00:00 2001 From: Reed Date: Tue, 30 Oct 2018 08:10:07 -0400 Subject: [PATCH 4/4] Fix all test errors --- notifier.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notifier.js b/notifier.js index 2120f8e..d5ed735 100644 --- a/notifier.js +++ b/notifier.js @@ -12,8 +12,8 @@ console.log(strings.READY); */ function getHQStatus() { setTimeout(() => { - fetch(`https://api-quiz.hype.space/shows/now?type=${config.type}`).then(response => response.json()).then(json => { - if(json.active == true) { + fetch(`https://api-quiz.hype.space/shows/now?type=${config.type}`).then((response) => response.json()).then((json) => { + if (json.active == true) { console.log(strings.LIVE); notifier.notify({ title: strings.NOTIFIER_TITLE, @@ -21,7 +21,7 @@ function getHQStatus() { icon: './assets/HQ.png', }, () => process.exit(0)); } else { - console.log(strings.NOT_LIVE); + console.log(strings.NOT_LIVE); } }); getHQStatus();