-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbtt.js
23 lines (18 loc) · 809 Bytes
/
btt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const { Btt } = require('btt');
const http = require('http')
const sleep = require('await-sleep')
const btt = new Btt({
domain: process.env.BTT_SERVER_HOST,
port: process.env.BTT_SERVER_PORT,
protocol: 'http',
version: '2.525',
});
//! NOTE it seems to be very unstable. Use another approach
const announceWinner = async (points) => {
await btt.showHUD({ title: points[0], content: 'player 1', duration: 2, background: '(0,0,0)',}).invoke()
await sleep(3000)
await btt.showHUD({ title: points[1], content: 'player 2' ,duration: 2,background: '(0,0,0)' }).invoke()
await sleep(3000)
await btt.showHUD({ title: 'Player '+points[0]>points[1] ? '1' : '2', content: 'is the winner of round 1!', duration: 4, background: '(0,0,0)' }).invoke()
}
module.exports.announceWinner = announceWinner