aboutsummaryrefslogtreecommitdiff
path: root/modules/command_suggestions.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-10-30 11:48:35 +0000
committerGravatar jesopo2019-10-30 11:48:35 +0000
commitaa4511e0d98b182c5bf33652efc1e9bfdff675a0 (patch)
treef001c78b86e0d5502555ddf3305cc03cd1ca4e11 /modules/command_suggestions.py
parent!seen seen-info should be per-channel, not network wide (diff)
signature
add server/channel config to disable command suggestions
Diffstat (limited to 'modules/command_suggestions.py')
-rw-r--r--modules/command_suggestions.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/command_suggestions.py b/modules/command_suggestions.py
index 386def9f..45cf1758 100644
--- a/modules/command_suggestions.py
+++ b/modules/command_suggestions.py
@@ -3,12 +3,20 @@
import difflib
from src import ModuleManager, utils
+SETTING = utils.BoolSetting("command-suggestions",
+ "Disable/enable command suggestions")
+@utils.export("serverset", SETTING)
+@utils.export("channelset", SETTING)
class Module(ModuleManager.BaseModule):
def _all_command_hooks(self):
return self.events.on("received.command").get_children()
@utils.hook("unknown.command")
def unknown_command(self, event):
+ if not event["server"].get_setting("command-suggestions",
+ event["target"].get_setting("command-suggestions", True)):
+ return
+
all_commands = self._all_command_hooks()
match = difflib.get_close_matches(event["command"], all_commands,
cutoff=0.7)