-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.js
More file actions
24 lines (20 loc) · 697 Bytes
/
client.js
File metadata and controls
24 lines (20 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { onMessageHandler, onJoinedHandler, onPartedHandler, onWhisperHandler, onConnectedHandler } = require(`./handlers`)
// Create bot client
const tmi = require(`tmi.js`)
const BOT_USERNAME = process.env.BOT_USERNAME
const OAUTH_TOKEN = process.env.OAUTH_TOKEN
const { joinedChatrooms } = require(`./data`)
const opts = {
identity: {
username: BOT_USERNAME,
password: OAUTH_TOKEN
},
channels: joinedChatrooms
}
const client = new tmi.client(opts)
client.on(`connected`, onConnectedHandler)
client.on(`message`, onMessageHandler)
client.on(`join`, onJoinedHandler)
client.on(`part`, onPartedHandler)
client.on(`whisper`, onWhisperHandler)
module.exports = client