Skip to content

Commit

Permalink
lib/twitch: Fix undefined currency on !top tips
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Apr 7, 2018
1 parent 513c58e commit 11053a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/twitch.js
Expand Up @@ -304,7 +304,7 @@ class Twitch {
let tips = await global.db.engine.find('users.tips')
for (let tip of tips) {
if (_.isNil(sorted[tip.username])) sorted[tip.username] = { username: tip.username, amount: 0 }
sorted[tip.username].amount += global.currency.exchange(tip.amount, tip.currency, global.configuration.getValue('currency'))
sorted[tip.username].amount += global.currency.exchange(tip.amount, tip.currency, await global.configuration.getValue('currency'))
}
sorted = _.orderBy(sorted, 'amount', 'desc')
} else {
Expand All @@ -324,9 +324,9 @@ class Twitch {

sorted = _.chunk(sorted, 10)[0]
for (let user of sorted) {
message += (i + 1) + '. ' + (global.configuration.getValue('atUsername') ? '@' : '') + user.username + ' - '
message += (i + 1) + '. ' + (await global.configuration.getValue('atUsername') ? '@' : '') + user.username + ' - '
if (type === 'time') message += (user.time.watched / 1000 / 60 / 60).toFixed(1) + 'h'
else if (type === 'tips') message += user.amount.toFixed(2) + global.currency.symbol(global.configuration.getValue('currency'))
else if (type === 'tips') message += user.amount.toFixed(2) + global.currency.symbol(await global.configuration.getValue('currency'))
else if (type === 'points') message += user.points + ' ' + await global.systems.points.getPointsName(user.points)
else message += user.stats.messages
if (i + 1 < 10 && !_.isNil(sorted[i + 1])) message += ', '
Expand Down

0 comments on commit 11053a2

Please sign in to comment.