scrapinghub/slackbot

Members of current channel

Johboh opened this issue · 2 comments

Hi!
How can I get the members of the current channel that the bot is replying/reacting in?

message.channel._client.channels[message.body['channel']] have members field, but that one only contains one member and that is the bot itself, even when there are more users in the channel.

message.channel._client.users returns ALL users in the organization.

The use case is to do an eightball bot, like:
@bot Should I go home or stay?
I dunno, but maybe <usernname> knows!

But I only want to pick users that are in the channel where the question is asked.

//Johan

Have you tried accessing
message._client.webapi.groups.info(channel='GXXXXXXXX') for private channels and
message._client.webapi.channels.info(channel='CXXXXXXXX') for public channels
you know a channel is Private if it starts with G and public starts with C

Thanks! I will give it a try.