BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => BeBot 0.2 support => Topic started by: jokerjr on December 13, 2005, 12:29:57 am

Title: Public and Private Functions
Post by: jokerjr on December 13, 2005, 12:29:57 am
Hi quick question I have a guildbot and I want to make some of the functions public and keep others to guildmembers only how/where would I change this.

ty
Title: Re: Public and Private Functions
Post by: Xenixa on December 13, 2005, 01:09:56 am
If you're using v0.3.0 or .1 there is new Rights Management built in that should allow you to set specific rights to specific commands.

0.2.1.1 was made to only allow members and guests to use commands on the bot.
Title: Re: Public and Private Functions
Post by: Khalem on December 13, 2005, 01:21:39 am
You can do this by adding a command handler in the modules you want the public to access.

A good example to go by would be Roll.php which allows anyone to verify rolls results.
Code: [Select]
  $commands["tell"]["verify"] = &$roll;
  $commands["tell2"]["verify"] = &$roll;
Code: [Select]
    /*
      This gets called on a tell with the command
    */
    function tell($name, $msg)
    {
      if (preg_match("/^" . $this -> bot -> commpre . "roll ([0-9]{1,4})$/i", $msg, $info))
        $this -> bot -> send_tell($name, $this -> do_roll($name, $info[1]));
      else if (preg_match("/^" . $this -> bot -> commpre . "flip$/i", $msg, $info))
        $this -> bot -> send_tell($name, $this -> do_flip($name, $info[1]));
      else if (preg_match("/^" . $this -> bot -> commpre . "verify ([0-9]+)$/i", $msg, $info))
        $this -> bot -> send_tell($name, $this -> verify($info[1]));
      else
      $this -> bot -> send_help($name);
    }



    /*
      This gets called on a tell with the command from person outside guild
    */
    function tell2($name, $msg)
    {
      if (preg_match("/^" . $this -> bot -> commpre . "verify ([0-9]+)$/i", $msg, $info))
        $this -> bot -> send_tell($name, $this -> verify($info[1]));
    }

tell handles guests and members. tell2 handles non members and non guests.
Title: Re: Public and Private Functions
Post by: jokerjr on December 13, 2005, 01:40:36 am
Thanks for the quick replys just hacking together a shopping bot wanted to make two commands accessable by everyone.  Working with the 2.x bot tho should I be using the 3.x bot?
Title: Re: Public and Private Functions
Post by: Khalem on December 13, 2005, 01:46:19 am
The differences between 0.2 and 0.3 in terms of structure are minimal to nonexsistant.
There will be some slight changes (none which should break backwards compactibility) coming up before the development branch becomes the new stable branch, but i dont yet know when those will make it in.
As such it doesnt really matter. Anything you would write for 0.2.x should work fine with 0.3.x, and in general, the same is true the other way around.
Title: Re: Public and Private Functions
Post by: jokerjr on December 13, 2005, 02:26:59 am

Fatal error: Call to a member function on a non-object in /home/bebot/Bot.php on line 368

Hmm getting the above error message when I try to do a message using the tell2 any place I should check.
Title: Re: Public and Private Functions
Post by: Khalem on December 13, 2005, 03:04:12 am
Could you post the code itself thats generating the error.
Easier to help :)
Title: Re: Public and Private Functions
Post by: jokerjr on December 20, 2005, 08:15:32 pm
Sorry for the late reply i just re-wrote the module using the template.  I must have done something wrong but looks good now.  I need to make a function now that will send a message to a given shopping channel how would I do that.
Title: Re: Public and Private Functions
Post by: Xenixa on December 21, 2005, 12:17:00 am
WHOA!!! Hold up there sparky. Bots broadcasting in public channels is pretty much a no no. FC puts up with Bots only because we keep them in private/org channels or to private tells.

Just fair warning... if your Bot does get reported as being in a Public channel that account will get Temp banned. Just ask the owner of Helpbot, Beaker, he can attest to that.
Title: Re: Public and Private Functions
Post by: Khalem on December 21, 2005, 11:05:41 am
Not to mention, anything found out to be a bot gets ignored by people faster than you care to think of.

In short, please don't do it.
Funcom tolerates bots because they choose to. They are against the EULA. Don't give them reasons to change their minds.
Title: Re: Public and Private Functions
Post by: jokerjr on December 22, 2005, 08:54:19 pm
Ahhh okies thanks for the heads up dont want to stir up the QL300 Nerf stick.
SimplePortal 2.3.7 © 2008-2025, SimplePortal