aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2019-10-08 14:48:39 +0100
committerGravatar jesopo2019-10-08 14:48:39 +0100
commita5e489655de806590d9cc55ae9bada85cfb5dd3d (patch)
treea04c92dd58039e289a8b8fe8e54c32b8f06d0067 /modules
parentadd !apropos - to show commands with a given string in them (diff)
signature
move !which to help.py
Diffstat (limited to 'modules')
-rw-r--r--modules/help.py16
-rw-r--r--modules/which.py18
2 files changed, 16 insertions, 18 deletions
diff --git a/modules/help.py b/modules/help.py
index bb3924c8..c2bb0f12 100644
--- a/modules/help.py
+++ b/modules/help.py
@@ -85,6 +85,22 @@ class Module(ModuleManager.BaseModule):
event["stdout"].write("Commands for %s module: %s" % (
module.name, ", ".join(commands)))
+ @utils.hook("received.command.which")
+ @utils.kwarg("min_args", 1)
+ @utils.kwarg("help", "Find where a command is provided")
+ @utils.kwarg("usage", "<command>")
+ def which(self, event):
+ command = event["args_split"][0].lower()
+ hooks = self.events.on("received.command").on(command).get_hooks()
+ if not hooks:
+ raise utils.EventError("Unknown command '%s'" % command)
+
+ hook = hooks[0]
+ module = self.bot.modules.from_context(hook.context)
+ event["stdout"].write("%s%s is provided by %s.%s" % (
+ event["command_prefix"], command, module.name,
+ hook.function.__name__))
+
@utils.hook("received.command.apropos")
@utils.kwarg("min_args", 1)
@utils.kwarg("help", "Show commands with a given string in them")
diff --git a/modules/which.py b/modules/which.py
deleted file mode 100644
index a1b51658..00000000
--- a/modules/which.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from src import ModuleManager, utils
-
-class Module(ModuleManager.BaseModule):
- @utils.hook("received.command.which")
- @utils.kwarg("min_args", 1)
- @utils.kwarg("help", "Find where a command is provided")
- @utils.kwarg("usage", "<command>")
- def which(self, event):
- command = event["args_split"][0].lower()
- hooks = self.events.on("received.command").on(command).get_hooks()
- if not hooks:
- raise utils.EventError("Unknown command '%s'" % command)
-
- hook = hooks[0]
- module = self.bot.modules.from_context(hook.context)
- event["stdout"].write("%s%s is provided by %s.%s" % (
- event["command_prefix"], command, module.name,
- hook.function.__name__))