Skip to content

Commit

Permalink
sync room when receive room events (#1557)
Browse files Browse the repository at this point in the history
  • Loading branch information
windmemory authored and huan committed Aug 17, 2018
1 parent 42faaf6 commit 378e1bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wechaty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ export class Wechaty extends Accessory implements Sayable {
case 'room-join':
puppet.on('room-join', async (roomId, inviteeIdList, inviterId) => {
const room = this.Room.load(roomId)
await room.ready()
await room.sync()

const inviteeList = inviteeIdList.map(id => this.Contact.load(id))
await Promise.all(inviteeList.map(c => c.ready()))
Expand All @@ -683,7 +683,7 @@ export class Wechaty extends Accessory implements Sayable {
case 'room-leave':
puppet.on('room-leave', async (roomId, leaverIdList, removerId) => {
const room = this.Room.load(roomId)
await room.ready()
await room.sync()

const leaverList = leaverIdList.map(id => this.Contact.load(id))
await Promise.all(leaverList.map(c => c.ready()))
Expand All @@ -702,7 +702,7 @@ export class Wechaty extends Accessory implements Sayable {
case 'room-topic':
puppet.on('room-topic', async (roomId, newTopic, oldTopic, changerId) => {
const room = this.Room.load(roomId)
await room.ready()
await room.sync()

const changer = this.Contact.load(changerId)
await changer.ready()
Expand Down

0 comments on commit 378e1bd

Please sign in to comment.