collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18363
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Public and Private Functions  (Read 2814 times)

0 Members and 1 Guest are viewing this topic.

Offline jokerjr

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
Public and Private Functions
« 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

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Public and Private Functions
« Reply #1 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.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Public and Private Functions
« Reply #2 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.
BeBot Founder and Fixer Kingpin

Offline jokerjr

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Public and Private Functions
« Reply #3 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?

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Public and Private Functions
« Reply #4 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.
BeBot Founder and Fixer Kingpin

Offline jokerjr

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Public and Private Functions
« Reply #5 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.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Public and Private Functions
« Reply #6 on: December 13, 2005, 03:04:12 am »
Could you post the code itself thats generating the error.
Easier to help :)
BeBot Founder and Fixer Kingpin

Offline jokerjr

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Public and Private Functions
« Reply #7 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.

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Public and Private Functions
« Reply #8 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.
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Public and Private Functions
« Reply #9 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.
BeBot Founder and Fixer Kingpin

Offline jokerjr

  • BeBot Rookie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Public and Private Functions
« Reply #10 on: December 22, 2005, 08:54:19 pm »
Ahhh okies thanks for the heads up dont want to stir up the QL300 Nerf stick.

 

* Recent Posts
[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm]


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 722
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal