New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XXX: Wechaty User Class (WUC) can not be instantiated directly! #1217
Comments
It may should be
|
I'm quite confused by "So does Contact, FriendRequest, and Message"... The property wechaty.Contact seems to be a Function without a method named "create". So how should I create a contact with id actually? |
@yarray there's an example that demonstrated how to create a new room, hope that could help you to understand. BTW: You can never create a contact with id because you can only find it. |
#25) * fix: error "The global Contact class can not be used directly! #wechaty/wechaty#1217 " * fix: remove global contact define because we donnot use it anymore * 3.0.2
How can I receive and display an image in wechaty Python? I have tried finding the solution in documentation but no success. |
TL;DR
If you come here by following the error message:
Solution
Use
wechaty.UserClass
instead of usingUserClass
directly.For examples:
Background
Error Message
Currently, the
Contact
,FriendRequest
,Message
, andRoom
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 NotThe above code will throw error.
Do
So does Contact, FriendRequest, and Message.
See Also
The text was updated successfully, but these errors were encountered: