diff --git a/README.md b/README.md index 4b3a3469e54ae9b4ff71c9f8ee78747e46ed29f5..f261ea75819bf66b53a006ab1a3986e7e4e088b2 100644 --- a/README.md +++ b/README.md @@ -406,8 +406,11 @@ The `message` here is a [Message](#class-message). Fired when we got new friend request, or confirm a friend ship. +1. if `request?: FriendRequest` is set, then it's a friend request +1. if `request?: FriendRequest` is not set, then it's a friend confirmation + ```ts -wechaty.on('friend', (this: Sayable, contact: Contact, request: FriendRequest) => { +wechaty.on('friend', (this: Sayable, contact: Contact, request?: FriendRequest) => { if (request) { // 1. request to be friend from new contact request.accept() console.log('auto accepted for ' + contact + ' with message: ' + request.hello)