contrib bots: Edit code for uniformity.

Add one function (get_bot_botname_response()) that generates response
from the given input and replies back to the handle_message with the final
content of response to be sent. Also add code to bots(except followup) to
reply to private messages along with stream messages.
This commit is contained in:
Abhijeet Kaur 2017-03-06 00:28:18 +05:30 committed by showell
parent d715787170
commit 92d2981726
5 changed files with 148 additions and 107 deletions

View file

@ -23,16 +23,20 @@ class FollowupHandler(object):
'''
def handle_message(self, message, client, state_handler):
bot_response = self.get_bot_followup_response(message)
client.send_message(dict(
type='stream',
to='followup',
subject=message['sender_email'],
content=bot_response,
))
def get_bot_followup_response(self, message):
original_content = message['content']
original_sender = message['sender_email']
temp_content = 'from %s:' % (original_sender,)
new_content = temp_content + original_content
client.send_message(dict(
type='stream',
to='followup',
subject=message['sender_email'],
content=new_content,
))
return new_content
handler_class = FollowupHandler