From 8e6835be3c2df91b73a79b6ae0efefa54980440f Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 7 Jun 2019 15:57:15 +0100 Subject: [PATCH] Only show typing indicators for commands that expect output --- modules/commands/__init__.py | 9 ++++++--- modules/ducks.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/commands/__init__.py b/modules/commands/__init__.py index ccdf97a1..00cf5e62 100644 --- a/modules/commands/__init__.py +++ b/modules/commands/__init__.py @@ -136,6 +136,7 @@ class Module(ModuleManager.BaseModule): return False message_tags = server.has_capability(MESSAGE_TAGS_CAP) + expect_output = hook.kwargs.get("expect_output", True) module_name = self._get_prefix(hook) or "" if not module_name and hasattr(hook.function, "__self__"): @@ -147,8 +148,9 @@ class Module(ModuleManager.BaseModule): if msgid: send_tags["+draft/reply"] = msgid - server.send(utils.irc.protocol.tagmsg(target_str, - {"+draft/typing": "active"}), immediate=True) + if expect_output: + server.send(utils.irc.protocol.tagmsg(target_str, + {"+draft/typing": "active"}), immediate=True) stdout = outs.StdOut(server, module_name, target, target_str, send_tags) stderr = outs.StdErr(server, module_name, target, target_str, send_tags) @@ -216,7 +218,8 @@ class Module(ModuleManager.BaseModule): target.last_stderr = stderr ret = new_event.eaten - if message_tags and not stdout.has_text() and not stderr.has_text(): + if (expect_output and message_tags and not stdout.has_text() and + not stderr.has_text()): server.send(utils.irc.protocol.tagmsg(target_str, {"+draft/typing": "done"}), immediate=True) diff --git a/modules/ducks.py b/modules/ducks.py index 5bdab6cf..e3d8d089 100644 --- a/modules/ducks.py +++ b/modules/ducks.py @@ -44,7 +44,7 @@ class Module(ModuleManager.BaseModule): if show_duck: self._trigger_duck(channel) - @utils.hook("command.regex") + @utils.hook("command.regex", expect_output=False) def channel_message(self, event): """ :pattern: .+