Skip to content

Commit

Permalink
integration/streamlabs: Don't update users.tips and current tips if test
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Apr 9, 2018
1 parent f68755c commit 564e9c1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libs/integrations/streamlabs.js
Expand Up @@ -89,6 +89,10 @@ class Streamlabs {
debug('streamlabs:onEvent')(eventData)
if (eventData.type === 'donation') {
for (let event of eventData.message) {
if (!event.isTest) {
global.db.engine.insert('users.tips', { username: event.from.toLowerCase(), amount: event.amount, message: event.message, currency: event.currency, timestamp: _.now() })
if (await global.cache.isOnline()) await global.db.engine.increment('api.current', { key: 'tips' }, { value: parseFloat(global.currency.exchange(event.amount, event.currency, await global.configuration.getValue('currency'))) })
}
global.overlays.eventlist.add({
type: 'tip',
amount: event.amount,
Expand All @@ -97,8 +101,6 @@ class Streamlabs {
message: event.message
})
global.events.fire('tip', { username: event.from.toLowerCase(), amount: event.amount, message: event.message, currency: event.currency })
global.db.engine.insert('users.tips', { username: event.from.toLowerCase(), amount: event.amount, message: event.message, currency: event.currency, timestamp: _.now() })
if (await global.cache.isOnline()) await global.db.engine.increment('api.current', { key: 'tips' }, { value: parseFloat(global.currency.exchange(event.amount, event.currency, await global.configuration.getValue('currency'))) })
}
}
})
Expand Down

0 comments on commit 564e9c1

Please sign in to comment.