Login   Register  
PHP Classes
elePHPant
Icontem

File: plugins/helloworld.class.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Sergei Miami  >  Joker the IRC bot  >  plugins/helloworld.class.php  >  Download  
File: plugins/helloworld.class.php
Role: Example script
Content type: text/plain
Description: Hello World plugin
Class: Joker the IRC bot
Base for building IRC bot
Author: By
Last change: Fixed license line
Date: 2010-06-18 21:53
Size: 816 bytes
 

Contents

Class file image Download
<?php

/**
 * @package    Joker
 * @subpackage Plugins
 * @author     Miami <miami@blackcrystal.net>
 * @version    1.1 on 26/05/2010
 * @license    Released under the MIT License
 * @link       www.blackcrystal.net
 * 
 * HelloWorld plugin
 *
 * This example plugin says "Hello, #channelname" when bot
 * joins any channel. After the first Hello it removes himself from
 * plugins and don't recieve events anymore.
 *
 * What we have here:
 *   - Plugin is listens to JOIN event
 *   - Plugin send MSG if bot joins channel
 *   - Plugin removes himself from plugins
 */

class HelloWorld {

  public function 
JOIN(Joker $joker)
  {
    if ( 
$joker->nick == $joker->me )
    {
      
$joker->msg($joker->chan,'Hello, '.$joker->chan);
      
$joker->unload('HelloWorld');
    }
  }
  
}