diff --git a/abbott/entrypt.py b/abbott/entrypt.py index dbd87f5..6a5f93b 100644 --- a/abbott/entrypt.py +++ b/abbott/entrypt.py @@ -7,6 +7,9 @@ import sys def main(): + if len(sys.argv) < 2: + print "Usage: %s " % sys.argv[0] + sys.exit(1) transportobj = transport.Transport() boss = pluginbase.PluginBoss(sys.argv[1], transportobj) diff --git a/abbott/pluginbase.py b/abbott/pluginbase.py index 22566ec..bfff8b7 100644 --- a/abbott/pluginbase.py +++ b/abbott/pluginbase.py @@ -3,6 +3,7 @@ import UserDict import os import os.path +import sys from twisted.internet import defer @@ -16,7 +17,7 @@ def __init__(self, jsonfile): """Initialize a config from a json file.""" self._jsonfile = jsonfile with open(jsonfile, 'r') as inp: - self.data= json.load(inp) + self.data = json.load(inp) def save(self): with open(self._jsonfile+"~", 'w') as out: @@ -38,6 +39,12 @@ def __init__(self, config, transport): self._filename = os.path.join(config, "config.json") self.loaded_plugins = {} + + if not os.path.exists(self._configdir): + os.mkdir(self._configdir) + elif not os.path.isdir(self._configdir): + print("The config parameter should be a directory. Please make the necessary adjustments") + sys.exit(1) try: self._load() @@ -91,8 +98,15 @@ def _seed_defaults(self): 'irc.IRCBotPlugin', 'irc.IRCController', 'ircutil.ReplyInserter', + # whois and names probably aren't necessary unless + # you're also running the ircadmin plugins, but just + # in case, it can't hurt. + 'ircutil.IRCWhois', + 'ircutil.Names', 'auth.Auth', 'plugincontroller.PluginController', + 'corecontrol.CoreControl', + 'corecontrol.Help', ], }, 'plugin_config': { @@ -112,6 +126,9 @@ def _seed_defaults(self): }, }, }, + 'command': { + "prefix": None, + }, } self.save() diff --git a/abbott/plugins/ircutil.py b/abbott/plugins/ircutil.py index d70a9ad..4dcd80f 100644 --- a/abbott/plugins/ircutil.py +++ b/abbott/plugins/ircutil.py @@ -44,14 +44,14 @@ def start(self): self.listen_for_event("irc.on_unknown") - self.install_command( - cmdname="whois", - argmatch=r"(?P[^ ]+)", - callback=self.do_whois, - cmdusage="", - helptext="Does a whois and prints the results. This command is meant for debugging.", - permission="irc.whois", - ) + #self.install_command( + # cmdname="whois", + # argmatch=r"(?P[^ ]+)", + # callback=self.do_whois, + # cmdusage="", + # helptext="Does a whois and prints the results. This command is meant for debugging.", + # permission="irc.whois", + # ) # nick of the current whois that is coming in on the wire right this # moment @@ -142,14 +142,14 @@ def start(self): self.listen_for_event("irc.on_unknown") - self.install_command( - cmdname="names", - argmatch=r"(?P\S+)?$", - cmdusage="[channel]", - callback=self.do_names, - helptext="Does an IRC NAMES command and replies with the result", - permission="irc.names", - ) + #self.install_command( + # cmdname="names", + # argmatch=r"(?P\S+)?$", + # cmdusage="[channel]", + # callback=self.do_names, + # helptext="Does an IRC NAMES command and replies with the result", + # permission="irc.names", + # ) self.currentinfo = [] self.pending = defaultdict(set)