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

获取所有群 #1020

Closed
sowhatwill opened this issue Dec 20, 2017 · 7 comments
Closed

获取所有群 #1020

sowhatwill opened this issue Dec 20, 2017 · 7 comments

Comments

@sowhatwill
Copy link

Room.findAll() 获取所有群不稳定,有多有少.

@lijiarui
Copy link
Member

This works as expect. Because web wechat cannot get all groups in your wechat

What I did now like this:

async function initRoom() {
  console.log('begin to initRoom!')
  const roomList = await Room.findAll()
  if (roomList.length < MAX_GROUP) {
    console.warn(`room num not ready. retry after 10 seconds. room num: ${roomList.length}`)
    setTimeout(initRoom, 10000)
    return
  }
  return roomList
}

@sowhatwill
Copy link
Author

谢谢了,如果这样做的话,我就需要改一下业务流程了.

@forconz
Copy link

forconz commented Dec 23, 2017

如何知道room的群主信息?

/**
* @Private
* Get room's owner from the room.
* Not recommend, because cannot always get the owner
* @returns {(Contact | null)}
*/
owner(): Contact | null;

@forconz
Copy link

forconz commented Dec 23, 2017

@lijirui MAX_GROUP是多少?

@lijiarui
Copy link
Member

  1. If you can get room.owner(), then console log the contact, you can get the room owner's information.

  2. MAX_GROUP depends on your situation, I don't know how rooms in your wechat bot.

@huan
Copy link
Member

huan commented Apr 30, 2018

This feature might be able to be enhanced by the New Puppets.

See: #1167

@huan
Copy link
Member

huan commented Jul 6, 2018

Close this issue due to inactivated for 60 days.

@huan huan closed this as completed Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants