Made the extension directory be configurable

This commit is contained in:
Frisk 2021-05-11 12:07:03 +02:00
parent 8fa810854a
commit 34177cb7d2
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
2 changed files with 3 additions and 2 deletions

View file

@ -20,6 +20,7 @@
"ignored": ["external", "newusers/create", "newusers/autocreate", "newusers/create2", "newusers/byemail", "newusers/newusers"],
"show_updown_messages": true,
"ignored_namespaces": [],
"extensions_dir": "extensions",
"overview": false,
"overview_time": "00:00",
"send_empty_overview": false,

View file

@ -19,7 +19,7 @@
# WARNING! SHITTY CODE AHEAD. ENTER ONLY IF YOU ARE SURE YOU CAN TAKE IT
# You have been warned
import time, logging.config, requests, datetime, math, os.path, schedule, sys, re
import time, logging.config, requests, datetime, math, os.path, schedule, sys, re, importlib
import src.misc
from collections import defaultdict, Counter
@ -55,7 +55,7 @@ logger.debug("Current settings: {settings}".format(settings=settings))
def load_extensions():
"""Loads all of the extensions, can be a local import because all we need is them to register"""
try:
import extensions
importlib.import_module(settings.get('extensions_dir', 'extensions'), 'extensions')
except ImportError:
logger.critical("No extensions module found. What's going on?")
sys.exit(1)