And heres an example for Guild bots:
<?
  /*
   * LogonNotify_GUILD.php -
   *
   * BeBot - An Anarchy Online Chat Automaton
   * Copyright (C) 2004 Jonas Jax
   *
   * Developed by Blondengy (RK1)
   * Special thanks goes out to Khalem (RK1) for his support.
   *
   * File last changed at $LastChangedDate: 2004-12-29 01:41:32 +0100 (Wed, 29 Dec 2004) $
   * Revision: $Id$
   */
  $LogonNotify = new LogonNotify($bot);
  $commands["buddy"][] = &$LogonNotify;
  $commands["connect"][] = &$LogonNotify;
  /*
    The Class itself...
  */
  class LogonNotify
  {
    var $bot;
    var $start;
    /*
      Constructor:
        Hands over a referance to the "Bot" class.
    */
    function LogonNotify (&$bot)
    {
      $this -> bot = &$bot;
    }
    /*
      This gets called if a buddy logs on/off
    */
    function buddy($name, $msg)
    {
        if ($this -> start < time())
        {
                if ($this -> bot -> is_member($name) == 1)
                {
                        if ($msg == 1)
                        {
                                // A generic welcome message example
                                $this -> bot -> send_tell($name, "Welcome to " . $this -> bot -> guildname . " " . $name);
                                // Lets show the online list
                                $this -> bot -> commands["tell"]["online"] -> tell($name, "online");
                                // Lts show the news too
                                $this -> bot -> commands["tell"]["news"] -> tell($name, "news");
                        }
                }
        }
    }
    /*
      This gets called when bot connects
    */
    function connect()
    {
        $this -> start = time() + $this -> bot -> crondelay;
    }
  }
?>