Bot irc Perl para mandar privados a todo el irc
Publicado: 03 Sep 2009, 23:18
Alguien sabria modificar este bot esque cuando lo ejecuto me da este error root@Underground:~# perl xd.txt
syntax error at xd.txt line 92, near "elsif"
syntax error at xd.txt line 120, near "elsif"
syntax error at xd.txt line 125, near "}"
Execution of xd.txt aborted due to compilation errors.
Os dejo el bot
---------------------------------------------------------
#!/usr/bin/perl
print " --------------------------------------------------------------------- \r\n";
print "| |\r\n";
print "| Sebastian's Perl IRC Bot |\r\n";
print "| %%%%%%%%%%%%%%%% |\r\n";
print "| |\r\n";
print "| Coded by Sebastian |\r\n";
print "| Thanks to Timidwhitekid of Malvager for helping me debug. |\r\n";
print "| |\r\n";
print " --------------------------------------------------------------------- \r\n";
use IO::Socket;
$Host = "dune.irc-hispano.org"; #IRC Server
$Port = 6667; #IRC Server Port
$Nick = "Pirate"; #Nick
$NickPassword = ""; #NickServ Password
$Email = "IRC Bot * :thepurgatory.com"; #IRC Emailprint
$Channel = "#test"; #IRC Channel Name
$Password = ""; #IRC Channel Password
$Version = "0.56"; #Version Number
print "Sebastian's Perl IRC Bot Version $Version";
print "Connecting to $Host:$Port on $Channel with nick $Nick and Nick Password
$NickPassword.\r\n"; #Tells User where they are connecting to
print "\r\n";
@AdminUser =('Seb', #Administrator Users
'Seb|Away',
'',);
@alternate = ('PirateBot', #Alternate Nicks
'arrrrr',
'arrrrrBot');
@resp = ('spam', #Spam Messages
'tis spam',
'spamzorz',
'spamorama',
'spam de la hack',
'[Enlace externo eliminado para invitados]',
'Purgatory :: Where heaven and hell meet.');
my $sock = new IO::Socket::INET(
PeerAddr => $Host,
PeerPort => $Port,
Proto => 'tcp',
) || die "No connection $!\n";
print $sock "USER $Email\r\n"; #
print $sock "Nick $Nick\r\n"; #Sets Nick.
#print $sock "msg NickServ IDENTIFY $NickPassword\r\n"; #Identifys itself to NickServ. If
required.
while (chomp($input = <$sock>)) {
print $input . "\r\n";
if ($input =~ /004/){
last;
}
elsif ($input =~ /433/){
#If Nick is taken Switches to Nicks Listed.
$a = int(rand($#alternate));
$newNick = $alternate[$a];
print $sock "Nick $newNick\r\n";
}
}
sleep(5);
print $sock "join $Channel\r\n"; #Joins Channel
while ($input = <$sock>)
{
chop $input;
#Replys to Ping. So it dosen't get kicked.
if ($input =~/^PING(.*)$/i){
print "\r\n\r\n";
print "Request for Ping ...\r\n";
print $sock "PONG $1\r\n";
print $sock "PRIVMSG $channel :Recieved Ping Request ....\r\n";
}
#Starts Spamming how ever many messages listed after !startspam
elsif ($input =~ /^:($AdminUser)!.*:!startspam(.*)$/){
print "\r\n\r\n";
print "Request to spam ...\r\n";
print "Starting $2 messages ....\r\n";
print $sock "PRIVMSG $Channel :Prepare to get buttfucked ...\r\n";
for ($i = 0; $i < $2; ++$i)
{
$r = int(rand($#resp));
$message = $resp[$r];
print $sock "PRIVMSG $Channel :$message\r\n";
sleep(2)
}
#Lists Commands
elsif ($input =~ /^:($AdminUser)!.*:!commands(.*)$/){ #Syntax error at
C:\Users\sebsatian\Desktop\spam.pl line 91, near "elsif".
print "\r\n\r\n";
print "Request for Commands ...\r\n";
print "Sending ....\r\n";
print $sock "PRIVMSG $Channel :Current Commands are:\r\n";
print $sock "PRIVMSG $Channel :--------------------------\r\n";
print $sock "PRIVMSG $Channel :!startspam - Start Spamming\r\n";
print $sock "PRIVMSG $Channel :!stopspam - Stop Spamming\r\n";
print $sock "PRIVMSG $Channel :!say - If you have the required privelleges
will say whatever is typed after !say\r\n";
print $sock "PRIVMSG $Channel :!op - Ops the user listed after Op\r\n";
print $sock "PRIVMSG $Channel :!deop - DeOps the user listed after
DeOp\r\n";
print $sock "PRIVMSG $Channel :!ping - Pings the user listed after ping and
displays it.\r\n";
print $sock "PRIVMSG $Channel :!kick - Kicks whoevers listed after
Kick.\r\n";
print $sock "PRIVMSG $Channel :!nick - Changes the bot nick to whatever is
listed after Nick.\r\n";
print $sock "PRIVMSG $Channel :!nickban - Nick Bans the person listed after
nb.\r\n";
print $sock "PRIVMSG $Channel :!unnickban - UnNick Bans the person listed
after ub.\r\n";
print $sock "PRIVMSG $Channel :!topic - Changes $Channel Topic to whatever
is listed after topic.\r\n";
print $sock "PRIVMSG $Channel :!voice - Voices the person listed after
v.\r\n";
print $sock "PRIVMSG $Channel :!unvoice - UnVoices the person listed after
uv.\r\n";
print $sock "PRIVMSG $Channel :!invite - Invites the person listed after
invite.\r\n";
print $sock "PRIVMSG $Channel :!dehop - DeHalf Ops the user specified after
dehop.\r\n";
print $sock "PRIVMSG $Channel :!hop - HalfOps the user specified after
hop.\r\n";
print $sock "PRIVMSG $Channel :!owner - Owners the Bot.\r\n";
print $sock "PRIVMSG $Channel :!deowner - DeOwners the Bot.\r\n";
print $sock "PRIVMSG $Channel :!botrestart - Restarts Bot.\r\n";
print $sock "PRIVMSG $Channel :!botexit - Exits the Bot\r\n";
}
#Says whatever is listed after say.
elsif ($input =~ /^:($AdminUser)!.*:!say(.*)$/){
print "\r\n\r\n";
print "Request to make the bot talk ...\r\n";
print "Sending $2 ...\r\n";
print $sock "PRIVMSG $Channel :$2\r\n";
}
#Ops User listed after Op
elsif ($input =~ /^:($AdminUser)!.*:!op(.*)$/){
print "\r\n\r\n";
print "Request to op $2 ...\r\n";
print "Oping $2 ....\r\n";
print $sock "msg ChanServ AOP $Channel add $2\r\n";
}
#DeOps User listed after DeOp
elsif ($input =~ /^:($AdminUser)!.*:!deop(.*)$/){
print "\r\n\r\n";
print "Request to deop $2 ...\r\n";
print "DeOping $2 ....\r\n";
print $sock "msg ChanServ AOP $Channel del $2\r\n";
}
#Pings User listed after Ping and sends it to the channel.
elsif ($input =~ /^:($AdminUser)!.*:!ping(.*)$/){
print $sock "ping $2\r\n";
}
#Kicks User listed after k.
elsif ($input =~ /^:($AdminUser)!.*:!kick(.*)$/){
print "\r\n\r\n";
print "Request to kick $2 ...\r\n";
print "Kicking $2 ....\r\n";
print $sock "msg ChanServ KICK $Channel $2 Request\r\n";
}
#Changes the bots nick to whatever is listed after nick.
elsif ($input =~ /^:($AdminUser)!.*:!nick(.*)$/){
print "\r\n\r\n";
print "Request to change bots Nick to $2 ...\r\n";
print "Changing Bots nick to $2 ....\r\n";
print $sock "nick $2\r\n";
}
#Nick Bans the person listed after nb.
elsif ($input =~ /^:($AdminUser)!.*:!nickban(.*)$/){
print "\r\n\r\n";
print "Request to nick ban $2 ...\r\n";
print "Nick Banning $2 ....\r\n";
print $sock "mode * +b $2!*@*\r\n";
}
#UnNick Bans the person listed after ub.
elsif ($input =~ /^:($AdminUser)!.*:!unnickban(.*)$/){
print "\r\n\r\n";
print "Request to UnNick ban $2 ...\r\n";
print "UnNick Banning $2 ....\r\n";
print $sock "mode * -b $2!*@*\r\n";
}
#Changes the topic to whatever is listed after !topic
elsif ($input =~ /^:($AdminUser)!.*:!topic(.*)$/){
print "\r\n\r\n";
print "Request to Change Topic to $2 ...\r\n";
print "Changing Topic to $2 ....\r\n";
print $sock "topic $Channel $2\r\n";
}
#Voices the user listed after v.
elsif ($input =~ /^:($AdminUser)!.*:!voice(.*)$/){
print "\r\n\r\n";
print "Request to Voice $2 ...\r\n";
print "Voicing $2 ....\r\n";
print $sock "mode * +v $2!*@*\r\n";
}
#UnVoices the user listed after uv.
elsif ($input =~ /^:($AdminUser)!.*:!unvoice(.*)$/){
print "\r\n\r\n";
print "Request to UnVoice $2 ...\r\n";
print "UnVoicing $2 ....\r\n";
print $sock "mode * -v $2!*@*\r\n";
}
#Invites the user listed after invite.
elsif ($input =~ /^:($AdminUser)!.*:!invite(.*)$/){
print "\r\n\r\n";
print "Request to Invite $2 ...\r\n";
print "Inviting $2 ....\r\n";
print $sock "invite $Channel $2\r\n";
}
#Exit Bot
elsif ($input =~ /^:($AdminUser)!.*:!botexit(.*)$/){
exit
}
#Restart Bot
elsif ($input =~ /^:($AdminUser)!.*:!botrestart(.*)$/){
print "Request to restart Bot\r\n";
print "Restarting Bot ....\r\n";
print $sock "part $Channel\r\n";
print $sock "join $Channel\r\n";
}
#DeHalf Ops User listed after DeHOp
elsif ($input =~ /^:($AdminUser)!.*:!dehop(.*)$/){
print "\r\n\r\n";
print "Request to DeHalf Op $2 ...\r\n";
print "DeHalf Oping $2 ....\r\n";
print $sock "msg ChanServ HOP $Channel del $2\r\n";
}
#Half Ops User listed after HOp
elsif ($input =~ /^:($AdminUser)!.*:!hop(.*)$/){
print "\r\n\r\n";
print "Request to HalfOp $2 ...\r\n";
print "HalfOping $2 ....\r\n";
print $sock "msg ChanServ HOP $Channel add $2\r\n";
}
#Owners the Bot.
elsif ($input =~ /^:($AdminUser)!.*:!owner(.*)$/){
print "\r\n\r\n";
print "Request to Owner Bot ...\r\n";
print "Ownering Bot ....\r\n";
print $sock "msg ChanServ OWNER $Channel\r\n";
}
#DeOwners the Bot.
elsif ($input =~ /^:($AdminUser)!.*:!deowner(.*)$/){
print "\r\n\r\n";
print "Request to DeOwner Bot ...\r\n";
print "DeOwnering Bot ....\r\n";
print $sock "msg ChanServ DEOWNER $Channel\r\n";
}
else{
#@tmp = split(/:/, $input);
print $input #$tmp[1]
}
} #Missing right curly or square bracket at C:\Users\sebsatian\Desktop\spam.pl line 243, at
end of line
syntax error at xd.txt line 92, near "elsif"
syntax error at xd.txt line 120, near "elsif"
syntax error at xd.txt line 125, near "}"
Execution of xd.txt aborted due to compilation errors.
Os dejo el bot
---------------------------------------------------------
#!/usr/bin/perl
print " --------------------------------------------------------------------- \r\n";
print "| |\r\n";
print "| Sebastian's Perl IRC Bot |\r\n";
print "| %%%%%%%%%%%%%%%% |\r\n";
print "| |\r\n";
print "| Coded by Sebastian |\r\n";
print "| Thanks to Timidwhitekid of Malvager for helping me debug. |\r\n";
print "| |\r\n";
print " --------------------------------------------------------------------- \r\n";
use IO::Socket;
$Host = "dune.irc-hispano.org"; #IRC Server
$Port = 6667; #IRC Server Port
$Nick = "Pirate"; #Nick
$NickPassword = ""; #NickServ Password
$Email = "IRC Bot * :thepurgatory.com"; #IRC Emailprint
$Channel = "#test"; #IRC Channel Name
$Password = ""; #IRC Channel Password
$Version = "0.56"; #Version Number
print "Sebastian's Perl IRC Bot Version $Version";
print "Connecting to $Host:$Port on $Channel with nick $Nick and Nick Password
$NickPassword.\r\n"; #Tells User where they are connecting to
print "\r\n";
@AdminUser =('Seb', #Administrator Users
'Seb|Away',
'',);
@alternate = ('PirateBot', #Alternate Nicks
'arrrrr',
'arrrrrBot');
@resp = ('spam', #Spam Messages
'tis spam',
'spamzorz',
'spamorama',
'spam de la hack',
'[Enlace externo eliminado para invitados]',
'Purgatory :: Where heaven and hell meet.');
my $sock = new IO::Socket::INET(
PeerAddr => $Host,
PeerPort => $Port,
Proto => 'tcp',
) || die "No connection $!\n";
print $sock "USER $Email\r\n"; #
print $sock "Nick $Nick\r\n"; #Sets Nick.
#print $sock "msg NickServ IDENTIFY $NickPassword\r\n"; #Identifys itself to NickServ. If
required.
while (chomp($input = <$sock>)) {
print $input . "\r\n";
if ($input =~ /004/){
last;
}
elsif ($input =~ /433/){
#If Nick is taken Switches to Nicks Listed.
$a = int(rand($#alternate));
$newNick = $alternate[$a];
print $sock "Nick $newNick\r\n";
}
}
sleep(5);
print $sock "join $Channel\r\n"; #Joins Channel
while ($input = <$sock>)
{
chop $input;
#Replys to Ping. So it dosen't get kicked.
if ($input =~/^PING(.*)$/i){
print "\r\n\r\n";
print "Request for Ping ...\r\n";
print $sock "PONG $1\r\n";
print $sock "PRIVMSG $channel :Recieved Ping Request ....\r\n";
}
#Starts Spamming how ever many messages listed after !startspam
elsif ($input =~ /^:($AdminUser)!.*:!startspam(.*)$/){
print "\r\n\r\n";
print "Request to spam ...\r\n";
print "Starting $2 messages ....\r\n";
print $sock "PRIVMSG $Channel :Prepare to get buttfucked ...\r\n";
for ($i = 0; $i < $2; ++$i)
{
$r = int(rand($#resp));
$message = $resp[$r];
print $sock "PRIVMSG $Channel :$message\r\n";
sleep(2)
}
#Lists Commands
elsif ($input =~ /^:($AdminUser)!.*:!commands(.*)$/){ #Syntax error at
C:\Users\sebsatian\Desktop\spam.pl line 91, near "elsif".
print "\r\n\r\n";
print "Request for Commands ...\r\n";
print "Sending ....\r\n";
print $sock "PRIVMSG $Channel :Current Commands are:\r\n";
print $sock "PRIVMSG $Channel :--------------------------\r\n";
print $sock "PRIVMSG $Channel :!startspam - Start Spamming\r\n";
print $sock "PRIVMSG $Channel :!stopspam - Stop Spamming\r\n";
print $sock "PRIVMSG $Channel :!say - If you have the required privelleges
will say whatever is typed after !say\r\n";
print $sock "PRIVMSG $Channel :!op - Ops the user listed after Op\r\n";
print $sock "PRIVMSG $Channel :!deop - DeOps the user listed after
DeOp\r\n";
print $sock "PRIVMSG $Channel :!ping - Pings the user listed after ping and
displays it.\r\n";
print $sock "PRIVMSG $Channel :!kick - Kicks whoevers listed after
Kick.\r\n";
print $sock "PRIVMSG $Channel :!nick - Changes the bot nick to whatever is
listed after Nick.\r\n";
print $sock "PRIVMSG $Channel :!nickban - Nick Bans the person listed after
nb.\r\n";
print $sock "PRIVMSG $Channel :!unnickban - UnNick Bans the person listed
after ub.\r\n";
print $sock "PRIVMSG $Channel :!topic - Changes $Channel Topic to whatever
is listed after topic.\r\n";
print $sock "PRIVMSG $Channel :!voice - Voices the person listed after
v.\r\n";
print $sock "PRIVMSG $Channel :!unvoice - UnVoices the person listed after
uv.\r\n";
print $sock "PRIVMSG $Channel :!invite - Invites the person listed after
invite.\r\n";
print $sock "PRIVMSG $Channel :!dehop - DeHalf Ops the user specified after
dehop.\r\n";
print $sock "PRIVMSG $Channel :!hop - HalfOps the user specified after
hop.\r\n";
print $sock "PRIVMSG $Channel :!owner - Owners the Bot.\r\n";
print $sock "PRIVMSG $Channel :!deowner - DeOwners the Bot.\r\n";
print $sock "PRIVMSG $Channel :!botrestart - Restarts Bot.\r\n";
print $sock "PRIVMSG $Channel :!botexit - Exits the Bot\r\n";
}
#Says whatever is listed after say.
elsif ($input =~ /^:($AdminUser)!.*:!say(.*)$/){
print "\r\n\r\n";
print "Request to make the bot talk ...\r\n";
print "Sending $2 ...\r\n";
print $sock "PRIVMSG $Channel :$2\r\n";
}
#Ops User listed after Op
elsif ($input =~ /^:($AdminUser)!.*:!op(.*)$/){
print "\r\n\r\n";
print "Request to op $2 ...\r\n";
print "Oping $2 ....\r\n";
print $sock "msg ChanServ AOP $Channel add $2\r\n";
}
#DeOps User listed after DeOp
elsif ($input =~ /^:($AdminUser)!.*:!deop(.*)$/){
print "\r\n\r\n";
print "Request to deop $2 ...\r\n";
print "DeOping $2 ....\r\n";
print $sock "msg ChanServ AOP $Channel del $2\r\n";
}
#Pings User listed after Ping and sends it to the channel.
elsif ($input =~ /^:($AdminUser)!.*:!ping(.*)$/){
print $sock "ping $2\r\n";
}
#Kicks User listed after k.
elsif ($input =~ /^:($AdminUser)!.*:!kick(.*)$/){
print "\r\n\r\n";
print "Request to kick $2 ...\r\n";
print "Kicking $2 ....\r\n";
print $sock "msg ChanServ KICK $Channel $2 Request\r\n";
}
#Changes the bots nick to whatever is listed after nick.
elsif ($input =~ /^:($AdminUser)!.*:!nick(.*)$/){
print "\r\n\r\n";
print "Request to change bots Nick to $2 ...\r\n";
print "Changing Bots nick to $2 ....\r\n";
print $sock "nick $2\r\n";
}
#Nick Bans the person listed after nb.
elsif ($input =~ /^:($AdminUser)!.*:!nickban(.*)$/){
print "\r\n\r\n";
print "Request to nick ban $2 ...\r\n";
print "Nick Banning $2 ....\r\n";
print $sock "mode * +b $2!*@*\r\n";
}
#UnNick Bans the person listed after ub.
elsif ($input =~ /^:($AdminUser)!.*:!unnickban(.*)$/){
print "\r\n\r\n";
print "Request to UnNick ban $2 ...\r\n";
print "UnNick Banning $2 ....\r\n";
print $sock "mode * -b $2!*@*\r\n";
}
#Changes the topic to whatever is listed after !topic
elsif ($input =~ /^:($AdminUser)!.*:!topic(.*)$/){
print "\r\n\r\n";
print "Request to Change Topic to $2 ...\r\n";
print "Changing Topic to $2 ....\r\n";
print $sock "topic $Channel $2\r\n";
}
#Voices the user listed after v.
elsif ($input =~ /^:($AdminUser)!.*:!voice(.*)$/){
print "\r\n\r\n";
print "Request to Voice $2 ...\r\n";
print "Voicing $2 ....\r\n";
print $sock "mode * +v $2!*@*\r\n";
}
#UnVoices the user listed after uv.
elsif ($input =~ /^:($AdminUser)!.*:!unvoice(.*)$/){
print "\r\n\r\n";
print "Request to UnVoice $2 ...\r\n";
print "UnVoicing $2 ....\r\n";
print $sock "mode * -v $2!*@*\r\n";
}
#Invites the user listed after invite.
elsif ($input =~ /^:($AdminUser)!.*:!invite(.*)$/){
print "\r\n\r\n";
print "Request to Invite $2 ...\r\n";
print "Inviting $2 ....\r\n";
print $sock "invite $Channel $2\r\n";
}
#Exit Bot
elsif ($input =~ /^:($AdminUser)!.*:!botexit(.*)$/){
exit
}
#Restart Bot
elsif ($input =~ /^:($AdminUser)!.*:!botrestart(.*)$/){
print "Request to restart Bot\r\n";
print "Restarting Bot ....\r\n";
print $sock "part $Channel\r\n";
print $sock "join $Channel\r\n";
}
#DeHalf Ops User listed after DeHOp
elsif ($input =~ /^:($AdminUser)!.*:!dehop(.*)$/){
print "\r\n\r\n";
print "Request to DeHalf Op $2 ...\r\n";
print "DeHalf Oping $2 ....\r\n";
print $sock "msg ChanServ HOP $Channel del $2\r\n";
}
#Half Ops User listed after HOp
elsif ($input =~ /^:($AdminUser)!.*:!hop(.*)$/){
print "\r\n\r\n";
print "Request to HalfOp $2 ...\r\n";
print "HalfOping $2 ....\r\n";
print $sock "msg ChanServ HOP $Channel add $2\r\n";
}
#Owners the Bot.
elsif ($input =~ /^:($AdminUser)!.*:!owner(.*)$/){
print "\r\n\r\n";
print "Request to Owner Bot ...\r\n";
print "Ownering Bot ....\r\n";
print $sock "msg ChanServ OWNER $Channel\r\n";
}
#DeOwners the Bot.
elsif ($input =~ /^:($AdminUser)!.*:!deowner(.*)$/){
print "\r\n\r\n";
print "Request to DeOwner Bot ...\r\n";
print "DeOwnering Bot ....\r\n";
print $sock "msg ChanServ DEOWNER $Channel\r\n";
}
else{
#@tmp = split(/:/, $input);
print $input #$tmp[1]
}
} #Missing right curly or square bracket at C:\Users\sebsatian\Desktop\spam.pl line 243, at
end of line