BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => BeBot 0.2 support => Topic started by: Nesi on February 11, 2005, 03:53:11 pm
-
Hello
Got the Bot running on ! as a command syntax. I new want to make a command that responds without the syntax now how do i go about doing that :)?
else if (preg_match("/^" . $this -> bot -> commpre . "test(.+)$/i", $msg, $info))
$this -> test($name, $info[1]);
Think i wold need to change the "commpre" into something, but what??
-
I'm afraid that if you want this command to respond to tells or privategroup messages it is not (yet) possible.
If you want it to reply to guildchat however it is possible:
At the top:
$myModule = new MyModule();
$commands["gmsg"][$guild_name][] = &$myModule;
Then in the class:
/*
This gets called on a msg in the group
*/
function gmsg($name, $group, $msg)
{
if (preg_match("/^thiscommand/", $msg))
{
// Code in here.
}
}
If you DO need a command that replys to a tell/privgroup without useing the command syntax I'll make a little workaround for you. ;)
-
I could be wrong about this, as I haven't taken the time to understand the bot, but you could try taking the "!" and changing it to "" in Bot.conf.
-
Yes, but the way I understood it Nesi wants the bot to run on the "!" syntax for all commands but one.
-
Ahh, my mistake, but if you wanted it in privategroup, I believe you can do it using the same workaround as for guild chat, ex.
$myModule = new MyModule();
$commands["pvgroup"][][] = &$myModule;
then
/*
This gets called on a msg in the group
*/
function prvgroup($name, $group, $msg)
{
if (preg_match("/^thiscommand/", $msg))
{
// Code in here.
}
}
I don't have a copy of the template, so I can't quite remeber if prvgroup is corrent, but the module template does offer a way to listen to all private group chat. As for tells, your'e out of luck for now, unless you do in fact want to do away with your syntax for good.
-
Made it work by adding another command syntax to the bot :)
Needed it for a loot filter/logger for apfbot and guildbot :)
Works in all channels.
Thanks for the replys