Allow user/channel/server/bot settings to be "hidden" from settings lists in

modules/set.py
This commit is contained in:
jesopo 2018-10-06 17:16:17 +01:00
parent 0cf7deed24
commit 69eda4bf1b
2 changed files with 5 additions and 2 deletions

View file

@ -3,7 +3,8 @@ from src import ModuleManager, utils
@utils.export("channelset", {"setting": "github-hook", @utils.export("channelset", {"setting": "github-hook",
"help": ("Disable/Enable showing BitBot's github commits in the " "help": ("Disable/Enable showing BitBot's github commits in the "
"current channel"), "validate": utils.bool_or_none}) "current channel"), "validate": utils.bool_or_none,
"hidden": True})
class Module(ModuleManager.BaseModule): class Module(ModuleManager.BaseModule):
@utils.hook("api.post.github") @utils.hook("api.post.github")
def github(self, event): def github(self, event):

View file

@ -20,8 +20,10 @@ class Module(ModuleManager.BaseModule):
elif len(event["args_split"]) == 1: elif len(event["args_split"]) == 1:
event["stderr"].write("Please provide a value") event["stderr"].write("Please provide a value")
else: else:
shown_settings = [key for key, value in settings_dict.items()
if not value.get("hidden", False)]
event["stdout"].write("Available settings: %s" % ( event["stdout"].write("Available settings: %s" % (
", ".join(settings_dict.keys()))) ", ".join(shown_settings)))
@utils.hook("received.command.set") @utils.hook("received.command.set")
def set(self, event): def set(self, event):
""" """