forked from Cretiino/bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatBotMaster
More file actions
43 lines (40 loc) · 1.72 KB
/
ChatBotMaster
File metadata and controls
43 lines (40 loc) · 1.72 KB
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
43
API.on(API.CHAT,onChat);
API.on(API.DJ_ADVANCE,onDjAdv);
API.sendChat('ChatBot on!');
var song;
if (API.getDJs().length == 0) API.on(API.DJ_UPDATE,djUpdate);
else song = API.getMedia().author + ' - ' + API.getMedia().title;
function onChat(data) {
if (API.hasPermission(data.fromID,API.ROLE.BOUNCER)) {
var message = data.message.toLowerCase();
if (message.indexOf('!lock') == 0) API.moderateRoomProps(true,true);
if (message.indexOf('!unlock') == 0) API.moderateRoomProps(false,true);
if (message.indexOf('!lockskip') == 0) {
API.moderateRoomProps(true,true);
setTimeout(function(){API.moderateForceSkip();},1500);
setTimeout(function(){API.moderateRoomProps(false,true);},4000);
}
if (message.indexOf('!skip') == 0) API.moderateForceSkip();
if (message.indexOf('!ping') == 0) API.sendChat('Pong!');
if (message.indexOf('!kill') == 0) {
API.sendChat('Bot desativado com sucesso!.');
API.off(API.CHAT,onChat);
API.off(API.DJ_ADVANCE,onDjAdv);
}
}
}
function onDjAdv(obj) {
setTimeout(function(){document.getElementById("button-vote-positive").click();},1500);
var songStr = song;
var woots = obj.lastPlay.score.positive, mehs = obj.lastPlay.score.negative, curates = obj.lastPlay.score.curates ;
if (woots === 1) var ww = ' woot // '; else var ww = ' woots // ';
if (mehs === 1) var mm = ' meh // '; else var mm = ' mehs // ';
if (curates === 1) var cc = ' curate // '; else var cc = ' curates // ';
var scoreStr = ' Status Music : ' + woots + ww + mehs + mm + curates + cc;
API.sendChat('/em: ' + songStr + scoreStr);
song = API.getMedia().author + ' - ' + API.getMedia().title;
}
function djUpdate(djs) {
song = API.getMedia().author + ' - ' + API.getMedia().title;
API.off(API.DJ_UPDATE,djUpdate);
}