提交 4a8435b9 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

fix breaking changes for v0.15 (#518)

上级 e550671d
......@@ -134,6 +134,14 @@ export class Wechaty extends PuppetAccessory implements Sayable {
this.profile = new Profile(options.profile)
this.cuid = cuid()
/**
* Clone Classes for this bot
*/
this.Contact = cloneClass(Contact)
this.FriendRequest = cloneClass(FriendRequest)
this.Message = cloneClass(Message)
this.Room = cloneClass(Room)
}
/**
......@@ -197,10 +205,18 @@ export class Wechaty extends PuppetAccessory implements Sayable {
// set puppet instance to Wechaty Static variable, for using by Contact/Room/Message/FriendRequest etc.
// config.puppetInstance(puppet)
this.Contact = cloneClass(Contact)
this.FriendRequest = cloneClass(FriendRequest)
this.Message = cloneClass(Message)
this.Room = cloneClass(Room)
if (this === Wechaty._instance) {
/**
* Here means `this` is the global instance of Wechaty (`Wechaty.instance()`)
* So we can fix the breaking changes for #518
* https://github.com/Chatie/wechaty/issues/518
*/
Contact.puppet = this.puppet
FriendRequest.puppet = this.puppet
Message.puppet = this.puppet
Room.puppet = this.puppet
}
this.Contact.puppet = this.puppet
this.FriendRequest.puppet = this.puppet
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册