Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions zulip/zulip/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,27 @@ def move_topic(
request=request,
)

def reply_on_each_stream_mention(self, handle_message: Callable[[str], None], verbose=False):
def callback(msg):
if msg["type"] != "stream":
return
if verbose:
print("Processing", msg)

content = handle_message(msg)
if verbose:
print("sending", msg["content"])
request = {
"type": "stream",
"to": msg["display_recipient"],
"topic": msg["subject"],
"content": content,
}
self.send_message(request)

narrow = [["is", "mentioned"]]
self.call_on_each_message(callback, narrow=narrow)


class ZulipStream:
"""
Expand Down