### partie en TCL bind pub - "pinpin:" pinpin bind join - *!*@* onjoin bind ctcr - VERSION sale set egglogs "/path/vers/les/logs/" # pinpin is BACK proc pinpin { nick host handle channel text } { set line [exec /path/vers/pinpin.pl $text] if {$line==""} { return 1; } puthelp "PRIVMSG $channel :$nick: $line" return 0 } proc onjoin { nick uhost hand chan args } { global curchan set curchan $chan putserv "PRIVMSG $nick :\001VERSION\001" putserv "WHOIS $nick" return 0 } proc sale { nick userhost handle dest key text } { global curchan global lastnick set client $text if { [string match $lastnick $nick] } { return 0 } puthelp "PRIVMSG $curchan :$nick runne $text" if { [string match *windows* [string tolower $client]] || [string match *mirc* [string tolower $client]] } { puthelp "PRIVMSG $curchan :$nick TU ES *SALE*!@#!!" puthelp "PRIVMSG chanserv :voice $curchan $nick" } set lastnick $nick return 0 } putlog "GCU egg module loaded." ### Partie en Perl #!/usr/bin/perl use Math::TrulyRandom; use Math::Random; my $logdir="/path/vers/les/logs/"; my $logfmt="gcu\.log\."; my $maxatt=3; my $hello="\ (\'lo|lo|re .*|hello|lu|y0.|yop.*)\ *"; my $kword; opendir(DIR, $logdir); @files = sort(grep(/$logfmt/, readdir(DIR))); closedir(DIR); @files = random_permutation(@files); srand(truly_random_value()+time); for (my $at=0;$at<$maxatt;$at++) { if ($words[scalar(@ARGV)-1] =~ m/\?/) { $kword=$words[rand(scalar(@ARGV))].".*\?"; } else { $kword=$words[rand(scalar(@ARGV))]; } my $logfile=$logdir.$files[rand(scalar(@files))-1]; open(LOG,$logfile); @array=; close(LOG); my $size=scalar(@array); my $idx=rand($size); for(;$idx<$size;$idx++) { $line=$array[$idx]; if ($line =~ m/.*<.*>.*$kword.*/i) { if (($idx < $size) && ($array[$idx+1] =~ m/.*<.*>.*/)) { $line=$array[$idx+1]; } $line =~ s/\[[0-9]+\:[0-9]+\]\ <.*>\ //; $line =~ s/^[^\ ]+\ *\:\ *//; if (!($line =~ m/$hello/i)) { print($line); # occ found, exit exit 0; } } } } # no occ was found # pick up random phrase then my $idx=rand($size); for(;$idx<$size;$idx++) { $line=$array[$idx]; if ($line =~ m/.*<.*>.*/) { $line =~ s/\[[0-9]+\:[0-9]+\]\ <.*>\ //; $line =~ s/^[^\ ]+\ *\:\ *//; print($line); exit 0; } }