This lets you set a message to send a bot member everytime he logs on
!loginmessage <message> (sets the message)
!loginmessage (clears the message)
modules/LoginMessage.php
<?
$loginMessage = new LoginMessage($bot);
$commands["tell"]["loginmessage"] = &$loginMessage;
$commands["pgmsg"]["loginmessage"] = &$loginMessage;
$commands["buddy"][] = &$loginMessage;
class LoginMessage
{
var $bot;
var $message;
function LoginMessage (&$bot)
{
$this -> bot = &$bot;
}
function tell($name, $msg)
{
$this -> bot -> send_tell($name, $this -> processCommand($name, $msg));
}
function pgmsg($name, $msg)
{
$this -> bot -> send_pgroup($this -> processCommand($name, $msg));
}
function buddy($name, $msg)
{
if (($msg == 1) && ($this -> bot -> is_member($name) == 1) && (!empty($this -> message)))
$this -> bot -> send_tell($name, $this -> message);
}
function processCommand($name, $msg)
{
if (preg_match("/^" . $this -> bot -> commpre . "loginmessage$/i", $msg))
{
if (!$this -> bot -> admin -> in_group($name, "leader") &&
!$this -> bot -> admin -> in_group($name, "raidleader") &&
!$this -> bot -> admin -> in_group($name, "admin") &&
!$this -> bot -> admin -> in_group($name, "superadmin")) {
return "You don't have permission to use this command.";
}
}
if (preg_match("/^" . $this -> bot -> commpre . "loginmessage$/i", $msg))
{
$this -> message = "";
return "Login message cleared.";
}
if (preg_match("/^" . $this -> bot -> commpre . "loginmessage (.+)$/i", $msg, $info))
{
$this -> message = $info[1];
return "Login message set.";
}
}
}
?>