# Mod commands foreach $mod (@moderators) { if ($username eq $mod) { open('mod','./Commands/mod.pl'); @modsub=; close('mod'); $modsub=join('',@modsub); eval($modsub); } }
# Public commands open('norm','./Commands/public.pl'); @pubsub=; close('norm'); $pubsub=join('',@pubsub); eval($pubsub);
}
# If it's not a command, then search for a reply... (many thanks to Eric for the reply code!!!!) $reply = reply($username,$msg); if ($reply eq 'not a recognised command') {return} &send($self,"$reply", "$username"); }
sub send { my ($self,$response,$username) = (shift,shift,shift); &sorttime();
open (DATA, ">>./Logs/Users/$username.txt"); print DATA " <$date $time> $response\n"; close(DATA);
open (FILE, "./Settings/colour.txt"); my $clr = ; close(FILE);
$self->sendmsg($response, Color => $clr, Font => 'Verdana', Effect => 'B', @_); }
sub Connected { sorttime(); open (DATA, ">>./Logs/Connections.txt"); print DATA " $date $time\n"; close(DATA); print " Connected to server.\n\n"; }
sub Leave { my ($self, $username) = @_; print "Window: $username closed window\n"; open (DATA, ">>./Logs/Users/$username.txt"); print DATA "\n"; close(DATA); }
sub UpdateBuddies { my ($self, $username) = @_; print "Window: $username opened window\n"; open (DATA, ">>./Logs/Users/$username.txt"); print DATA "\n"; close(DATA); &send($self,"Welcome to MayaBot!", "$username"); }
sub Status { my ($self, $username, $newstatus) = @_; print "Status: ${username}'s status changed from " . $self->buddystatus($username) . " to $newstatus.\n"; open (DATA, ">>./Logs/Users/$username.txt"); print DATA " Changed from " . $self->buddystatus($username) . " to $newstatus.\n"; close(DATA); }
sub Answer { my ($self, $username) = @_; }
sub Join { my ($self,$username,$friendly) = @_; }
## ## Non MSN subs next... ##
sub GetSettings { # First time run stuff open (FILE, "./settings/firsttime.txt"); $firsttime = ; close(FILE); if ($firsttime ne "1") { print " Warning! The MayaBot configuration script has not yet been run!\n Would you like to run this now? [yes/no] "; $input = ; chomp $input; if ($input =~ /yes/i) { print "\n\n"; system('perl configure.pl'); } else { print "\n This message will not come up again.\n"; open (DATA, ">settings/firsttime.txt"); print DATA "1"; close(DATA); } print " \n\n"; sleep(1); }
open (FILE, "./settings/username.txt"); $bot_handle = ; close(FILE);
open (FILE, "./settings/char.txt"); $comchar = ; close(FILE);
open (FILE, "./settings/password.txt"); $bot_pass = ; close(FILE);
open (FILE, "./settings/admin.txt"); $admin = ; close(FILE);
open (FILE, "./settings/mods.txt"); @moderators = ; close(FILE); chomp @moderators;
return; }
sub replace { my $w = shift; open (FILE, "./Store/replace.txt"); my @file = ; close(FILE); foreach (@file) { $_ =~ s/\n//; my ($a,$b) = split (/\|/, $_, 2); $w =~ s/\b$a\b/$b/ig; } return $w; }
if ( $msg =~ /$temp/i ) { $reply = $test->{Responce}; my $one = $1 unless !defined($1); #define the variable so that we can use them in my $two = $2 unless !defined($2); #the responce files my $three = $3 unless !defined($3); my $four = $4 unless !defined($4); my $five = $5 unless !defined($5); my $six = $6 unless !defined($6); my $seven = $7 unless !defined($7); my $eight = $8 unless !defined($; my $nine = $9 unless !defined($9);
#print "\n$reply\n"; while ($reply =~ /\@(.+?) / || $reply =~ /\{\@(.+?)\}/) #process named lists in { } and out { $reply =~ s/(\@(.+?)) /JoinEM(0, $ListHash->{$2}) ." "/ige; $reply =~ s/(\{\@(.+?)\})/JoinEM(0, $ListHash->{$2})/ige; } #print $reply ."\n"; $reply =~ s/\((.*?\|.*?)\)/pick_one($1)/eg; #process unnamed lists
my @tosay = split(/\|/,$reply); #break apart multiple responces seperated by $reply = $tosay [ int(rand(scalar(@tosay))) ]; #randomly pick one