#
# This is a script that linuxalien runs. Please improve it, to your taste.Due to abuse, I have removed the ability to edit this script. Feel free to edit your own copy, diff the original, and send me a patch for inclusiong. It currently runs in #plug and #aioc on irc.sydneywireless.com (connect to irc.wafreenet.org if your on WAIX)
# PLEASE DO NOT REMOVE THE #'s FROM THE START OF THE LINES as they are required for this page
# Do not remove age check functions I plan to move them out of here soon anyway
#
use Irssi; use vars qw($VERSION %IRSSI); #use Data::Dumper; use strict; $VERSION = "1.0.0.1"; %IRSSI = ( author => 'Linuxalien', contact => 'gimmie2.linuxalien\@weirdo.bur.st', name => 'gimmie2', description => 'a bot script, modified from gimmie from PrincessLeia2. See the original gimmie.pl on irssi.org/scripts', license => 'GNU GPL v2 or later', url => 'http://members.plug.org.au/~linuxalien/dokuwiki/gimmie2.pl' ); sub event_privmsg { my ($server, $data, $nick, $mask, $target) =@_; #print "$target | $nick"; my $tag = lc($server->{tag}); #print Dumper($server); #print "$tag"; my ($action, $target, $text) = $data =~ /^(\S*)\s(\S*)\s:(.*)/; #print "$target"; if($target eq "linuxalien"){ $target = $nick;} #print "$target | $text | $action"; #return if ( $text !~ /^!/i ); if($text =~ /^!lastseen/i || $text =~ /^!lastspoke/i || $text =~ /^!seen/i){ return; # This is because we also have the lastseen script running } if($nick =~ /chanserv/i || $nick =~ /nickserv/i ){ return; # Prevents ChanServ and NickServ causing problems } if($text =~ /st(art|op)keylogger/i || $text =~ /\+\+\+ATH/i){ print "Kicking $nick from $target for using a banned word"; $server->command ( "action Weirdo kicking $nick from $target for using a banned word '$text'" ); #$server->command ( "msg ChanServ deprotect $target $nick" ); #Safety #$server->command ( "msg ChanServ kick $target $nick [Using banned word]" ); my ($rand) = int(rand(2)); if($rand){ $server->command ( "msg $target I should kick you for using that word! Don't let me hear it again $nick!"); }else{ $server->command ( "msg $target I'm telling Mummy! $nick used a bad word!"); } return; } # gimmie actions if ( $text =~ /^!(coffe+.*|java|tea|joe|milo|cocoa)/i ) { $server->command ( "action $target hands $nick a steaming cup of $1" ); } elsif ( $text =~ /^!(decaf.*)/i ) { $server->command ( "action $target hands $nick a steaming cup of $1" ); } elsif ($text =~ /^!chimay/i ) { $server->command ( "action $target hands $nick a glass of Chimay" ); } elsif ($text =~ /^!pepsi/i ) { $server->command ( "action $target gives $nick a can of Star Wars Pepsi" ); } elsif ($text =~ /^!ice *cream/i ) { $server->command ( "action $target gives $nick a chocolate ice cream with lots of cherries" ); } elsif ($text =~ /^!lamune/i ) { $server->command ( "action $target pours $nick a glass of sparkling, ice-cold lamune." ); } elsif ($text =~ /^!c+o+k+e/i ) { $server->command ( "action $target shakes up a can of Coke-a-Cola, before handing it to $nick..." ); $server->command ( "action $target ducks as the coke can explodes"); } elsif ($text =~ /^!(be+er.*)/i && check_ages_mask($mask)) { $server->command ( "action $target pours $nick an ice cold $1, into a BIG glass, with lots of head on it... Drink Up!" ); } elsif (!check_ages_mask($mask) &&($text =~ /!.*(be+er)/i || $text =~ /!.*(b33.*)/i)) { $server->command ( "action $target escorts $nick out of the pub in handcuffs for trying to get a $1 while still a minor"); } #elsif (check_ages($nick)) { # $server->command ( "msg $target Ahhh, someone my own age. Nice to meet you $nick"); #} elsif ($text =~ /^!$nick/i ) { $server->command ( "msg $target I'm sure YOU can get yourself! I won't!" ); } elsif ($text =~ /^!src/i ) { gen_src($server, $nick); } elsif ($text =~ /^!flood/i ) { $server->command ( "msg $nick I'll give you flood!" ); } elsif ($text =~ /^!l+o+g+s+/i ) { $server->command ( "msg $target Mine I tell you! All mine! Go away from my logs!" ); } elsif ($text =~ /^help($|:|\s)+(\w*)/i){ help($server, $target, $3, $nick); } elsif ($text =~ /!peak/i){ channel_peak($server, $tag, $target); } elsif ($text =~ /^!:(\S+) lovesme/i){ lovesme($server, $target, $1, $nick); } elsif ($text =~ /^!:(\S+)(.+)/i ) { $server->command ( "action $target gets $1$2"); } elsif ( $text =~ /^ !.+/i ) { my ($gimmie) = $text =~ /!(.+)/; $server->command ( "action $target gets $nick $gimmie"); } # normal convo response actions elsif ( $text =~ /duck/i ) { $server->command ( "action $target ducks away from $nick" ); } # elsif ( $text =~ /(knife|knive)/i ) { # $server->command ( "msg $target That's not a knife! THIS is a knife!" ); # $server->command ( "action $target holds up a giant spoon to ".$nick."'s face" ); # } # elsif ( $text =~ /\b(cut|stab|eat|slice)/i ) { # $server->command ( "msg $target $1 with what?" ); # } elsif ( $text =~ /linuxalien/i && $text =~ /die/i ) { $server->command ( "action $target rolls over and plays dead for $nick" ); } # Morning/Evening/Afternoon greetings (Thanks John) elsif ( $text =~ /^(hello|morning|midday|noon|evening|afternoon|goodnight|g*nite|g*night|midnight|g'day|g'nite|g'night|night|nacht|middag|hallo)(\,?\s?(all|everyone|plug|linuxalien|mate|allen|iedereen|$))+/i ) { $server->command ( "msg $target $1 $nick" ); } # elsif ( $text =~ /^night/i || $text =~ /^nite/i || $text =~ /^goodni(gh)*t/i) { # $server->command ( "msg $target Sleep well $nick" ); # } # elsif ( $text =~ /^evening/i) { # $server->command ( "msg $target Evening $nick" ); # } # elsif ( $text =~ /^afternoon/i) { # $server->command ( "msg $target Afternoon $nick" ); # } else { return; } } my $agefile = glob "~/.irssi/nicks.ages"; sub check_ages { my ($nick) = @_; return if ($nick eq ""); open (f, $agefile) || return; while(<f>) { chomp; my $user = $_; return 1 if($user eq $nick); next; } close(f);return 0; } my $maskagefile = glob "~/.irssi/masks.ages"; sub check_ages_mask { my ($mask) = @_; return 0 if ($mask eq ""); open (f, $maskagefile) || return 0; while(<f>) { chomp; my $allowedmask = $_; return 1 if($mask =~ /$allowedmask/); next; } close(f);return 0; } sub lovesme { my ($server, $target, $who, $nick) = @_; my ($petals) = 3 + int(rand(8)); my ($flip) = int(rand(2)); $server->command ( "action $target picks a flower... Does $who love $nick?" ); for(my ($i) = 0; $i<$petals; $i++){ if($flip){ $flip = 0; $server->command ( "action $target pulls off a petal... $who loves $nick!" ); }else{ $flip = 1; $server->command ( "action $target pulls off a petal... $who loves you not $nick :-("); } } if($flip){ $server->command ("msg $target Sorry $nick, but $who does not love you :'("); }else{ $server->command ("msg $target Yay! $nick, $who loves you! I hear wedding bells ringing! :D"); } } sub help { my ($server, $target, $subject, $nick) = @_; # print "$target, $subject, $nick"; #DEBUG my %help_topics = ( me => "Help yourself! If you really need help... then run the help command by it's self!", version => "linuxalien's version is $VERSION", channels => "linuxalien monitors #aioc, #plug, and #asterisk", die => "Asking linuxalien to die, will result in a kick.... Or will it?", beer => "This command asks linuxalien to pour you a beer. Due to the fact that linuxalien runs in channels with minors, and is situated in Australia, linuxalien requires an age check. To organise an age check, and being put in the authorised beer users file, please contact Weirdo. (NB: Linuxalien serve's more than just beer)", ); my $help = ''; if($subject) { $help = $help_topics{$subject};} if(!$help){ $server->command ("msg $nick Welcome to linuxalien's Help. Here you will find help for common functions, as well as short list of triggers. Some triggers are not here, so you have the opportunity to find them yourself. Please select a help subject you wish to know more information about."); # Default condition (TODO, add list of topics) my $topics = ''; foreach my $topic ( keys %help_topics ) { $topics = "$topics $topic"; } $server->command ("msg $nick The help topics are: $topics"); }else{ $server->command ("msg $nick $help"); } } sub gen_src { my ($server, $nick) = @_; open GENSRC, "~/gensrc |"; # generate src my $line; while ( $line = <GENSRC> ) { # note the use of indirection #print $line; # DEBUG $server->command ("msg $nick $line "); } close GENSRC; } sub channel_peak { # NEEDS Chanpeak plugin to work my ($server, $tag, $chan) = @_; if (exists $::chanpeak{$chan}) { foreach my $key (keys %{$::chanpeak{$chan}}) { if ($key eq $tag || $tag eq "") { $server->command("msg $chan Peak for ".$chan."@".$key.": ". $::chanpeak{$chan}{$key}{peak}." (". localtime($::chanpeak{$chan}{$key}{date}).")"); } } return 0; } else { $server->command ("msg $chan No peak found, ensure you are in a channel running this command"); } } Irssi::signal_add('server event', 'event_privmsg'); #Irssi::signal_add("message own_public", "on_public"); #Irssi::signal_add('event privmsg', 'event_privmsg'); #Irssi::signal_add('ctcp action', 'event_privmsg'); print CLIENTCRAP '%B>>%n '.$IRSSI{name}.' '.$VERSION.' loaded:'; #
0