Skip to content

Commit

Permalink
system/songs: Fix $currentSong always undefined
Browse files Browse the repository at this point in the history
Fixes: #1297
  • Loading branch information
sogehige committed Sep 10, 2018
1 parent d13ec03 commit cccceaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/bot/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class Message {
song.artist = song.artist.replace(new RegExp(opts.escape, 'g'), `\\${opts.escape}`)
}
this.message = this.message.replace(/\$currentSong/g, format.replace(/\$song/g, song.song).replace(/\$artist/g, song.artist))
} else if (global.commons.isSystemEnabled('songs')) {
let currentSong = _.get(await global.systems.songs.currentSong, 'title', global.translate('songs.not-playing'))
} else if (await global.systems.songs.isEnabled()) {
let currentSong = _.get(JSON.parse(await global.systems.songs.settings._.currentSong), 'title', global.translate('songs.not-playing'))
if (opts.escape) {
currentSong = currentSong.replace(new RegExp(opts.escape, 'g'), `\\${opts.escape}`)
}
Expand Down
4 changes: 2 additions & 2 deletions src/bot/systems/songs.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class Songs extends System {
let currentSong = sr
currentSong.volume = await this.getVolume(currentSong)
currentSong.type = 'songrequests'
this.currentSong = JSON.stringify(currentSong)
this.settings._.currentSong = JSON.stringify(currentSong)

if (await this.settings.notify) this.notifySong()
this.socket.emit('videoID', currentSong)
Expand Down Expand Up @@ -262,7 +262,7 @@ class Songs extends System {
let currentSong = pl
currentSong.volume = await this.getVolume(currentSong)
currentSong.type = 'playlist'
this.currentSong = JSON.stringify(currentSong)
this.settings._.currentSong = JSON.stringify(currentSong)

if (await this.settings.notify) this.notifySong()

Expand Down

0 comments on commit cccceaa

Please sign in to comment.