Skip to content

Commit

Permalink
Merge pull request #6 from williamsthing/patch-1
Browse files Browse the repository at this point in the history
some refactoring
  • Loading branch information
plusreed authored Oct 30, 2018
2 parents 7cb0009 + c5370b6 commit 2d6e3b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
5 changes: 3 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"interval": 1
}
"interval": 1,
"type": "hq"
}
24 changes: 12 additions & 12 deletions notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 2d6e3b1

Please sign in to comment.