mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
Update the bots development guide for change in triage_message
This commit is contained in:
@@ -86,7 +86,7 @@ class MyBotHandler(object):
|
|||||||
def usage(self):
|
def usage(self):
|
||||||
return '''Your description of the bot'''
|
return '''Your description of the bot'''
|
||||||
|
|
||||||
def triage_message(self, message):
|
def triage_message(self, message, client):
|
||||||
#add your code here
|
#add your code here
|
||||||
|
|
||||||
def handle_message(self, message, client, state_handler):
|
def handle_message(self, message, client, state_handler):
|
||||||
@@ -98,7 +98,7 @@ handler_class = MyBotHandler
|
|||||||
|
|
||||||
* Every bot needs to implement the functions
|
* Every bot needs to implement the functions
|
||||||
* `usage(self)`
|
* `usage(self)`
|
||||||
* `triage_message(self, message)`
|
* `triage_message(self, message, client)`
|
||||||
* `handle_message(self, message, client)`
|
* `handle_message(self, message, client)`
|
||||||
|
|
||||||
* These functions are documented in the [next section](#bot-api).
|
* These functions are documented in the [next section](#bot-api).
|
||||||
@@ -130,7 +130,7 @@ def usage(self):
|
|||||||
```
|
```
|
||||||
|
|
||||||
### triage_message
|
### triage_message
|
||||||
*triage_message(self, message)*
|
*triage_message(self, message, client)*
|
||||||
|
|
||||||
is called when a message was sent.
|
is called when a message was sent.
|
||||||
|
|
||||||
@@ -147,13 +147,17 @@ is called when a message was sent.
|
|||||||
* subject - topic of the message (string)
|
* subject - topic of the message (string)
|
||||||
* timestamp - when was the message sent (integer)
|
* timestamp - when was the message sent (integer)
|
||||||
|
|
||||||
|
* client - contains information about this bot
|
||||||
|
* client.full_name - name of the bot account
|
||||||
|
* client.email - email of the bot account
|
||||||
|
|
||||||
#### Return values
|
#### Return values
|
||||||
* True if the bot should react to this message
|
* True if the bot should react to this message
|
||||||
* False otherwise
|
* False otherwise
|
||||||
|
|
||||||
#### Example implementation
|
#### Example implementation
|
||||||
```
|
```
|
||||||
def triage_message(self, message):
|
def triage_message(self, message, client):
|
||||||
original_content = message['content']
|
original_content = message['content']
|
||||||
if message['display_recipient'] == 'followup':
|
if message['display_recipient'] == 'followup':
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user