Fixed bug on undefined title/artist
This commit is contained in:
parent
d2ebf282aa
commit
4020faec13
1 changed files with 3 additions and 4 deletions
7
index.js
7
index.js
|
@ -96,8 +96,7 @@ if (!process.env.STREAM_TYPE || process.env.STREAM_TYPE === 'radio') {
|
|||
request({
|
||||
method: 'GET',
|
||||
url: process.env.STREAM_URL
|
||||
},
|
||||
(error, response, body) => {
|
||||
}, (error, response, body) => {
|
||||
if (!error && response.statusCode === 200) {
|
||||
try {
|
||||
const res = JSON.parse(process.env.STREAM_PARSE ? body.replace('updateFromMediaItem(', '').replace(');', '') : body)
|
||||
|
@ -138,7 +137,7 @@ if (!process.env.STREAM_TYPE || process.env.STREAM_TYPE === 'radio') {
|
|||
break
|
||||
}
|
||||
|
||||
if (previousSong.title !== currentSong.title && previousSong.artist !== currentSong.artist) {
|
||||
if (currentSong.title && currentSong.artist && previousSong.title !== currentSong.title && previousSong.artist !== currentSong.artist) {
|
||||
checkCurrentSong()
|
||||
}
|
||||
} catch (e) {
|
||||
|
@ -301,7 +300,7 @@ bot.addListener('pm', function (from, to, message) {
|
|||
// Say hello!
|
||||
if (process.env.SAY_HELLO && process.env.SAY_HELLO === 'true') {
|
||||
bot.addListener('join', (channel, who) => {
|
||||
// Welcome them in!
|
||||
// Welcome them in!
|
||||
if (who !== process.env.IRC_NICKNAME) {
|
||||
botSay(process.env.IRC_CHANNEL, 'Hello ' + who + '! Have a metal day! \\m/(-.-)\\m/', true, true)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue