Assist plugin for BeBot 0.3.5+
returns a generic assist macro if you don't give it a name
Assist.php:
<?php
/*
* Assist module for Bebot 0.3.5+ created by Parfet of Rimor
*
* BeBot - An Anarchy Online Chat Automaton
* Copyright (C) 2004 Jonas Jax
* Copyright (C) 2005 Thomas J. Stens� and ShadowRealm Creations
*
* Developed by:
* - Blondengy (RK1)
* - Khalem (RK1)
*
* See Credits file for all aknowledgements.
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
*  USA
*
* File last changed at $LastChangedDate: 2007-06-12 15:09:11 +0200 (Tue, 12 Jun 2007) $
* Revision: $Id: _ExampleModule.php 619 2007-06-12 13:09:11Z alreadythere $
*/
/*
Add a "_" at the beginning of the file (_Assist.php) if you do not want it to be loaded.
*/
$assist = new assist($bot);
$commands["tell"]["assist"] = &$assist;
$commands["pgmsg"]["assist"] = &$assist;
$commands["gc"]["assist"] = &$assist;
/*
The Class itself...
*/
class Assist
{
	var $bot;
	var $help;
	/*
	Constructor:
	Hands over a referance to the "Bot" class.
	Defines access control for the commands
	Creates settings for the module
	Defines help for the commands
	*/
	function Assist (&$bot)
	{
		$this -> bot = &$bot;
		$this -> bot -> accesscontrol -> create ('tell', 'assist', 'ANONYMOUS');
		$this -> bot -> accesscontrol -> create ('gc', 'assist', 'ANONYMOUS');
		$this -> bot -> accesscontrol -> create ('pgmsg', 'assist', 'ANONYMOUS');
		$this -> help['description'] = 'Assist module for BeBot 0.3.5+';
		$this -> help['command']['assist']="Provides a generic '/assist' macro.";
		$this -> help['command']['assist name'] = "Provides an '/assist name' macro.";
	}
	/*
	This gets called on a tell with the command
	*/
	function tell($name, $msg)
	{
		$this -> bot -> send_tell($name, $this -> assist_blob($msg));
	}
	/*
	This gets called on a msg in the privgroup with the command
	*/
	function pgmsg($name, $msg)
	{
		$this -> bot -> send_pgroup($this -> assist_blob($msg));
	}
	/*
	This gets called on a msg in the guildchat with the command
	*/
	function gc($name, $msg)
	{
		$this -> bot -> send_gc($this -> assist_blob($msg));
	}
	/*
	This creates the /assist blob
	*/
	function assist_blob($msg)
	{
		$msg = rtrim($msg);
		if (preg_match("/^" . $this -> bot -> commpre . "assist ([a-zA-Z0-9]{4,25})$/i", $msg, $info)) {
			$name = ucfirst(strtolower($info[1]));
			$inside = "<center>##White##:##Red##:##White##:";
			$inside .= " <a href='chatcmd:///macro $name /assist $name'>Assisting $name</a>.";
			$inside .= " :##Red##:##White##:##End##</center>";
			return $this -> bot -> make_blob("Click", $inside) . " to assist ##Highlight##$name##End##.";
		} else {
			$inside = "<center>##White##:##Red##:##White##:";
			$inside .= " <a href='chatcmd:///macro Assist /assist'>Assist Macro</a>.";
			$inside .= " :##Red##:##White##:##End##</center>";
			return $this -> bot -> make_blob("Click", $inside) . " to make a generic assist macro.";
		}
	}
}
?>
suggestions welcome