Skip to content

Commit

Permalink
Remove old session methods from Hipchat adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Aug 8, 2017
1 parent e7a1d9c commit 1071136
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
14 changes: 3 additions & 11 deletions chatterbot/input/hipchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,9 @@ def process_input(self, statement):
"""
new_message = False

input_statement = self.chatbot.conversation_sessions.get(
self.session_id).conversation.get_last_input_statement()
response_statement = self.chatbot.conversation_sessions.get(
self.session_id).conversation.get_last_response_statement()

if input_statement:
last_message_id = input_statement.extra_data.get(
'hipchat_message_id', None
)
if last_message_id:
self.recent_message_ids.add(last_message_id)
response_statement = self.chatbot.storage.get_latest_response(
self.session_id
)

if response_statement:
last_message_id = response_statement.extra_data.get(
Expand Down
4 changes: 2 additions & 2 deletions chatterbot/output/hipchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def process_response(self, statement, session_id=None):
data = self.send_message(self.hipchat_room, statement.text)

# Update the output statement with the message id
self.chatbot.conversation_sessions.get(session_id).conversation[-1][1].add_extra_data(
'hipchat_message_id', data['id']
self.chatbot.storage.update(
statement.add_extra_data('hipchat_message_id', data['id'])
)

return statement

0 comments on commit 1071136

Please sign in to comment.