BeBot - An Anarchy Online and Age Of Conan chat automaton

Development => Coding and development discussion => Topic started by: Temar on December 11, 2007, 06:58:08 am

Title: how to handle subcommands
Post by: Temar on December 11, 2007, 06:58:08 am
was thinking about wat should the bot do if user doesnt have access to a subcommand
i think letting the modules handle when is best way
i have 1 idea so far
if the subcommand is blocked
change the msg from !command subcommand ...
to !command * subcommand ...
then the command handler can handle the * or simple let it goto default
howeva there is the case were some module wont handle it
such as old preg_match handlers
and since u can add a subcommand to any module i think we need a way to tell bot.php it can send the modified msg
1 way could be do put
$this -> bot -> subcommands["command"] = TRUE;
then do a simple isset to see if it should do it

Title: Re: how to handle subcommands
Post by: Alreadythere on December 11, 2007, 01:31:44 pm
What do you want to do?

Handling of subcommands is and most likely always will be a job for the modules registering a command.

The new access control for subcommands in the SVN version doesn't really change this, all it does is block tries of users without access before they reach the module.
Title: Re: how to handle subcommands
Post by: Temar on December 11, 2007, 04:35:26 pm
what i mean is alowing the module to handle the blocks

Title: Re: how to handle subcommands
Post by: Alreadythere on December 11, 2007, 05:02:28 pm
That would counter the idea behind access control.

Right now a module only gets informed if a valid command/subcommand combination is called. The module doesn't have to do anything about access control itself, it just has to check for that any further parameter are valid. And then do it's job.

Why should a module be informed that a user tried to call a command/subcommand he wasn't allowed to? It's not as if it should do anything further then, denied is denied.
Title: Re: how to handle subcommands
Post by: Temar on December 11, 2007, 05:19:04 pm
ok

well far as i know currently is acts the same for subcommand as command when your too low, that being send help for tell and nothing on pg and gc
would be nice if subcommand error was added.
as people will see commands and all help on these and be wondering why it isnt working
Title: Re: how to handle subcommands
Post by: Alreadythere on December 11, 2007, 05:40:36 pm
You could argue the same for the commands itself.
Title: Re: how to handle subcommands
Post by: Temar on December 11, 2007, 07:30:24 pm
well with command it wont be on help if they dont have access etc
but with subcommands it is and useing just the command works, just not the subcommand
also i know some module when not typed in correctly dont output and u end up with nothing
i think command if fine as it is
but subcommand need a simple output error like Subcommand "subcom" Requires Access Level of "level" to Use.
and maybe include a You have Accesslevel of "level"
Title: Re: how to handle subcommands
Post by: Alreadythere on December 11, 2007, 08:03:26 pm
To much work IMO.

If a user thinks he got the command right, just a bit of syntax wrong he should do !help !command anyways.
SimplePortal 2.3.7 © 2008-2025, SimplePortal