Skip to content

Commit

Permalink
Add Message extra for permanent URL
Browse files Browse the repository at this point in the history
Allow bots to easily refer to stream&topic that a message
was part of.

Closes zulip#6
  • Loading branch information
jayvdb committed Nov 28, 2017
1 parent a2e478c commit 0f2222a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zulip.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ def _handle_message(self, message):
room=room
)
message_instance.to = room
message_instance.extras['url'] = (
self.identity['site'] + '/#narrow/stream/{stream}'
'/subject/{subject}/near/{mid}').format(
stream=quote(room.title),
subject=quote(room.subject),
mid=message['id'],
)
else:
raise ValueError("Invalid message type `{}`.".format(message['type']))
self.callback_message(message_instance)
Expand Down

0 comments on commit 0f2222a

Please sign in to comment.