Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use IO::Socket::INET;
- use warnings;
- $password = "";
- $sock = IO::Socket::INET->new(PeerAddr => "irc.freenode.net",
- PeerPort => 6667,
- Proto => "tcp");
- $sock->send("NICK sonicbotpp \nUSER sonicbotpp * * :sonicbotpp\n");
- print "Sent nick and user\n";
- $buffer = "";
- while (1)
- {
- $sock->recv($data, 1024);
- if ($data ne "") {print "$data\n";};
- # if ($data == "") {print "$!\n";$sock-close();};
- $data = $buffer.$data;
- @lines = split(/\n/, $data);
- $buffer = $lines[-1];
- print "Buffer = $buffer\nABCDE\n";
- for (@lines[0..($#lines-2)]) {
- $line = $_;
- @blah = split(/ /, $line);
- if ($blah[0] eq "PING") {
- $server = $blah[1];
- $sock->send("PONG ".$server."\n");
- print "Sent pong\n";
- };
- $raw = substr($line, 1, length($line) - 2);
- @words = split(/ /, $raw);
- print "$words[1]\n";
- if ($words[1] eq "001") {
- $sock->send("PRIVMSG NickServ :IDENTIFY sonicbot $password\nJOIN ##brokendream\n");
- print "Send JOIN\n"};
- };
- };
Add Comment
Please, Sign In to add comment