Also, try and show us the error message that always helps. There is a few posts on here about how to fix certain errors with that template so have a good look around
There is no error message! It signs in. But then i check it on my msn. And its offline. Its the same with other people. Its signs in then goes offline.
#!/usr/bin/perl<br /><br />###############################<br /><br />$botuser = 'eyebot@hotmail.com';<br />$botpass = '123456787';<br /><br />$admin = 'mjgriffiths@hotmail.com';<br /><br />###############################<br /><br />use MSN;<br />use LWP::Simple;<br />use File::Basename;<br />#use Net::DNS;<br />chdir(dirname($0));<br /><br />#Seed the random number generator.<br />srand time;<br /><br />#Create a new MSN module instance.<br />my $msn = MSN->new('',Handle => $botuser, Password => $botpass);<br /><br />$msn->set_handler(Message => \&Message);<br />$msn->set_handler(Status => \&Status);<br />$msn->set_handler(Answer => \&Answer);<br />$msn->set_handler(Join => \&Join);<br /><br />$msn->connect();<br /><br />while (1)<br />{<br /> $msn->do_one_loop;<br />}<br /><br />##################<br />##################<br /><br />sub Status {<br /> my ($self, $username, $newstatus) = @_;<br /><br /> # Setup the time<br /> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);<br /> my $daynum = (localtime)[6];<br /> <br /> print "Status() called with parameters:\n";<br /> print " " . join(",", @_), "\n";<br /> print "${username}'s status changed from " . $self->buddystatus($username) . " to $newstatus.\n";<br />}<br /><br />###################<br />###################<br /><br />sub Message {<br /> <br /> # $username is the variable containing the e-mail address of the person your bot is talking too<br /> # $msg is the message they are sending to your bot<br /> <br /> my ($self, $username, undef, $msg) = @_;<br /> $username = lc($username); # make it lower case<br /> $username =~ s/ //g; # just make sure there are no spaces in the username<br /><br /> # Setup the time<br /> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);<br /> my $daynum = (localtime)[6];<br /> <br /> # filter HTML and stuff<br /> $msg =~ s/<(.|\n)+?>//g;<br /> $msg = replace($msg);<br /><br /> #log message<br /> open (DATA, ">>logs/$username.txt");<br /> print DATA "<Person> $msg\n";<br /> close(DATA);<br /><br /> #Show what person's sayin on the screen (as in the dos box)<br /> print "\n----------------------\n";<br /> print "<$username> $msg\n";<br /> print "----------------------\n\n";<br /><br /> #######################################<br /> #######################################<br /> ####################################### COMMANDS STARTING HERE<br /><br /><br />#make msesage lowercase<br />$msg = lc($msg);<br /><br /># a few things:<br />#<br /># The variable $msg is what the person is saying<br /># The \ tells perl that the ! before the command eg !time is to be used as a normal character<br /># The ^ means it has to be at the beginning of the string (sentance)<br /># The return at the end of each command means finish the sub thats called when a message is recieved<br /><br /># tells the user the time when they type !time<br />if ($msg =~ /(^\!time)/i) {<br />&send($$self,"GMT " . localtime(), "$username");<br />return;<br />}<br /><br /># this is !leave and it makes the bot leave the convo if it's a conference<br />if ($msg =~ /(^\!leave)/i) {<br />&send($$self,"Bye bye", "$username");<br />$$self->sendraw("OUT\*lazy*\n");<br />return;<br />}<br /><br /># you could type !invite someone@hotmail.com and the bot invites them in..<br />if ($msg =~ /^\!invite (.*)$/) {<br />&send($$self,"Inviting $1.. please wait", "$username");<br />$$self->send('CAL', "$1");<br />&send($$self,"Try typing something..", "$username");<br />return;<br />}<br /><br /> #######################################<br /> ####################################### ADMIN COMMANDS STARTING<br /> <br /> #change the following to your account<br /> if ($username =~ /$admin/) {<br /><br /># the command reboots the bot, usefull if you modified bot.pl<br />if ($msg =~ /(^\!hardboot)/i) {<br />$msn->send('CHG', 'BRB');<br />&send($$self,"Rebooting.", "$username");<br />$$self->sendraw("OUT\*lazy*\n");<br />system "bot.pl";<br />return;<br />}<br /><br /># this is a soft reboot, only needed if you update the replies (in the response directory)<br />if ($msg =~ /(^\!reboot|reboot yourself|reload yourself|restart yourself|refresh yourself|enlighten you are mind)/i) {<br />&loadReplies();<br />&send($$self,"Reboot completed.", "$username");<br />return;<br />}<br /><br /># signs the bot out.. ie DIEEEEE!<br />if ($msg =~ /(^\!offline)/i) {<br />&send($$self,"Signing out..", "$username");<br />exit(1);<br />return;<br />}<br /><br /> }<br /> ####################################### ADMIN ENDING<br /> #######################################<br /><br /><br /> #######################################<br /> #######################################<br /> ####################################### COMMANDS STOPING HERE<br /> <br />$msg = replace($msg);<br />$msg = replace($msg); #get net jargon out, this runs the replace sub. This reads from the text file replace.txt<br />$msg = replace($msg);<br />$msg = replace($msg);<br /><br />#just to stop things going wrong<br />$victim eq $username;<br />if ($msg eq "") {<br />$msg = "zcxczxx";<br />print "No message detected - Message went to $msg\n";<br />}<br /><br />$reply = reply($victim,$msg);<br /><br />#replacing non capital i with a capital I<br />$reply =~ s/ i / I /ig;<br /><br />&send($$self,"$reply", "$username");<br /><br />}<br /><br />###################<br />###################===================|<br />###################===================|<br />###################<br /><br />sub Join {<br /> my ($self, $username) = @_;<br /> # See if there's anything queued up.<br /> # Deliver each message if there is stuff in the queue for this user.<br /> sleep(2);<br /> while ($_ = shift @{$queue{$username}}) { <br /> $$self->sendmsg($_);<br /> }<br />}<br /><br />###################<br />###################===================|<br />###################===================|<br />###################<br /><br />sub send {<br />my ($self,$response,$username) = (shift,shift,shift);<br /><br /> open (DATA, ">>logs/$username.txt");<br /> print DATA "<bot> $response\n";<br /> close(DATA);<br /> <br /> open (DATA, ">>logs/$username.txt");<br /> print DATA "" . localtime() . "\n\n";<br /> close(DATA);<br /><br />$self->sendmsg($response, @_);<br />}<br /><br />sub Answer {<br />}<br /><br />sub replace {<br />my $w = shift;<br />open (FILE, "replace.txt");<br />my @file = <FILE>;<br />close(FILE);<br />foreach (@file) {<br />$_ =~ s/\n//;<br />my ($a,$b) = split (/\|/, $_, 2);<br />$w =~ s/\b$a\b/$b/ig;<br />}<br />return $w;<br />}<br /><br />sub reply {<br /> my $victim = shift;<br /> my $msg = shift;<br /> my $test = ""; <br /> my $temp = "";<br /> my $reply = "";<br /> print "Formating reply!!!\n";<br /> if( !defined $Replies )<br /> {<br /> &loadReplies();<br /> }<br /><br /> foreach $test (@$Replies)<br /> {<br /> $temp = $test->{Regex};<br /> if ( $msg =~ /$temp/i ) {<br /> $reply = $test->{Responce};<br /> my $one = $1 unless !defined($1); #define the variable so that we can use them in<br /> my $two = $2 unless !defined($2); #the responce files<br /> my $three = $3 unless !defined($3);<br /> my $four = $4 unless !defined($4);<br /> my $five = $5 unless !defined($5);<br /> my $six = $6 unless !defined($6);<br /> my $seven = $7 unless !defined($7);<br /> my $eight = $8 unless !defined($8);<br /> my $nine = $9 unless !defined($9); <br /><br /> #print $reply ."\n";<br /> while ($reply =~ /\@(.+?) / || $reply =~ /\{\@(.+?)\}/) #process named lists in { } and out<br /> {<br /> $reply =~ s/(\@(.+?)) /JoinEM(0, $ListHash->{$2}) ." "/ige;<br /> $reply =~ s/(\{\@(.+?)\})/JoinEM(0, $ListHash->{$2})/ige;<br /> }<br /> #print $reply ."\n";<br /> $reply =~ s/\((.*?\|.*?)\)/pick_one($1)/eg; #process unnamed lists<br /> <br /> my @tosay = split(/\|/,$reply); #break apart multiple responces seperated by<br /> $reply = $tosay [ int(rand(scalar(@tosay))) ]; #randomly pick one<br /><br /> $reply =~ s/\$1/$one/g unless !defined($one); #insert in the variables<br /> $reply =~ s/\$2/$two/g unless !defined($two);<br /> $reply =~ s/\$3/$three/g unless !defined($three);<br /> $reply =~ s/\$4/$four/g unless !defined($four);<br /> $reply =~ s/\$5/$five/g unless !defined($five);<br /> $reply =~ s/\$6/$six/g unless !defined($six);<br /> $reply =~ s/\$7/$seven/g unless !defined($seven);<br /> $reply =~ s/\$8/$eight/g unless !defined($eight);<br /> $reply =~ s/\$9/$nine/g unless !defined($nine);<br /><br /> $reply =~ s/\%sn/$victim/gs;<br /> $reply =~ s/(?<!\/)\<\%(.*)\%\>/$1/eeig;<br /> $msg = "";<br /> last; # we found a match. stop looking<br /> }<br /> if ($msg eq "") {last;}<br /> }<br /> return $reply;<br />}<br /><br />sub loadReplies {<br /> print "\n\nReloading Replies now";<br /> my $lines;<br /> $lines = 0;<br /> $Replies = []; # a list of hashes.<br /> $ListHash = {}; # a hash of lists<br /><br /> opendir(DIR, "./responces");<br /> foreach $file (sort(grep(/\.cfg$/, readdir(DIR)))) {<br /> open (DATA, "responces/$file");<br /> @contents = <DATA>;<br /> close (DATA);<br /> foreach $line (@contents) {<br /> $lines = $lines + 1;<br /> chomp($line);<br /> if ($line =~ /^\@(.+?) = \((.+?)\)/) {<br /> if ( !defined $ListHash->{$1}) <br /> {<br /> @{$ListHash->{$1}} = split(/,/,$2);<br /> }<br /> else<br /> {<br /> push @{$ListHash->{$1}},split(/,/,$2);<br /> }<br /> #print "name: $1 List: " . join("|" , @{$ListHash->{$1}}) . "\n";<br /> }<br /> elsif ($line =~ /^\#/)<br /> {<br /> }<br /> elsif ($line ne "")<br /> {<br /> ($regex,$reply) = split(/\]\[/, $line, 2);<br /> my $tempHash = {};<br /> while ($regex =~ /\@(.+?) / || $regex =~ /\{\@(.+?)\}/ || $regex =~ /\(\@(.+?)\)/)<br /> {<br /> $regex =~ s/\(\@(.+?)\)/JoinEM(0,$ListHash->{$1})/ige;<br /> $regex =~ s/(\@(.+?)) /JoinEM(1,$ListHash->{$2}) . " "/ige;<br /> $regex =~ s/(\{\@(.+?)\})/JoinEM(1,$ListHash->{$2})/ige;<br /> #print $regex ."\n";<br /> }<br /> $tempHash->{Regex} = $regex;<br /> $tempHash->{Responce} = $reply;<br /> push @$Replies,$tempHash;<br /> #print "regex: $tempHash->{Regex} reply: $tempHash->{Responce} \n";<br /> }<br /><br /> }<br /> closedir(DIR); <br /> }<br /> print "\nLoading completed\. $lines lines of replies loaded\.\n\n";<br />}<br /><br />sub JoinEM<br />{<br /> my $forget = shift;<br /> my $List = shift;<br /> my $temp = join("|", @$List) . ")";<br /> if ($forget == 1)<br /> {<br /> return "(?:" . $temp;<br /> }<br /> else<br /> {<br /> return "(" . $temp;<br /> }<br />}<br /><br />sub pick_one {<br /> my $stuff = shift;<br /> my @stuff = split(/\|/,$stuff);<br /> return $stuff[int(rand(scalar(@stuff)))];<br />}<br /><br />sub anticonflict {<br />$cfgln = shift;<br /> $cfgln =~ s/\\/\\\\/ig;<br /> $cfgln =~ s/\//\\\//ig;<br /># $cfgln =~ s/\(/\\\(/ig;<br /># $cfgln =~ s/\)/\\\)/ig;<br /> $cfgln =~ s/\^/\\\^/ig;<br /> $cfgln =~ s/\+/\\\+/ig;<br /> $cfgln =~ s/\*/\\\*/ig;<br /> $cfgln =~ s/\./\\\./ig;<br /> $cfgln =~ s/\{/\\\{/ig;<br /> $cfgln =~ s/\}/\\\}/ig;<br /> #$cfgln =~ s/\[/\\\[/ig;<br /> #$cfgln =~ s/\]/\\\]/ig;<br /> $cfgln =~ s/\$/\\\$/ig;<br />return $cfgln;<br />}
Ive had a look through this code and noticed that there is no msn->set_status. NLN or something like this, Which in wired bot it has. Could this mean that the bot is signing in with 'Appear offline' With its Status?