class yourclass extends ziggi

If your class extends ziggi, what you'll ultimately gain are methods that control some of botzilla. Ziggis have free reign to do whatever you make them do, but there are two guiding pricipals that you should follow to make a good plugin (for the repo; on your own, you can do whatever you want):

function parseBuffer() {}

Whatever your class does could queue up and send messages to channels or nicknames, or queue up or cancel a timed event. All you need to do is use the methods inherited from ziggi, the rest should take care of itself.

Whenever botzilla "hears" something, it will call parseBuffer() on your class, so you'll want to write your own business code there.

say something

Getting stuff from the buffer

Events

basic example

Here's a little ziggi that gives back some server info, and also your name.

<?
/**
@author bibby <bibby@botzilla.org>
this class is listening for two commands,  '.uptime' and '.whoami'
*/

class example extends ziggi
{
    function 
example()
    {
    }
    
    
// any ziggi will NEED a parseBuffer (but that's it)
    
function parseBuffer()
    {
        if( 
substr$this->getText(),0,1) != CMD_CHAR)
            return 
false;
        else
            
$cmd substr($this->getArg(0),1);
            
        
/*
        If whatever came through the pipe didn't start with the command character,
        then we'll just return false. Not every ziggi has to do this, but this
        example is using the idea of "commands".
        If the string did start with the command character, then we'll cut it
        off of the first word. ( getArg(0) is the first word )
        */
        
        // find if this word is something to act upon
        
switch(strtolower($cmd))
        {
            case 
'uptime':
                
$this->uptime();
                break;
            case 
'whoami':
                
$this->whoami();
                break;
                
            
//or, something I like, but you lose function privacy
            /**
            if(method_exists($this,$cmd))
                $this->$cmd();
            */
        
}
    }
    
    function 
uptime()
    {
        
$this->pmshell_exec('uptime') );
        
// a standard private message returns back to its origin, be it a channel or a private session.
    
}
    
    function 
whoami()
    {
        
$this->pm"You are ".$this->getUser()." (".$this->getIdent().")" $this->getUser() );
        
// declaring a second argument will send the message to a particular nick or channel
    
}
    
    
/* that's it! save this file in ziggi/ , and add the filename in botzilla.php, and you're rockin. */
}
?>