add 'module-blacklist/whitelist' to bot.conf - use that as well as DB setting
This commit is contained in:
parent
5077bad522
commit
e5c11f4aef
2 changed files with 18 additions and 2 deletions
|
@ -14,6 +14,12 @@ api-port =
|
||||||
# the default channel BitBot automatically joins
|
# the default channel BitBot automatically joins
|
||||||
bot-channel =
|
bot-channel =
|
||||||
|
|
||||||
|
# module blacklist and whitelist. comma-separated. leave both empty to load all
|
||||||
|
# modules, leave whitelist empty to load all but blacklisted modules, populate
|
||||||
|
# whitelist to not load all modules by default.
|
||||||
|
module-blacklist =
|
||||||
|
module-whitelist =
|
||||||
|
|
||||||
# https://openweathermap.org/api
|
# https://openweathermap.org/api
|
||||||
openweathermap-api-key =
|
openweathermap-api-key =
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,18 @@ class Bot(object):
|
||||||
|
|
||||||
def load_modules(self, safe: bool=False
|
def load_modules(self, safe: bool=False
|
||||||
) -> typing.Tuple[typing.List[str], typing.List[str]]:
|
) -> typing.Tuple[typing.List[str], typing.List[str]]:
|
||||||
whitelist = self.get_setting("module-whitelist", [])
|
db_blacklist = set(self.get_setting("module-blacklist", []))
|
||||||
blacklist = self.get_setting("module-blacklist", [])
|
db_whitelist = set(self.get_setting("module-whitelist", []))
|
||||||
|
|
||||||
|
conf_blacklist = self.config.get("module-blacklist", "").split(",")
|
||||||
|
conf_whitelist = self.config.get("module-whitelist", "").split(",")
|
||||||
|
|
||||||
|
conf_blacklist = set(filter(None, conf_blacklist))
|
||||||
|
conf_whitelist = set(filter(None, conf_whitelist))
|
||||||
|
|
||||||
|
blacklist = db_blacklist|conf_blacklist
|
||||||
|
whitelist = db_whitelist|conf_whitelist
|
||||||
|
|
||||||
return self.modules.load_modules(self, whitelist=whitelist,
|
return self.modules.load_modules(self, whitelist=whitelist,
|
||||||
blacklist=blacklist, safe=safe)
|
blacklist=blacklist, safe=safe)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue