WebexCommunity / webex-node-bot-framework

A framework for creating Webex Teams bots using node and express
MIT License
58 stars 49 forks source link

How to create array from output of bot.webex.memberships.list #59

Closed stevemayster closed 2 years ago

stevemayster commented 2 years ago

Hello. It's not an issue just a question.I ask everywhere but nobody can help. I need to create array from output of this command :

bot.webex.memberships.list({roomId: bot.room.id})
    .then((memberships) => {
      for (const member of memberships.items) {
        if (member.personId === bot.person.id) {
          // Skip myself!
          continue;
        }

        let names = (member.personDisplayName) ? member.personDisplayName : member.personEmail;

But because it's a for cycle, whatever i do i got 3 array at the end. My goal is to create array from peoples name inside a space,randomize it, and bot says only one names.

stevemayster commented 2 years ago

Resolved myself