bots: Refactor bots to use send_reply.
The send_reply function makes it easier for bots to send messages. This commit updates all bots to make use of this function, when possible.
This commit is contained in:
parent
f83ddd658c
commit
c6d294385f
9 changed files with 13 additions and 112 deletions
|
@ -118,19 +118,6 @@ class JohnHandler(object):
|
|||
def handle_message(self, message, client, state_handler):
|
||||
original_content = message['content']
|
||||
bot_response = str(bota.get_response(original_content))
|
||||
|
||||
if message['type'] == 'private':
|
||||
client.send_message(dict(
|
||||
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,
|
||||
))
|
||||
client.send_reply(message, bot_response)
|
||||
|
||||
handler_class = JohnHandler
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue