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

Title: Seperate Official and Unofficial/Custom Modules
Post 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.

Code: [Select]
// 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);
    }
}
Title: Re: Seperate Official and Unofficial/Custom Modules
Post by: Khalem on August 30, 2006, 08:20:21 pm
Good idea Glara.

Will be adding this to 0.3
Title: Re: Seperate Official and Unofficial/Custom Modules
Post by: Khalem on September 27, 2006, 10:05:11 pm
Added to SVN for 0.3
Title: Re: Seperate Official and Unofficial/Custom Modules
Post by: Glarawyn on October 26, 2006, 07:15:40 pm
In addition, extend help so that there is a custom/help directory.

Original BotHelp.php line 91.
Code: [Select]
if (is_file("./help/" . $info . ".txt"))

Modified BotHelp.php (Replace line 91 with the following)
Code: [Select]
        // 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"))
Title: Re: Seperate Official and Unofficial/Custom Modules
Post by: Khalem on October 29, 2006, 11:57:16 pm
Committed.
SimplePortal 2.3.7 © 2008-2025, SimplePortal