L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 02, 2008, 10:50:09 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Coding and development discussion > Topic: Command Registration
Pages: [1]   Go Down
« previous next »
Print
Author Topic: Command Registration  (Read 312 times)
0 Members and 1 Guest are viewing this topic.
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Command Registration
« on: March 29, 2007, 12: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.
Logged
Alreadythere
BeBot Maintainer
Administrator
Grandmaster
********
Offline Offline

Posts: 1085


Re: Command Registration
« Reply #1 on: March 29, 2007, 12: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.
Logged
Glarawyn
BeBot Developer
Champion
********
Offline Offline

Posts: 414



Re: Command Registration
« Reply #2 on: March 29, 2007, 01:15:45 PM »

Quote from: Alreadythere on March 29, 2007, 12:41:07 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.
Logged
Khalem
BeBot Founder
Administrator
Grandmaster
********
Offline Offline

Gender: Male
Posts: 670



WWW
Re: Command Registration
« Reply #3 on: April 06, 2007, 08:26:41 PM »

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).
Logged

BeBot Founder and Fixer Kingpin
Madman coder and destroyer of good code
Pages: [1]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Development > Coding and development discussion > Topic: Command Registration
« previous next »
 
Jump to:  

Recent
!items database
by Zeephonz
[Today at 08:05:21 PM]

Log playtime from buddys ...
by IKShadow
[Today at 06:48:12 AM]

[request] Raid timers
by Elesar1
[December 01, 2008, 04:41:09 PM]

Shared DB online list
by Temar
[December 01, 2008, 01:55:47 AM]

relay colors
by Temar
[December 01, 2008, 01:54:56 AM]

BeBot v0.6.0 released
by Alreadythere
[November 30, 2008, 05:32:00 PM]

Change to Bid.php
by Temar
[November 30, 2008, 11:41:44 AM]

OnlineOrg
by Jiheld
[November 29, 2008, 12:44:27 PM]

Silly Newbie Question.
by Temar
[November 29, 2008, 12:00:02 PM]

massive_pvp_time_table 1
by gerborg
[November 29, 2008, 06:55:35 AM]
Stats
Members
Total Members: 1244
Latest: Armonkens
Stats
Total Posts: 11146
Total Topics: 1505
Online Today: 25
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 1
Guests: 12
Total: 13
Vain

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.691 seconds with 28 queries. (Pretty URLs adds 0.031s, 4q)
Loading...