-
Notifications
You must be signed in to change notification settings - Fork 0
/
Douchon.js
42 lines (35 loc) · 962 Bytes
/
Douchon.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//Douchon
var Bot = require('ttapi');
var repl = require('repl');
var AUTH = 'xxxxxxxxxxxxxxxxxxxxxxxx';
var USERID = 'xxxxxxxxxxxxxxxxxxxxxxxx';
var ROOMID = 'xxxxxxxxxxxxxxxxxxxxxxxx';
var bot = new Bot(AUTH, USERID, ROOMID);
repl.start('> ').context.bot = bot;
bot.on('ready', function (data) { });
bot.on('roomChanged', function (data) { });
bot.on('speak', function (data) { });
bot.on('update_votes', function (data) { });
bot.on('registered', function (data) { });
function sleep(milliseconds) {
var start = new Date().getTime();
while(new Date().getTime() < start + milliseconds) {
//do nothing
}
}
//autobop
bot.on('newsong', function (data) {
sleep( 50000 );
bot.vote('up');
});
bot.on('pmmed', function (data) {
if (data.text.match('/up')) {
bot.vote('up');
}
if (data.text.match('/down')) {
bot.vote('down');
}
if (data.text.match('/gank')) {
bot.snag();
}
});