}
$kernel->post( $src, $replypath, substr( $text, 0, 354 ), $dest );
}
+
+KARMADOWN: |-
+ sub {
+ my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
+ if( !exists( $heap->{ "karma" } ) ) {
+ if( -e "karma.yaml" ) {
+ $heap->{ "karma" } = LoadFile( "karma.yaml" );
+ } else {
+ $heap->{ "karma" } = {};
+ }
+ }
+ if( !exists( $heap->{ "karma" }->{ uc( $what ) } ) ) {
+ $heap->{ "karma" }->{ uc( $what ) } = -1;
+ } else {
+ $heap->{ "karma" }->{ uc( $what ) }--;
+ }
+ DumpFile( "karma.yaml", $heap->{ 'karma' } );
+ }
+
+KARMAUP: |-
+ sub {
+ my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
+ if( !exists( $heap->{ "karma" } ) ) {
+ if( -e "karma.yaml" ) {
+ $heap->{ "karma" } = LoadFile( "karma.yaml" );
+ } else {
+ $heap->{ "karma" } = {};
+ }
+ }
+ if( !exists( $heap->{ "karma" }->{ uc( $what ) } ) ) {
+ $heap->{ "karma" }->{ uc( $what ) } = 1;
+ } else {
+ $heap->{ "karma" }->{ uc( $what ) }++;
+ }
+ DumpFile( "karma.yaml", $heap->{ 'karma' } );
+ }
+
+KARMA: |-
+ sub {
+ my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_;
+ if( !exists( $heap->{ "karma" } ) ) {
+ if( -e "karma.yaml" ) {
+ $heap->{ "karma" } = LoadFile( "karma.yaml" );
+ } else {
+ $kernel->post( $src, $replypath, "$what has no karma.", $dest );
+ return;
+ }
+ }
+ if( exists( $heap->{ "karma" }->{ uc( $what ) } ) ) {
+ $kernel->post( $src, $replypath, "$what has ".$heap->{ "karma" }->{ uc( $what ) }." karma", $dest );
+ } else {
+ $kernel->post( $src, $replypath, "$what has no karma.", $dest );
+ }
+ }
}
if( $cmd =~ /^[~].*/ ) {
$kernel->post( "core", "cmd", $who, $msg, $self->{ "ssid" }, $dest->[0], "send_public_to" );
- } elsif( $msg =~ m!(https?://[^[:space:]]+)!i && $self->{ "trapEnabled" } == 1 && length($1) >= 30 ) {
- print( "IRC : URL Trapped: '$1' from $who\n" );
- my $url = $1;
- if( $self->{ "trap" } ) {
- $kernel->post( "core", "cmd", $who, "SHORTEN ".$self->{ "trap" }." $url", $self->{ "ssid" }, $dest->[0], "send_public_to" );
- } else {
- $kernel->post( "core", "cmd", $who, "SHORTEN $url", $self->{ "ssid" }, $dest->[0], "send_public_to" );
+ } else {
+ if( $msg =~ m!(https?://[^[:space:]]+)!i && $self->{ "trapEnabled" } == 1 && length($1) >= 30 ) {
+ print( "IRC : URL Trapped: '$1' from $who\n" );
+ my $url = $1;
+ if( $self->{ "trap" } ) {
+ $kernel->post( "core", "cmd", $who, "SHORTEN ".$self->{ "trap" }." $url", $self->{ "ssid" }, $dest->[0], "send_public_to" );
+ } else {
+ $kernel->post( "core", "cmd", $who, "SHORTEN $url", $self->{ "ssid" }, $dest->[0], "send_public_to" );
+ }
+ }
+ if( $msg =~ m/(.+)--$/ ) {
+ $kernel->post( "core", "cmd", $who, "KARMADOWN $1", $self->{ "ssid"}, $dest->[0], "send_public_to" );
+ } elsif( $msg =~ m/(.+)\+\+$/ ) {
+ $kernel->post( "core", "cmd", $who, "KARMAUP $1", $self->{ "ssid"}, $dest->[0], "send_public_to" );
}
}
}