From eedae5cef157f42eeef6cf967292e4ec6066bf20 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Thu, 28 Jul 2005 01:34:28 +0000 Subject: replaces \!who by in knowledge --- bot.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bot.pl b/bot.pl index ea7a831..bae4643 100644 --- a/bot.pl +++ b/bot.pl @@ -7,8 +7,8 @@ use DBI; use POE; use POE::Component::IRC; -my $current_nick = 'francoise_'; -my $channel = '#test'; +my $current_nick = 'francoise'; +my $channel = '#kiffer.de'; POE::Component::IRC->new("francoise"); POE::Session->new ( _start => \&irc_start, @@ -133,6 +133,8 @@ sub irc_pub_msg{ my @words = (split / /, $msg); my $w0rds = 0; + return if $nick_ eq $current_nick; + #tidy nick and tidy msg from dest nick my $nick = francoise_verifyuser( $nick_, "", 0, $kernel ); $msg =~ s/^\S+: +//; @@ -176,12 +178,12 @@ sub irc_pub_msg{ my $thr = join ' ', $dbh->selectrow_array( "SELECT trigger, hilfsverb, reply FROM knowledge WHERE trigger = ? ORDER BY RANDOM() LIMIT 1", undef, $msg ); $thr =~ s/^.*?(?: )(.*)$/$1/; + $thr =~ s/!who/$nick/g; $kernel->post( 'francoise', 'privmsg', $channel, $thr ) if $thr; } #credit word and line count to user - $dbh->do( "UPDATE users SET lines = lines + 1, words = words + ?, w0rds = w0rds + ?, isaway = false WHERE nick = ?", - undef, $#words + 1, $w0rds, $nick ) if $nick ne $current_nick; + $dbh->do( "UPDATE users SET lines = lines + 1, words = words + ?, w0rds = w0rds + ?, isaway = false WHERE nick = ?", undef, $#words + 1, $w0rds, $nick );; print "$channel: <$nick> $msg\n"; } -- cgit v1.2.3