From 15d058ce6833c840aa9696c9cc06a25319a4dc5c Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 20 Nov 2010 15:18:15 +0100 Subject: [PATCH] Learn from background talk, not only direkt talk --- Commands/Misc.pm | 9 +++++++++ Delling.pm | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Commands/Misc.pm b/Commands/Misc.pm index ae4b561..fb05348 100644 --- a/Commands/Misc.pm +++ b/Commands/Misc.pm @@ -55,5 +55,14 @@ FROM (SELECT now() - time AS time FROM last_smokes WHERE nick = $1) l } }; +command teachbot => { + help => q(dummy command), + acl => 'irc_teachbot', + type => q(teachbot), +}, class extends NDIRC::Command { + method execute($c,$msg) { + } +}; + 1; diff --git a/Delling.pm b/Delling.pm index f19bf2a..df44711 100644 --- a/Delling.pm +++ b/Delling.pm @@ -61,10 +61,11 @@ after irc_public => sub { unless ($irc->is_channel_member($channel,$1) || /(Constructing|Researching)/){ $msg = ".anon $_ $text"; } - - } - if ($self->parseCommand($msg,$irc,$nick,$address,$channel,$dbh)){ + }elsif ($self->parseCommand($msg,$irc,$nick,$address,$channel,$dbh)){ #Command parsed and run successfully + }elsif($self->disp->has_command('teachbot',$channel)){ + $msg =~ s/^\S+:\s*//; + $self->hal->learn($msg); } }; -- 2.39.2