bots: Correct weird behavior of followup bot for empty messages.

Before it sends an empty message to followup stream, now it sends a
help message back to the user/stream where it was mentioned.
This commit is contained in:
Krzysztof Krzysztof 2017-05-23 17:56:51 -07:00 committed by Tim Abbott
parent 854416b725
commit b540c09768

View file

@ -23,18 +23,22 @@ class FollowupHandler(object):
''' '''
def handle_message(self, message, client, state_handler): def handle_message(self, message, client, state_handler):
bot_response = self.get_bot_followup_response(message) if message['content'] == '':
client.send_message(dict( bot_response = "Please specify the message you want to send to followup stream after @mention-bot"
type='stream', client.send_reply(message, bot_response)
to='followup', else:
subject=message['sender_email'], bot_response = self.get_bot_followup_response(message)
content=bot_response, client.send_message(dict(
)) type='stream',
to='followup',
subject=message['sender_email'],
content=bot_response,
))
def get_bot_followup_response(self, message): def get_bot_followup_response(self, message):
original_content = message['content'] original_content = message['content']
original_sender = message['sender_email'] original_sender = message['sender_email']
temp_content = 'from %s:' % (original_sender,) temp_content = 'from %s: ' % (original_sender,)
new_content = temp_content + original_content new_content = temp_content + original_content
return new_content return new_content