Add ability to prevent users specifying their own dns nameservers

This commit is contained in:
jesopo 2019-09-02 14:33:12 +01:00
parent e1da095023
commit 8a4d5b3123

View file

@ -15,6 +15,8 @@ class DnsSetting(utils.Setting):
return value
return None
@utils.export("botset", utils.BoolSetting("configurable-nameservers",
"Whether or not users can configure their own nameservers"))
@utils.export("serverset", DnsSetting("dns-nameserver",
"Set DNS nameserver", example="8.8.8.8"))
@utils.export("channelset", DnsSetting("dns-nameserver",
@ -28,6 +30,8 @@ class Module(ModuleManager.BaseModule):
:prefix: DNS
"""
args = event["args_split"][:]
nameserver = None
if self.bot.get_setting("configurable-nameservers", True):
nameserver = event["channel"].get_setting("dns-nameserver",
event["server"].get_setting("dns-nameserver", None))
for i, arg in enumerate(args):