Skip to content

Commit

Permalink
lib/events: Fix check of stream-is-running-x-minutes
Browse files Browse the repository at this point in the history
_ref: #854
  • Loading branch information
sogehige committed Mar 21, 2018
1 parent 1a6c005 commit a51e218
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/events.js
Expand Up @@ -238,10 +238,10 @@ class Events {

async checkStreamIsRunningXMinutes (event, attributes) {
const d = debug('events:checkStreamIsRunningXMinutes')
const when = await global.twitch.when()
event.triggered.runAfterXMinutes = _.get(event, 'triggered.runAfterXMinutes', 0)

let shouldTrigger = event.triggered.runAfterXMinutes === 0 &&
moment(global.twitch.when.online).format('X') * 1000 > event.definitions.runAfterXMinutes * 60 * 1000
moment().format('X') - moment(when.online).format('X') > event.definitions.runAfterXMinutes * 60
if (shouldTrigger) {
event.triggered.runAfterXMinutes = event.definitions.runAfterXMinutes
d('Updating event to %j', event)
Expand Down

0 comments on commit a51e218

Please sign in to comment.