Function message `toContact()` should to be implemented.
Created by: su-chang
Is your feature request related to a problem? Please describe.
As we know, we can send ContactCard
message peer to peer or to room in Wechaty, but we can do nothing when we received a ContactCard
message in Wechaty.
Describe the solution you'd like
I hope that we can use ContactCard
to add friend. Then we can add friend in room or pm by Wechaty.
Describe alternatives you've considered
We can do something like UrlLink
, create a model named contact-card
in Wechaty, and it need a ContactCardPayload like this:
export interface UrlLinkPayload {
userName : string,
nickName: string,
headImgUrl: string,
}
When the bot received ContactCard message, then we use function message.toContact()
to get userName
from ContactCardPayload, and then the bot can add friend by userName
.
Additional context
I will create a PR for this issue later.
[enhancement]