From 1d8f586ba44d338321de8634e643c0a15ececbc8 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Tue, 26 Jul 2005 14:12:27 +0000 Subject: Sammelt nu ooch Worte --- bot.pl | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/bot.pl b/bot.pl index 0c0a426..90f2047 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, @@ -148,7 +148,18 @@ sub irc_pub_msg{ &{$commands{ $1 } || \&francoise_donothing } ( $kernel, $channel, $2 ); } - if( $msg =~ /^wo ist (\S+)\??$/i ) { + for my $word ( @words ) { + my $is0r = 'false'; my $isact = 'false'; + my $sth = $dbh->prepare( "SELECT COUNT(*) FROM words WHERE word = ?"); + $sth->execute( $word ); + next if (($sth->fetchrow_array)) > 0; + $is0r = 'true' if $word =~ /0r/; + $isact = 'true' if $word =~ /^\*.*\*$/; + $sth = $dbh->prepare("INSERT INTO words ( word, is_0r, is_action ) VALUES ( ?, ?, ? )"); + $sth->execute( $word, $is0r, $isact ); + } + + if ( $msg =~ /^wo ist (\S+)\??$/i ) { my $wois_ = $1; my $wois = francoise_getbasenick( $1 ); my $sth = $dbh->prepare( "SELECT awaymsg FROM users WHERE nick = ? AND isaway = 'true'"); @@ -229,9 +240,7 @@ sub irc_whois{ sub francoise_getbasenick{ my $nick = $_[0]; - - $nick = ( split /_/, $nick )[0] || $nick; - $nick = ( split /\|/, $nick )[0] || $nick; + $nick =~ s/^(.+)[_|^-].*/$1/; my $sth = $dbh->prepare( "SELECT nick FROM aliases WHERE alias = ?" ); $sth->execute($nick); -- cgit v1.2.3