mirror of
https://github.com/streamwall/streamwall.git
synced 2026-01-27 15:32:48 -05:00
Add configurable dwell delay to Twitch bot
This commit is contained in:
@@ -20,6 +20,7 @@ export default class TwitchBot extends EventEmitter {
|
||||
|
||||
this.streams = null
|
||||
this.listeningURL = null
|
||||
this.dwellTimeout = null
|
||||
this.announceTimeouts = new Map()
|
||||
|
||||
client.on('ready', () => {
|
||||
@@ -70,10 +71,14 @@ export default class TwitchBot extends EventEmitter {
|
||||
this.onListeningURLChange(listeningURL)
|
||||
}
|
||||
|
||||
async onListeningURLChange(listeningURL) {
|
||||
if (!this.announceTimeouts.has(listeningURL)) {
|
||||
await this.announce()
|
||||
}
|
||||
onListeningURLChange(listeningURL) {
|
||||
const { announce } = this.config
|
||||
clearTimeout(this.dwellTimeout)
|
||||
this.dwellTimeout = setTimeout(() => {
|
||||
if (!this.announceTimeouts.has(listeningURL)) {
|
||||
this.announce()
|
||||
}
|
||||
}, announce.delay * 1000)
|
||||
}
|
||||
|
||||
async announce() {
|
||||
|
||||
Reference in New Issue
Block a user