Add !unset and !channelunset (and !channelunsetoverride) (set.py)
This commit is contained in:
parent
2f74100666
commit
0e9d2b3180
1 changed files with 30 additions and 0 deletions
|
@ -144,3 +144,33 @@ class Module(ModuleManager.BaseModule):
|
||||||
"""
|
"""
|
||||||
setting = event["args_split"][0]
|
setting = event["args_split"][0]
|
||||||
self._get(event, setting, "", self.bot.get_setting(setting, None))
|
self._get(event, setting, "", self.bot.get_setting(setting, None))
|
||||||
|
|
||||||
|
def _unset(self, event, setting, category, target):
|
||||||
|
settings = self.exports.get_all(category)
|
||||||
|
settings_dict = {setting["setting"]: setting for setting in settings}
|
||||||
|
setting = setting.lower()
|
||||||
|
|
||||||
|
if setting in settings_dict:
|
||||||
|
target.del_setting(setting)
|
||||||
|
event["stdout"].write("Unset %s" % setting)
|
||||||
|
else:
|
||||||
|
event["stderr"].write("Unknown setting")
|
||||||
|
|
||||||
|
@utils.hook("received.command.unset", min_args=1)
|
||||||
|
def unset(self, event):
|
||||||
|
"""
|
||||||
|
:help: Unset a specified user setting
|
||||||
|
:usage: <setting>
|
||||||
|
"""
|
||||||
|
self._unset(event, event["args_split"][0], "set", event["user"])
|
||||||
|
|
||||||
|
@utils.hook("received.command.channelunset", min_args=1,
|
||||||
|
require_mode="high")
|
||||||
|
@utils.hook("received.command.channelunsetoverride", min_args=1,
|
||||||
|
permission="channelunsetoverride")
|
||||||
|
def channel_unset(self, event):
|
||||||
|
"""
|
||||||
|
:help: Unset a specified user setting
|
||||||
|
:usage: <setting>
|
||||||
|
"""
|
||||||
|
self._unset(event, event["args_split"][0], "set", event["user"])
|
||||||
|
|
Loading…
Reference in a new issue