Skip to content
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

BREAKING CHANGE: v0.16 on('friend`) arguments changed! #1196

Closed
huan opened this issue May 10, 2018 · 0 comments
Closed

BREAKING CHANGE: v0.16 on('friend`) arguments changed! #1196

huan opened this issue May 10, 2018 · 0 comments

Comments

@huan
Copy link
Member

huan commented May 10, 2018

FriendRequest class refactored.

Before (v0.14 or below)

wechaty.on('friend', (contact, request) => {
  if (!request) {
    // this is a friend request confirmation event
  } else {
    // this is a friend request
  }
})

After (v0.16 or above)

wechaty.on('friendship', request => {
  switch (request.type()) {
    case FriendRequest.Type.RECEIVE:
      // this is a friend request request
      break
    case FriendRequest.Type.CONFIRM:
      // this is a friend request confirmation
      break
  }
})
@huan huan added this to the v0.16 Connecting with the Cloud & App milestone May 10, 2018
@huan huan closed this as completed May 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants