@livecord/notify
Advanced tools
Comparing version 1.0.9 to 1.1.0
const { Twitch } = require('../src/index'); | ||
const twitch = new Twitch({ | ||
const twitch = new Twitch({ | ||
client: { | ||
id: 'YOUR_CLIENT_ID', // Your client ID | ||
token: 'YOUR_TOKEN_HERE', // https://dev.twitch.tv/docs/authentication/getting-tokens | ||
id: "0w3w9kd3xgome2t3kybau47z9lhza9", | ||
token: "xgo7bj4lydp649bgl8qmw02ozcusas" | ||
}, | ||
interval: 1000, // check channels every 1000ms (1 second) (optional) (default: 60000 [60 seconds])]) | ||
useDatabase: true // use database to store videos (optional) (default: true) | ||
useDatabase: true, | ||
interval: 1000 | ||
}); | ||
twitch.on('ready', (ready) => { | ||
console.log('Twitch connected at: ', twitch.channels); | ||
twitch.follow('rraenee'); | ||
console.log('Twitch connected at: ', ready); | ||
}); | ||
@@ -14,0 +15,0 @@ |
@@ -1,1 +0,1 @@ | ||
{"channels":["clqu_","jrokezftw"]} | ||
{"channels":["clqu_","jrokezftw","rraenee"]} |
{ | ||
"name": "@livecord/notify", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "Notifier for Youtube and Twitch.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -52,3 +52,3 @@ const EventEmitter = require('events'); | ||
let isLive = request.data[0]; | ||
let findLive = this.lives.find(element => element.user_login === channel); | ||
let findLive = this.lives.find(element => element.user_login === channel?.toLowerCase()); | ||
if(isLive && isLive.type === 'live') { | ||
@@ -77,3 +77,3 @@ if(findLive) return; | ||
if (typeof channel === 'string') { | ||
if (this.channels.includes(channel)) return; | ||
if (this.channels.includes(channel?.toLowerCase())) return; | ||
if (this.useDatabase) { | ||
@@ -83,12 +83,12 @@ fs.writeFileSync('livecord-twitch.json', JSON.stringify({ | ||
...JSON.parse(fs.readFileSync('livecord-twitch.json'))?.channels, | ||
channel | ||
channel?.toLowerCase() | ||
], | ||
}, 2, null)); | ||
return this.channels.push(channel); | ||
return this.channels.push(channel?.toLowerCase()); | ||
} else { | ||
return this.channels.push(channel); | ||
return this.channels.push(channel?.toLowerCase()); | ||
} | ||
} else if (Array.isArray(channel)) { | ||
channel.forEach(c => { | ||
if (this.channels.includes(c)) return; | ||
if (this.channels.includes(c?.toLowerCase())) return; | ||
if (this.useDatabase) { | ||
@@ -98,8 +98,8 @@ fs.writeFileSync('livecord-twitch.json', JSON.stringify({ | ||
...JSON.parse(fs.readFileSync('livecord-twitch.json'))?.channels, | ||
c | ||
c?.toLowerCase() | ||
], | ||
}, 2, null)); | ||
return this.channels.push(c); | ||
return this.channels.push(c?.toLowerCase()); | ||
} else { | ||
return this.channels.push(c); | ||
return this.channels.push(c?.toLowerCase()); | ||
} | ||
@@ -114,25 +114,25 @@ }) | ||
if (typeof channel === 'string') { | ||
if (!this.channels.includes(channel)) return; | ||
if (!this.channels.includes(channel?.toLowerCase())) return; | ||
if (this.useDatabase) { | ||
this.channels = this.channels.filter(el => el !== channel); | ||
this.channels = this.channels.filter(el => el !== channel?.toLowerCase()); | ||
return fs.writeFileSync('livecord-twitch.json', JSON.stringify({ | ||
channels: [ | ||
...JSON.parse(fs.readFileSync('livecord-twitch.json'))?.channels?.filter(el => el !== channel) | ||
...JSON.parse(fs.readFileSync('livecord-twitch.json'))?.channels?.filter(el => el !== channel?.toLowerCase()) | ||
], | ||
}, 2, null)); | ||
} else { | ||
return this.channels = this.channels.filter(el => el !== channel); | ||
return this.channels = this.channels.filter(el => el !== channel?.toLowerCase()); | ||
} | ||
} else if (Array.isArray(channel)) { | ||
} else if (Array.isArray(channel?.toLowerCase())) { | ||
channel.forEach(c => { | ||
if (!this.channels.includes(c)) return; | ||
if (!this.channels.includes(c?.toLowerCase())) return; | ||
if (this.useDatabase) { | ||
this.channels = this.channels.filter(el => el !== c); | ||
this.channels = this.channels.filter(el => el !== c?.toLowerCase()); | ||
return fs.writeFileSync('livecord-twitch.json', JSON.stringify({ | ||
channels: [ | ||
...JSON.parse(fs.readFileSync('livecord-twitch.json'))?.channels?.filter(el => el !== c) | ||
...JSON.parse(fs.readFileSync('livecord-twitch.json'))?.channels?.filter(el => el !== c?.toLowerCase()) | ||
], | ||
}, null, 2)); | ||
} else { | ||
return this.channels = this.channels.filter(el => el !== c); | ||
return this.channels = this.channels.filter(el => el !== c?.toLowerCase()); | ||
} | ||
@@ -139,0 +139,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18590
325