Error: static puppet not found for XXX
Created by: huan
Error Message
- Error: static puppet not found for Contact/Room/Friendship/Message
- Error: class can not be instanciated directly!
- Error: must not use the global Message/Contact/Room. use a cloned child via cloneClass instead
Currently, the Contact
, FriendRequest
, Message
, and Room
classes will not be able to instantiate directly, because they must attach with a Puppet first.
They need to be cloneClass()
-ed first, then attach the puppet, and at last they will be ready for use by:
wechaty.Contact
Do Not
import { Room } from 'wechaty'
const room = await Room.create(...)
The above code will throw error.
Do
- import { Room } from 'wechaty'
+ import { Wechaty } from 'wechaty'
- const room = await Room.create(...)
+ const wechaty = new Wechaty()
+ const room = await wechaty.Room.create(...)
So does Contact, FriendRequest, and Message.
See Also
- Wechaty Multi-Instance Suport #518 (closed)
- NPM clone-class
- https://github.com/zixia/node-clone-class/issues/5