read brainfile filename from config file, allow default

This commit is contained in:
Brian S. Stephan 2010-10-09 20:37:15 -05:00
parent 05f1ce325a
commit 95a27cc44b
1 changed files with 7 additions and 1 deletions

View File

@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from ConfigParser import NoOptionError
import os
import re
@ -32,9 +33,14 @@ class MegaHAL(Module):
Upon creation, open the MegaHAL brain and get ready for doing actual stuff.
"""
self.megahal = megahal.MegaHAL()
Module.__init__(self, config, server, modlist)
try:
filename = self.config.get(self.__class__.__name__, 'brainfile')
self.megahal = megahal.MegaHAL(None, filename)
except NoOptionError:
self.megahal = megahal.MegaHAL()
def reload(self, connection, event, nick, userhost, replypath, what, admin_unlocked):
"""Broken. Don't do anything."""