update to newer version of Matrix SDK

This commit is contained in:
Hubert Chathi 2016-09-27 21:31:09 -04:00
parent 6b579eb856
commit 7d9c09ac9f
2 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,7 @@
"license": "MIT",
"dependencies": {
"parent-require": "^1.0.0",
"matrix-js-sdk": ">=0.3.0"
"matrix-js-sdk": "^0.6.0"
},
"peerDependencies": {
"hubot": ">=2.0"

View File

@ -49,9 +49,11 @@ class Matrix extends Adapter
baseUrl: process.env.HUBOT_MATRIX_HOST_SERVER || 'https://matrix.org'
accessToken: @access_token
userId: @user_id
@client.on 'syncComplete', =>
@robot.logger.info "Synced #{@client.getRooms().length} rooms"
@emit 'connected'
@client.on 'sync', (state, prevState, data) =>
switch state
when "PREPARED"
@robot.logger.info "Synced #{@client.getRooms().length} rooms"
@emit 'connected'
@client.on 'Room.timeline', (event, room, toStartOfTimeline) =>
if event.getType() == 'm.room.message' and toStartOfTimeline == false
message = event.getContent().body