contrib bots: john bot can reply back in the same chat.
No need to create an extra "VirtualHelp" stream.
This commit is contained in:
parent
92d2981726
commit
050162592a
|
@ -109,17 +109,28 @@ class JohnHandler(object):
|
||||||
|
|
||||||
def usage(self):
|
def usage(self):
|
||||||
return '''
|
return '''
|
||||||
Before running this, make sure to create a stream
|
This bot aims to be Zulip's virtual assistant. It
|
||||||
called "VirtualHelp" that your API user can send to.
|
finds the best match from a certain input.
|
||||||
|
Also understands the English language and can
|
||||||
|
mantain a conversation, joke and give useful information.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def handle_message(self, message, client, state_handler):
|
def handle_message(self, message, client, state_handler):
|
||||||
original_content = message['content']
|
original_content = message['content']
|
||||||
client.send_message(dict(
|
bot_response = str(bota.get_response(original_content))
|
||||||
type='stream',
|
|
||||||
to='VirtualHelp',
|
if message['type'] == 'private':
|
||||||
subject="John",
|
client.send_message(dict(
|
||||||
content=str(bota.get_response(original_content))
|
type='private',
|
||||||
))
|
to=message['sender_email'],
|
||||||
|
content=bot_response,
|
||||||
|
))
|
||||||
|
else:
|
||||||
|
client.send_message(dict(
|
||||||
|
type='stream',
|
||||||
|
to=message['display_recipient'],
|
||||||
|
subject=message['subject'],
|
||||||
|
content=bot_response,
|
||||||
|
))
|
||||||
|
|
||||||
handler_class = JohnHandler
|
handler_class = JohnHandler
|
||||||
|
|
Loading…
Reference in a new issue