BeBot - An Anarchy Online and Age Of Conan chat automaton
General => Feedback and Suggestions => Topic started by: Glarawyn on August 30, 2006, 06:36:54 pm
-
Just a thought as I've done this on a couple of the bots I run to ease upgrades a bit.
For example, I've added the following to main.php before the code that loads the official modules. If I modify an official module, I move it to one of the custom directories. Any modules I write or grab from this site also go into the custom directories.
// Load up all custom core-modules
$folder = dir("./custom-core/");
while ($mod = $folder->read())
{
if (!is_dir($mod) && !preg_match("/^_/", $mod) && preg_match("/php$/i", $mod))
{
require_once "custom-core/" . $mod;
$bot -> log("CCORE", "LOAD", $mod);
}
}
// Load up all custom modules
$folder = dir("./custom-modules/");
while ($mod = $folder->read())
{
if (!is_dir($mod) && !preg_match("/^_/", $mod) && preg_match("/php$/i", $mod) && (($guildbot && !preg_match("/_RAID/", $mod)) || (!$guildbot && !preg_match("/_GUILD/", $mod))))
{
require_once "custom-modules/" . $mod;
$bot -> log("CMOD", "LOAD", $mod);
}
}
-
Good idea Glara.
Will be adding this to 0.3
-
Added to SVN for 0.3
-
In addition, extend help so that there is a custom/help directory.
Original BotHelp.php line 91.
if (is_file("./help/" . $info . ".txt"))
Modified BotHelp.php (Replace line 91 with the following)
// Custom help files take precedence over normal help files.
if (is_file("./custom/help/" . $info . ".txt")) {$path = "./custom/help/";}
else {$path = "./help/";} // Default path
if (is_file($path . $info . ".txt"))
-
Committed.