diff options
author | erdgeist <> | 2005-07-26 14:12:27 +0000 |
---|---|---|
committer | erdgeist <> | 2005-07-26 14:12:27 +0000 |
commit | 1d8f586ba44d338321de8634e643c0a15ececbc8 (patch) | |
tree | fec230b1771f558a01fc10265f315607b4a7e9ae | |
parent | d297717cfb35e77701997e3722b4a09b3dae7091 (diff) |
Sammelt nu ooch Worte
-rw-r--r-- | bot.pl | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -7,8 +7,8 @@ use DBI; | |||
7 | use POE; | 7 | use POE; |
8 | use POE::Component::IRC; | 8 | use POE::Component::IRC; |
9 | 9 | ||
10 | my $current_nick = 'francoise_'; | 10 | my $current_nick = 'francoise'; |
11 | my $channel = '#test'; | 11 | my $channel = '#kiffer.de'; |
12 | 12 | ||
13 | POE::Component::IRC->new("francoise"); | 13 | POE::Component::IRC->new("francoise"); |
14 | POE::Session->new ( _start => \&irc_start, | 14 | POE::Session->new ( _start => \&irc_start, |
@@ -148,7 +148,18 @@ sub irc_pub_msg{ | |||
148 | &{$commands{ $1 } || \&francoise_donothing } ( $kernel, $channel, $2 ); | 148 | &{$commands{ $1 } || \&francoise_donothing } ( $kernel, $channel, $2 ); |
149 | } | 149 | } |
150 | 150 | ||
151 | if( $msg =~ /^wo ist (\S+)\??$/i ) { | 151 | for my $word ( @words ) { |
152 | my $is0r = 'false'; my $isact = 'false'; | ||
153 | my $sth = $dbh->prepare( "SELECT COUNT(*) FROM words WHERE word = ?"); | ||
154 | $sth->execute( $word ); | ||
155 | next if (($sth->fetchrow_array)) > 0; | ||
156 | $is0r = 'true' if $word =~ /0r/; | ||
157 | $isact = 'true' if $word =~ /^\*.*\*$/; | ||
158 | $sth = $dbh->prepare("INSERT INTO words ( word, is_0r, is_action ) VALUES ( ?, ?, ? )"); | ||
159 | $sth->execute( $word, $is0r, $isact ); | ||
160 | } | ||
161 | |||
162 | if ( $msg =~ /^wo ist (\S+)\??$/i ) { | ||
152 | my $wois_ = $1; | 163 | my $wois_ = $1; |
153 | my $wois = francoise_getbasenick( $1 ); | 164 | my $wois = francoise_getbasenick( $1 ); |
154 | my $sth = $dbh->prepare( "SELECT awaymsg FROM users WHERE nick = ? AND isaway = 'true'"); | 165 | my $sth = $dbh->prepare( "SELECT awaymsg FROM users WHERE nick = ? AND isaway = 'true'"); |
@@ -229,9 +240,7 @@ sub irc_whois{ | |||
229 | 240 | ||
230 | sub francoise_getbasenick{ | 241 | sub francoise_getbasenick{ |
231 | my $nick = $_[0]; | 242 | my $nick = $_[0]; |
232 | 243 | $nick =~ s/^(.+)[_|^-].*/$1/; | |
233 | $nick = ( split /_/, $nick )[0] || $nick; | ||
234 | $nick = ( split /\|/, $nick )[0] || $nick; | ||
235 | 244 | ||
236 | my $sth = $dbh->prepare( "SELECT nick FROM aliases WHERE alias = ?" ); | 245 | my $sth = $dbh->prepare( "SELECT nick FROM aliases WHERE alias = ?" ); |
237 | $sth->execute($nick); | 246 | $sth->execute($nick); |