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

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

Author Topic: Command Registration  (Read 4104 times)

0 Members and 1 Guest are viewing this topic.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Command Registration
« on: March 29, 2007, 07:31:17 pm »
Currently, most modules register each channel (gc, pgroup, tell, tell2) individually. We're already discussed removing tell2, but how about removing all four command registrations and simplifying to a single handler?

With the new Security and Access Control modules, I think this would be a good change for 0.4. Access Control does one thing that I don't really like: it overrides the intentions of the developer.

For example, my the !apf module by default allows anyone to use the !apf command anywhere. That was by design. Access Control can completely change my intentions and restrict access.

Giving the user (the person running BeBot) control is excellent software design, but as we are not just creating a useful program we're also creating a development framework, we also need to empower the developer.

Here is what I suggest:
Add the ability to register a new command via a function call (ie: $this -> bot -> new_command("name")). This function should take care of registering the command for all channels.

Secondly, the Access Control module should provide functionality to allow the module developer to set the default access for the command. Instead of new command getting the default settings Access Control dictates, the new command should get the default settings that the module developer dictates.

Functionality similar to the create() function in the Settings module is what I'm looking for. The default access settings are created if they don't already exist, but if access settings do exist the stored values are used over the defaults the developer has set.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Command Registration
« Reply #1 on: March 29, 2007, 07:41:07 pm »
There is an $this -> bot -> accesscontrol -> create($channel, $command, $defaultlevel) command in the Access Control. Commands that don't want to rely on the default rights should use it.

One think I like about the current way is the possibility to have commands react different in different channels.

Still, a way to register commands for all three channels, in optimal case leading to automatical handling of the output channels (like you return the output back to the calling command handler), would be nice for those commands that should work identical over all channels.

Offline Glarawyn

  • BeBot Hero
  • ******
  • Posts: 521
  • Karma: +0/-0
Re: Command Registration
« Reply #2 on: March 29, 2007, 08:15:45 pm »
One think I like about the current way is the possibility to have commands react different in different channels.

A single unified handler should be able to pass along the source of the message. There is currently a general output function in Bot.php that takes a channel parameter to determine if output should be sent via tell, pgroup, or gc.

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Command Registration
« Reply #3 on: April 07, 2007, 03:26:41 am »
The current method is a mess.

But right now i don't really want to mess with this until 0.4 is done and ready. And from what i can tell we are very close to having something to ship out the door.
Remember this involves cleaning up every single module we have.

If you take a look at some of the more recent modules i've updated you'll notice how i use a single command handler. I had planned to pretty much do what has been outlined here.

A single function to register a module/command. Main loop passes an additional parameter to the module indicating it's origin (tell, pgroup, gc).
BeBot Founder and Fixer Kingpin

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


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


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

* Who's Online
  • Dot Guests: 260
  • 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