Skip to content
Permalink
Browse files

add 'module-blacklist/whitelist' to bot.conf - use that as well as DB…

… setting
  • Loading branch information...
jesopo committed Jun 1, 2019
1 parent 5077bad commit e5c11f4aeff4aec508997922b8adfca10503b6e1
Showing with 18 additions and 2 deletions.
  1. +6 −0 bot.conf.example
  2. +12 −2 src/IRCBot.py
@@ -14,6 +14,12 @@ api-port =
# the default channel BitBot automatically joins
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
openweathermap-api-key =

@@ -62,8 +62,18 @@ def trigger(self,

def load_modules(self, safe: bool=False
) -> typing.Tuple[typing.List[str], typing.List[str]]:
whitelist = self.get_setting("module-whitelist", [])
blacklist = self.get_setting("module-blacklist", [])
db_blacklist = set(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,
blacklist=blacklist, safe=safe)

0 comments on commit e5c11f4

Please sign in to comment.
You can’t perform that action at this time.