Hav0c
Power Member
Fiz este bot de IRC ontem, e estou a ter problemas: se o bot não envia nada para o servidor, é expulso por causa do "ping timeout".
alguma maneira de fazer com que o bot não seja expulso da sala?
PS: os comentários estão em inglês porque o bot foi feito para #rohitab em irc.bluehell.org que é em inglês.
Código:
#!/usr/bin/perl -w
# Pedo_bot - by Hav0c
# Warning: this code is full
# with bugs!!1
use IO::Socket;
#$chan = "#rohitab";
$serv = "irc.bluehell.org";
$port = "6667";
$nick = "Hav0c_b0t";
$user = "x1 x2 x3 x4";
$pass = "[passwd]";
$owner = "Hav0c";
#commands:
###############################################
$join = "!join";
$say = "!say";
$exit = "!exit";
$rape = "!rape";
$ping = "!ping";
$flood = "!flood";
$msg = "!msg";
$joke = "!joke";
$rnd = "!rnd";
$xnick = "!nick";
$billy = "!billy";
###############################################
$irc = IO::Socket::INET->new(PeerAddr=>$serv,
PeerPort=>$port,
Proto=>'tcp',
Timeout=>'30') || print "Error creating socket\n";
print "channel:: ";
$chan = <STDIN>;
chop $chan;
print $irc "USER $user\r\n";
print $irc "NICK $nick\r\n";
print $irc "privmsg nickserv IDENTIFY $pass\r\n";
print "Joining channel in 10 seconds\n";
sleep(10); #sl33pz
print $irc "JOIN $chan\r\n";
print "into $chan\n";
sleep(10); #mo' sl33pz
# Comment here to make
# the code look bigger
# <_<
print "$0 will now accept your commands\n";
while($stuff = <$irc>){
#next unless $stuff =~ /^:$owner\b/;
if($stuff =~ $ping){
print $irc "privmsg $chan PONG!\r\n";
}
if($stuff =~ $say){
print $irc "privmsg $chan $'\r\n";
}
if($stuff =~ $join){
print $irc "JOIN $'\r\n";
}
if($stuff =~ $rape){
print $irc "privmsg $chan 8====D~~~$'\r\n";
}
if($stuff =~ $flood){
print $irc "privmsg $chan $'\r\n"; #I tried to use a loop
print $irc "privmsg $chan $'\r\n"; #but the mo'fuckin command didn't
print $irc "privmsg $chan $'\r\n"; #worked
print $irc "privmsg $chan $'\r\n";
print $irc "privmsg $chan $'\r\n";
print $irc "privmsg $chan $'\r\n";
print $irc "privmsg $chan $'\r\n";
print $irc "privmsg $chan $'\r\n";
print $irc "privmsg $chan $'\r\n";
print $irc "privmsg $chan $'\r\n";
}
if($stuff =~ $exit){
print $irc "QUIT $'\r\n";
close($irc);
exit;
}
if($stuff =~ $msg){
print $irc "privmsg $'\r\n";
}
if($stuff =~ $joke){
print $irc "privmsg $chan I'm masturbating lulz\r\n";
}
if($stuff =~ $rnd){
$ran = int(rand(100));
print $irc "privmsg $chan $ran\r\n";
}
if($stuff =~ $xnick){
print $irc "NICK $'\r\n";
}
if($stuff =~ $billy){
print $irc "privmsg $chan Linux rapes winblows\r\n";
}
}
alguma maneira de fazer com que o bot não seja expulso da sala?
PS: os comentários estão em inglês porque o bot foi feito para #rohitab em irc.bluehell.org que é em inglês.