From 69bf622d2d72be70a1db9b12f9a5a7c5cca9d76c Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 27 Sep 2019 16:18:12 +0100 Subject: [PATCH] remove external_modules/ and replace with bot.conf and cli arg --- bot.conf.example | 3 +++ external_modules/.keep | 0 start.py | 9 +++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) delete mode 100644 external_modules/.keep diff --git a/bot.conf.example b/bot.conf.example index 5fe9a724..ac1c5818 100644 --- a/bot.conf.example +++ b/bot.conf.example @@ -18,6 +18,9 @@ bot-channel = module-blacklist = module-whitelist = +# path to an external directory for modules to be found in +external-modules = + # https://openweathermap.org/api openweathermap-api-key = diff --git a/external_modules/.keep b/external_modules/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/start.py b/start.py index c6d518a5..19c85719 100755 --- a/start.py +++ b/start.py @@ -42,6 +42,7 @@ arg_parser.add_argument("--module", "-m", help="Execute an action against a specific module") arg_parser.add_argument("--module-args", "-M", help="Arguments to give in action against a specific module") +arg_parser.add_argument("--external", "-e", help="External modules directory") arg_parser.add_argument("--startup-disconnects", "-D", help="Tolerate failed connections on startup", action="store_true") @@ -87,8 +88,12 @@ events = EventManager.EventRoot(log).wrap() exports = Exports.Exports() timers = Timers.Timers(database, events, log) -module_directories = [os.path.join(directory, "modules"), - os.path.join(directory, "external_modules")] +module_directories = [os.path.join(directory, "modules")] +if args.external: + module_directories.append(os.path.abspath(args.external)) +if "external-modules" in config: + module_directories.append(os.path.abspath(config["external-modules"])) + modules = ModuleManager.ModuleManager(events, exports, timers, config, log, module_directories)