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

PuppetPadChat:Contact.avatar() Error #1473

Closed
zhoumh1988 opened this issue Jul 12, 2018 · 5 comments
Closed

PuppetPadChat:Contact.avatar() Error #1473

zhoumh1988 opened this issue Jul 12, 2018 · 5 comments
Assignees
Labels

Comments

@zhoumh1988
Copy link

0|lightbot | You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
0|lightbot | Error: no avatar
0|lightbot |     at PuppetPadchat.<anonymous> (/Users/zhouminghua/Documents/mp/lightbot/node_modules/wechaty/node_modules/wechaty-puppet-padchat/dist/src/puppet-padchat.js:449:23)
0|lightbot |     at Generator.next (<anonymous>)
0|lightbot |     at fulfilled (/Users/zhouminghua/Documents/mp/lightbot/node_modules/wechaty/node_modules/wechaty-puppet-padchat/dist/src/puppet-padchat.js:22:58)
0|lightbot |     at process._tickCallback (internal/process/next_tick.js:68:7)

When I get contact avatar.

let rooms = bot.Room.findAll();
rooms.forEach(async r => {
    let members = await r.memberList();
    membders.forEach(aynsc c => {
        let avatar = await contact.avatar();
    });
});
@lijiarui
Copy link
Member

lijiarui commented Jul 12, 2018

Are you sure room or contact exist?

Could you change as follows and have a try:

let rooms = bot.Room.findAll();
rooms.forEach(async r => {
    if (r) {
      let members = await r.memberList();
      membders.forEach(aynsc c => {
          if (c) {
             let avatar = await contact.avatar();
          }
    });
    }
});

@zhoumh1988
Copy link
Author

Why memberList has the contact who not exist in the room.
I test, it works.

@lijiarui
Copy link
Member

when the contact exist the room byhimself, wechaty cannot detect that thing.

@zhoumh1988
Copy link
Author

OK,I know.

@huan huan reopened this Jul 12, 2018
@huan huan self-assigned this Jul 12, 2018
@huan
Copy link
Member

huan commented Jul 12, 2018

@zhoumh1988 Thanks for reporting.

I reopen this because we should deal with this situation instead of an unhandledRejection.

@huan huan added the bug label Jul 12, 2018
@huan huan closed this as completed in c677b96 Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants