WIP
This commit is contained in:
46
twitch/customOverlay.js
Normal file
46
twitch/customOverlay.js
Normal file
@@ -0,0 +1,46 @@
|
||||
(function() {
|
||||
|
||||
|
||||
function sendData(tpe, data) {
|
||||
$.panelsocketserver.sendJSONToAll(JSON.stringify({
|
||||
'eventFamily': 'overlay',
|
||||
'eventType': tpe,
|
||||
'data': data
|
||||
}));
|
||||
}
|
||||
|
||||
$.bind('command', function(event) {
|
||||
|
||||
const sender = "" + event.getSender().toLowerCase(),
|
||||
command = event.getCommand(),
|
||||
argsString = "" + event.getArguments().trim(),
|
||||
args = event.getArgs(),
|
||||
action = args[0],
|
||||
value = args[1];
|
||||
|
||||
if (command.equalsIgnoreCase('overlay')) {
|
||||
if (!action) {
|
||||
$.say($.whisperPrefix(sender) + $.lang.get('customOverlay.help', ' Use "!overlay [follow | subscribe | donation | timer] value" to set overlay data.'));
|
||||
} else if (action.equalsIgnoreCase('follow')) {
|
||||
sendData(action, value);
|
||||
} else if (action.equalsIgnoreCase('subscribe')) {
|
||||
sendData(action, value);
|
||||
} else if (action.equalsIgnoreCase('donation')) {
|
||||
sendData(action, value);
|
||||
} else if (action.equalsIgnoreCase('timer')) {
|
||||
sendData(action, new Date(Date.now().getTime()+value*1000*60));
|
||||
} else {
|
||||
$.say($.whisperPrefix(sender) + $.lang.get('customOverlay.help'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.bind('initReady', function() {
|
||||
$.registerChatSubcommand('overlay', 'follow', 2);
|
||||
$.registerChatSubcommand('overlay', 'subscribe', 2);
|
||||
$.registerChatSubcommand('overlay', 'donation', 2);
|
||||
$.registerChatSubcommand('overlay', 'timer', 2);
|
||||
});
|
||||
|
||||
|
||||
})();
|
Reference in New Issue
Block a user