Only show typing indicators for commands that expect output
This commit is contained in:
parent
5f47d86708
commit
8e6835be3c
2 changed files with 7 additions and 4 deletions
|
@ -136,6 +136,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
message_tags = server.has_capability(MESSAGE_TAGS_CAP)
|
message_tags = server.has_capability(MESSAGE_TAGS_CAP)
|
||||||
|
expect_output = hook.kwargs.get("expect_output", True)
|
||||||
|
|
||||||
module_name = self._get_prefix(hook) or ""
|
module_name = self._get_prefix(hook) or ""
|
||||||
if not module_name and hasattr(hook.function, "__self__"):
|
if not module_name and hasattr(hook.function, "__self__"):
|
||||||
|
@ -147,6 +148,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
if msgid:
|
if msgid:
|
||||||
send_tags["+draft/reply"] = msgid
|
send_tags["+draft/reply"] = msgid
|
||||||
|
|
||||||
|
if expect_output:
|
||||||
server.send(utils.irc.protocol.tagmsg(target_str,
|
server.send(utils.irc.protocol.tagmsg(target_str,
|
||||||
{"+draft/typing": "active"}), immediate=True)
|
{"+draft/typing": "active"}), immediate=True)
|
||||||
|
|
||||||
|
@ -216,7 +218,8 @@ class Module(ModuleManager.BaseModule):
|
||||||
target.last_stderr = stderr
|
target.last_stderr = stderr
|
||||||
ret = new_event.eaten
|
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,
|
server.send(utils.irc.protocol.tagmsg(target_str,
|
||||||
{"+draft/typing": "done"}), immediate=True)
|
{"+draft/typing": "done"}), immediate=True)
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
if show_duck:
|
if show_duck:
|
||||||
self._trigger_duck(channel)
|
self._trigger_duck(channel)
|
||||||
|
|
||||||
@utils.hook("command.regex")
|
@utils.hook("command.regex", expect_output=False)
|
||||||
def channel_message(self, event):
|
def channel_message(self, event):
|
||||||
"""
|
"""
|
||||||
:pattern: .+
|
:pattern: .+
|
||||||
|
|
Loading…
Reference in a new issue