donate notify not fin
This commit is contained in:
@@ -4,12 +4,19 @@ const DB = require('@libs/database')
|
||||
const {
|
||||
msgSplit
|
||||
} = require('./parser')
|
||||
const event = require('@root/event')
|
||||
|
||||
class WS {
|
||||
constructor () {
|
||||
/** @type {WebSocket} */
|
||||
this.ws = null
|
||||
this.join = []
|
||||
event.on('twitchJoin', (channel) => {
|
||||
this.joinChannel(channel)
|
||||
})
|
||||
event.on('twitchSend', data => {
|
||||
this.sendMsg(data.channel, data.message)
|
||||
})
|
||||
}
|
||||
|
||||
runBot () {
|
||||
@@ -89,6 +96,7 @@ class WS {
|
||||
joinChannel (channel = null) {
|
||||
if (this.ws === null || !('send' in this.ws) || typeof this.ws.send !== 'function') return null
|
||||
if (channel === null || typeof channel !== 'string' || channel.trim().length === 0) return null
|
||||
if (this.join.indexOf(channel) !== -1) return null
|
||||
this.ws.send(`JOIN #${channel.trim()}`)
|
||||
this.join.push(channel.trim())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user