summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bot.pl21
1 files 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;
7use POE; 7use POE;
8use POE::Component::IRC; 8use POE::Component::IRC;
9 9
10my $current_nick = 'francoise_'; 10my $current_nick = 'francoise';
11my $channel = '#test'; 11my $channel = '#kiffer.de';
12 12
13POE::Component::IRC->new("francoise"); 13POE::Component::IRC->new("francoise");
14POE::Session->new ( _start => \&irc_start, 14POE::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
230sub francoise_getbasenick{ 241sub 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);