Tekil Mesaj gösterimi
Alt 07 Temmuz 2021, 11:00   #1
Çevrimiçi
Toprak
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (1)
IF Ticaret Yüzdesi:(%)
NodeJS Socket Bot




Merhaba,
Bir zamanlar uğraşıyordum şuan için ara verdim.
Mantık bire bir mIRC gibi hemen kavraya bilirsiniz, örnek olması açısından paylaşıyorum..

İlk önce sunucumuzda node.js'yi aktif ediyoruz artından util ve iconv eklentilerini kuruyoruz.

Kod:   Kodu kopyalamak için üzerine çift tıklayın!
const NET = require("net"), socket = new NET.Socket(), format = require('util').format, Iconv = require('iconv').Iconv, iconv = new Iconv('ISO-8859-9', 'UTF-8'); // Ayarlar bölümü const bot = "NodeJS-Bot"; const pass = "5gf4343fkhpe"; const ident = "Paradox"; const fullname = "NodeJS Socket Bot - Paradox"; const oper = "Bot 123321"; const supass = "Toprak"; const sunucu = "irc.Toprak.NET"; const sunucuip = "194.31.87.36"; const port = "6667"; const ppass = "S1fr3s1Z"; const master = "Toprak Tprk"; // Kanal ayarları const admin = "#System"; const opers = "#Opers"; const operhelp = "#OperHelp"; const services = "#Services"; const log = "#Log"; const bots = "#Bots"; const xline = "#Xline"; const reklam = "#Adwords"; const kontrol = "#Karantina"; // BUNDAN SONRASINA ELLEŞME function _nick(nick) { if (nick = nick.match(/^\:(.+)!/i)) { return nick[1]; } } function _nickler(nick) { var muafn = ["ChanServ", "NickServ", "MemoServ", "HelpServ", "OperServ", "StatServ", bot]; if (muafn.indexOf(nick) != -1) { return 1; } else { return 0; } } const kanallar = [opers, admin, log, xline, bots, kontrol]; // START bot = socket.connect(port, sunucuip, function() { console.log('Sunucuya bağlanılıyor...'); }); bot.on('connect', function() { console.log('Bağlandı.'); bot.write(format('PASS %s\r\n', ppass)); bot.write(format('NICK %s\r\n', bot + Math.floor(Math.random() * 99999))); bot.write(format('USER %s "" "%s" :%s\r\n', ident, bot.remoteAddress, fullname)); }); bot.on('data', function(message) { message = Buffer.from(message, 'binary'); message = message.toString(); lines = message.split("\r\n"); lines[0] = "" + lines[0]; lastLine = lines.pop(); lines.forEach(function(line) { message = line.normalize(); console.log(message); message = message.split(" "); if (message[0].match(/^PING$/i)) { bot.write(format('PONG %s\r\n', message[1].replace(':', ''))); } else if (message[0].match(/^ERROR$/i)) { bot.end(); } else if (message[1].match(/^(001|433)$/)) { console.log('Giriş yapıldı.'); bot.write(format('OPER %s\r\n', oper)); bot.write(format('NICKSERV GHOST %s %s\r\n', bot, pass)); bot.write(format('NICKSERV RELEASE %s %s\r\n', bot, pass)); bot.write(format('JOIN #0,0\r\n')); setTimeout(function() { bot.write(format('NICK %s\r\n', bot)); }, 3000); } else if (message[1].match(/^(481|411)$/)) { bot.write(format('OPER %s\r\n', oper)); bot.write(format('NICK %s\r\n', bot)); setTimeout(function() { bot.write(format('NICKSERV IDENTIFY %s\r\n', pass)); }, 2000); } else if (message[1].match(/^NICK$/i)) { if (_nick(message[0]) == bot) { bot.write(format('NICKSERV GHOST %s %s\r\n', bot, pass)); bot.write(format('NICKSERV RELEASE %s %s\r\n', bot, pass)); setTimeout(function() { bot.write(format('NICK %s\r\n', bot)); }, 3000); } else if (message[2].replace(':', '') == bot) { bot.write(format('NICKSERV IDENTIFY %s\r\n', pass)); bot.write(format('OPER %s\r\n', oper)); bot.write(format('OPERSERV SU %s\r\n', supass)); bot.write(format('JOIN #0,0\r\n')); bot.write(format('MODE %s +qHp-hY\r\n', bot)); setTimeout(function() { bot.write(format('SAJOIN %s %s,%s,%s,%s,%s,%s\r\n', bot, opers, admin, log, xline, bots, kontrol)); }, 3000); } } else if (message[1].match(/^PART$/i) && (_nick(message[0]) == bot)) { if (kanallar.lastIndexOf(message[2]) != -1) { bot.write(format('SAJOIN %s %s\r\n', bot, message[2])); } } else if (message[1].match(/^KICK$/i) && (message[3] == bot)) { if (kanallar.lastIndexOf(message[2]) != -1) { bot.write(format('SAJOIN %s %s\r\n', bot, message[2])); } } else if (message[1].match(/^JOIN$/i) && (_nick(message[0]) == bot)) { if (kanallar.lastIndexOf(message[2].replace(':', '')) != -1) { bot.write(format('MODE %s -qao+h %s %s %s %s\r\n', message[2].replace(':', ''), bot, bot, bot, bot)); } else { bot.write(format('SAPART %s %s\r\n', bot, message[2].replace(':', ''))); } } else if (message[1].match(/^MODE$/i) && (message[2].match(/^#/))) { if (message[3].match(/^\+(\S+)?(b)(\S+)?/i) && (message.join(" ").lastIndexOf(" " + bot + "!*@*") != -1)) { bot.write(format('MODE %s -bqao+h %s %s %s %s %s\r\n', message[2], bot, bot, bot, bot, bot)); } else if ((message.join(" ").lastIndexOf(" " + bot + "") != -1) && (_nickler(_nick(message[0])) == 0)) { bot.write(format('MODE %s -bqao+h %s %s %s %s %s\r\n', message[2], bot, bot, bot, bot, bot)); } } }); });


 
Alıntı ile Cevapla

IRCForumlari.NET Reklamlar
sohbet odaları sohbet odaları Benimmekan Mobil Sohbet