BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: Wanuarmi on November 19, 2005, 01:32:49 am

Title: Raid Command
Post by: Wanuarmi on November 19, 2005, 01:32:49 am
This will add the commands !c and !cmacro to the private channel, just save as RaidCommand.php

They are for raid leader orders to stand out on the chat

Code: [Select]
<?
$raidCommand = new RaidCommand($bot);

$commands["tell"]["c"] = &$raidCommand;
$commands["pgmsg"]["c"] = &$raidCommand;

$commands["tell"]["cmacro"] = &$raidCommand;
$commands["pgmsg"]["cmacro"] = &$raidCommand;

class RaidCommand
{
    var $bot;



    function RaidCommand (&$bot)
    {
      $this -> bot = &$bot;
    }



    function tell($name, $msg)
    {
if (preg_match("/^" . $this -> bot -> commpre . "c .*$/i", $msg))
                $this -> doRaidCommand($name, $msg);
else if (preg_match("/^" . $this -> bot -> commpre . "cmacro .*$/i", $msg))
                $this -> doRaidCommandMacro($name, $msg);
    }



    function pgmsg($name, $msg)
    {
if (preg_match("/^" . $this -> bot -> commpre . "c .*$/i", $msg))
                $this -> doRaidCommand($name, $msg);
else if (preg_match("/^" . $this -> bot -> commpre . "cmacro .*$/i", $msg))
                $this -> doRaidCommandMacro($name, $msg);
    }


function doRaidCommand($name, $msg)
{
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
$output = $msg;
if (preg_match("/^" . $this -> bot -> commpre . "c (.+)$/i", $msg, $info)) { $output = $info[1]; }
$message = "<font color=red>Raid Command</font> by <font color=yellow>$name</font>\n";
$message .= "<font color=yellow>            ==========================================</font>\n";
$message .= "            ".$output;
$message .= "\n<font color=yellow>            ==========================================</font>";
$this -> bot -> send_pgroup($message);
}
}


function doRaidCommandMacro($name, $msg)
{
if ($this -> bot -> admin -> in_group($name, "leader") || $this -> bot -> admin -> in_group($name, "admin"))
{
$output = $msg;
if (preg_match("/^" . $this -> bot -> commpre . "cmacro (.+)$/i", $msg, $info)) { $output = $info[1]; }
    $inside = "<font color=CCInfoText><font color=CCInfoHeader>Macro:</font>\n<a href='chatcmd:///macro <bot> $output'>$output</a>\n\n";
$inside .= "<font color=CCInfoHeader>Command:</font>\n<a href='chatcmd://$output'>$output</a>\n\n";
  $macro = $this -> bot -> make_blob($output, $inside);

$message = "<font color=red>Raid Command</font> by <font color=yellow>$name</font>\n";
$message .= "<font color=yellow>            ==========================================</font>\n";
$message .= "            ".$macro;
$message .= "\n<font color=yellow>            ==========================================</font>";
$this -> bot -> send_pgroup($message);
}
}
}
?>
Title: Re: Raid Command
Post by: Areteh on January 06, 2007, 06:38:24 am
help file.  (yeah, I'm spamming them a bit, just figured since I'm writing them for my own bots, I may as well share.)
SimplePortal 2.3.7 © 2008-2025, SimplePortal