phantombot-plugins/twitch/customAlerts.js
2022-02-05 13:00:32 +01:00

18 lines
690 B
JavaScript

(function() {
function alert(username, desc, tpe) {
var pb = new java.lang.ProcessBuilder("/usr/bin/python3", "./main.py", tpe, username, desc, "/opt/PhantomBot/config/gif-alerts/");
var proc = pb.start();
proc.waitFor();
$.panelsocketserver.alertImage(tpe+".gif?noise=" + Math.floor(Math.random() * 1000 + 1));
}
$.bind('twitchFollow', function(event) {
var follower = event.getFollower();
alert(follower.toUpperCase(), "NEW FOLLOWER", "follow");
});
$.bind('twitchSubscriber', function(event) {
var subscriber = event.getSubscriber();
alert(subscriber.toUpperCase(), "NEW SUBSCRIBER", "subscribe");
});
})();