const WebSocket = require('ws'); const notifier = require('node-notifier'); const path = require('path'); var list = []; var amount =264; var stat = ""; var durum = "yes"; var messageamount = 0; var raintime = "blank"; var idlist = [1018559]; //, 2211135, 1354959, 610459, 64726, 443, 327760, 20173, 983520 var users = [" Karahanlı Jenix", " Heyri gamdom.com", " Arcanus gamdom.com", " ✪BIBI Raichu gamdom.com", " Łukesz"," Tsunage gamdom.com"," spiman", " POWERR -", " Jowlen | gamdom.com"]; const ws = new WebSocket('wss://gamdom.com/socket.io/?EIO=3&transport=websocket', { origin: 'https://gamdom.com', headers: { Cookie: '_fbp=fb.1.1594832503974.364233846; _ga=GA1.2.714313497.1594832504; _ym_uid=1599765686911167977; _ym_d=1599765686; __cfduid=dfc6bfcfebab6c9424a2621e7b2f0ccd51600109593; _gid=GA1.2.2129053633.1600950195; _ym_isad=2; secret_session_do_not_share=you_are_being_scammed__NEVER_send_this_to_anyone!_________________________________________.ba8c22a7-adb0-4912-93d9-eb761bd10d6d; data=00ea9568f138da3a2ee0e3c329529922; _ym_visorc_67183024=w' } }); ws.on('open', function open() { ws.send('40/chat,'); ws.send('42/chat,0["join",["turkish","polish"]]'); notifier.notify( { title: 'Free Rain', message: 'Script Started!', icon: path.join(__dirname, 'freerain.png'), // Absolute path (doesn't work on balloons) sound: true, // Only Notification Center or Windows Toasters wait: true // Wait with callback, until user action is taken against notification, does not apply to Windows Toasters as they always wait or notify-send as it does not support the wait option }, function (err, response) { // Response is response from notification } ); }); ws.onmessage = function(message) { console.log(message.data); if(message.data.includes('42/chat,["activateRain"')) { var replac = message.data.replace("42/chat,", ""); var pars = JSON.parse(replac); var type = pars[1].type; var planned = pars[1].planned; if(type == "custom") { if(planned == false) { raintime = "blank"; notifier.notify( { title: 'Free Rain', message: 'Its Raining!', icon: path.join(__dirname, 'freerain.png'), // Absolute path (doesn't work on balloons) sound: true, // Only Notification Center or Windows Toasters wait: true // Wait with callback, until user action is taken against notification, does not apply to Windows Toasters as they always wait or notify-send as it does not support the wait option }, function (err, response) { // Response is response from notification } ); } if(planned == true) { var oldDateObj = new Date(); var newDateObj = new Date(); newDateObj.setTime(oldDateObj.getTime() + (15 * 60 * 1000)); //ws.send('42/chat,["say",{"message":"Sıradaki free rain saat ' + newDateObj.toTimeString().split(" ")[0] + ' da gelecek","channelName":"turkish"}]'); raintime = "xx:" + newDateObj.toTimeString().split(" ")[0].split(":")[1]; notifier.notify( { title: 'Free Rain', message: 'Free rain will be at ' + newDateObj.getHours() + ":" + newDateObj.getMinutes() + "!", icon: path.join(__dirname, 'freerain.png'), // Absolute path (doesn't work on balloons) sound: true, // Only Notification Center or Windows Toasters wait: true // Wait with callback, until user action is taken against notification, does not apply to Windows Toasters as they always wait or notify-send as it does not support the wait option }, function (err, response) { // Response is response from notification } ); } } if(!freetime.match(/free/i)) { addNewMessage({ user: "Mr. Helper", message: raintime, image: "https://assets.stickpng.com/images/580b57fbd9996e24bc43bdfe.png" }); } else { addNewMessage({ user: "Mr. Helper", message: "Free raine henüz rastlanmadı...", image: "https://assets.stickpng.com/images/580b57fbd9996e24bc43bdfe.png" }); } } if (message.data.includes('42/chat,["msgs",')) { var replac = message.data.replace("42/chat,", ""); var pars = JSON.parse(replac); var chat = pars[1][0].channelName; var mesaj = pars[1][0].message; var isim = pars[1][0].username; var resim = pars[1][0].image; var sender = pars[1][0].senderid; var hasNumber = /\d/; console.log(isim + ": " + sender); if(idlist.includes(sender)) { if(mesaj == "tis habere sanctus est leke les habere sanctus est") { if(chat == "turkish") { if(raintime == "blank") { ws.send(`42/chat,["say",{"message":"Efendim henüz kaydedilen free yok","channelName":"turkish"}]`); } else { ws.send(`42/chat,["say",{"message":"Efendim sıradaki free rainin zamanı ${raintime}","channelName":"turkish"}]`); } } } /*if(mesaj == "!freetime") { if(chat == "turkish") { if(raintime == "blank") { ws.send(`42/chat,["say",{"message":"@${isim} şuanlık kaydedilen free rain yok.","channelName":"turkish"}]`); } else { ws.send(`42/chat,["say",{"message":"@${isim} sıradaki free rain saat ${raintime} da gelecek","channelName":"turkish"}]`); } } if(chat == "polish") { if(raintime == "blank") { ws.send(`42/chat,["say",{"message":"@${isim} Obecnie nie ma zaplanowanego darmowego deszczu.","channelName":"polish"}]`); } else { ws.send(`42/chat,["say",{"message":"@${isim} Następny darmowy rain odbędzie się o ${raintime}","channelName":"polish"}]`); } } } if(mesaj == "!kullanıcılar") { ws.send(`42/chat,["say",{"message":"@${isim} ekli olan kullanıcı listesi: ${users}","channelName":"turkish"}]`); } */ } } }; setInterval(function() { ws.send(3); },20000);