Show
Ignore:
Timestamp:
02/14/2008 08:30:06 PM (11 months ago)
Author:
Shadowhand
Message:

I <3 Kobot

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/kobot/controllers/kobot.php

    r2049 r2051  
    77                // Start a new bot 
    88                $bot = new Kobot('irc.freenode.net'); 
     9 
     10                // Add triggers 
     11                $bot->add_trigger(array($this, 'trigger_say'),  '^tell (.+?) about (.+)$') 
     12                    ->add_trigger(array($this, 'trigger_trac'), '^[r|#](\d+)$') 
     13                    ->add_trigger(array($this, 'trigger_php'),  '^([a-z_]+)$'); 
    914 
    1015                // Enable debugging 
     
    2126        } 
    2227 
     28        public function trigger_say(Kobot $bot, array $data, array $params) 
     29        { 
     30                switch ($params[1]) 
     31                { 
     32                        case 'yourself': 
     33                                $bot->send('PRIVMSG '.$data['target'].' :Who wants to know? '.$params[0].'? HA!'); 
     34                        break; 
     35                } 
     36        } 
     37 
    2338} // End