Get all channel names from Slack
182993
def get_slack_channels(self, token):
        '''
        
        '''

        ret = salt.utils.slack.query(
            function='rooms',
            api_key=token,
            # These won't be honored until https://github.com/saltstack/salt/pull/41187/files is merged
            opts={
                'exclude_archived': True,
                'exclude_members': True
            })
        channels = {}
        if 'message' in ret:
            for item in ret['message']:
                channels[item['id']] = item['name']
        return channels
1008840
def _find_user_channel(self, username):
		
		user_id = self.slacker.users.get_user_id(username)
		im = user_id and self.slacker.im.open(user_id).body['channel']['id']
		return im and self.slack.server.channels.find(im)
434701
def channels_rename(self, *, channel: str, name: str, **kwargs) -> SlackResponse:
        
        self._validate_xoxp_token()
        kwargs.update({"channel": channel, "name": name})
        return self.api_call("channels.rename", json=kwargs)
108108
def list(self, **kwargs):
        
        if kwargs:
            self.params.update(kwargs)
        return FromUrl('https://slack.com/api/groups.list', self._requests)(data=self.params).get()
1314913
def get_channel(self, name):
        
        name = quote(name, '')
        path = Client.urls['channels_by_name'] % name
        chan = self._call(path, 'GET')
        return chan
529194
def get_subscriptions_channel(self, search_channel):
        
        data = self.get_clients()
        clients = []
        for client in data:
            if 'subscriptions' in client:
                if isinstance(client['subscriptions'], list):
                    if search_channel in client['subscriptions']:
                        clients.append(client['name'])
                else:
                    if search_channel == client['subscriptions']:
                        clients.append(client['name'])
        return clients
62633
def _name_messages_complete(self):
        
        for channel in range(1, self.number_of_channels() + 1):
            try:
                for name_index in range(1, 4):
                    if not isinstance(self._name_data[channel][name_index], str):
                        return False
            except Exception:
                return False
        return True
543804
def load_channels(self):
        
        channels = []

        # Try to get channels
        for channel_name in self.channel_names:
            channel_path = os.path.join(self.path, "channels")
            sys.path.append(self.path)
            mod = imp.load_module(channel_name, *imp.find_module(channel_name, [channel_path]))
            cls = getattr(mod, channel_name.title().replace("_", ""))
            channel_id = channel_name.split("_")[0]
            # TODO: what about up_to_timestamp?
            try:
                channels.append(cls(channel_id, up_to_timestamp=None))
            except TypeError:
                channels.append(cls(channel_id))

        # Try to get tools
        if self.has_tools:
            tool_path = os.path.join(self.path, "tools")
            # Create a tool channel using this path
            channel_id = self.channel_id_prefix + "_" + "tools"
            channel = ToolChannel(channel_id, tool_path, up_to_timestamp=utcnow())
            channels.append(channel)

        if self.has_assets:
            assset_path = os.path.join(os.path.abspath(self.path), "assets")
            channel_id = self.channel_id_prefix + "_" + "assets"
            channel = AssetsFileChannel(channel_id, assset_path, up_to_timestamp=utcnow())
            channels.append(channel)
            #
            # from . import TimeInterval
            # channel.streams.values()[0].window(TimeInterval.up_to_now()).items()

        return channels
194406
def channel_names(fn, usecols=None):
    """"""

    with open(fn, 'rb') as fo:
        names = dbfreader(fo).next()

    return usecols and [names[i] for i in usecols] or names
258361
public static Collection<String> getChannelNames(
			Collection<Channel> channels) {
		Collection<String> channelNames = new HashSet<String>();
		for (Channel channel : channels) {
			channelNames.add(channel.getName());
		}
		return channelNames;
	}
227097
def get_channel_listing(self):
        
        return {'name': self.name,
                'key': self.channel.key,
                'type': self.channel.typ,
                'read_only': self.read_only,
                'is_online': self.is_online(),
                'actions': self.get_actions(),
                'unread': self.unread_count()}
359017
private void getImChannels(String slackToken, int limit, String nextCursor) {
        try {
            Event event = restTemplate.getForEntity(slackApiEndpoints.getImListApi(), Event.class,
                    slackToken, limit, nextCursor).getBody();
            imChannelIds.addAll(Arrays.stream(event.getIms()).map(Channel::getId).collect(Collectors.toList()));
            if (event.getResponseMetadata() != null &&
                    !StringUtils.isEmpty(event.getResponseMetadata().getNextCursor())) {
                Thread.sleep(5000L); // sleep because its a tier 2 api which allows only 20 calls per minute
                getImChannels(slackToken, limit, event.getResponseMetadata().getNextCursor());
            }
        } catch (Exception e) {
            logger.error("Error fetching im channels for the bot: ", e);
        }
    }
486928
def names(self, channel):
        
        with self.lock:
            self.is_in_channel(channel)

            self.send('NAMES %s' % channel)
            names = []

            while self.readable():
                msg = self._recv(expected_replies=('353', '366'))

                if msg[0] == '353':
                    new_names = msg[2].split()[2:]
                    new_names[0] = new_names[0].replace(':', '', 1)
                    names.extend(new_names)
                elif msg[0] == '366':
                    channel = msg[2].split()[0]
                    break

            for name in names:
                prefix = ''
                if name[0] in self.priv_types:
                    prefix = name[0]
                    name = name[1:]
                if prefix == '~':
                    self.channels[channel]['USERS'][name] = \
                    ['~', '', '', '', '']
                elif prefix == '&':
                    self.channels[channel]['USERS'][name] = \
                    ['', '&', '', '', '']
                elif prefix == '@':
                    self.channels[channel]['USERS'][name] = \
                    ['', '', '@', '', '']
                elif prefix == '%':
                    self.channels[channel]['USERS'][name] = \
                    ['', '', '', '%', '']
                elif prefix == '+':
                    self.channels[channel]['USERS'][name] = \
                    ['', '', '', '', '+']
                else:
                    self.channels[channel]['USERS'][name] = \
                    ['', '', '', '', '']
            return names
296747
def unarchive(self, channel_name):
        
        channel_id = self.get_channel_id(channel_name)
        self.params.update({
            'channel': channel_id,
            })
        return FromUrl('https://slack.com/api/channels.unarchive', self._requests)(data=self.params).post()
996846
def get_channels(self):
        """"""
        self.request(EP_GET_TV_CHANNELS)
        return {} if self.last_response is None else self.last_response.get('payload').get('channelList')
1071730
def raw_channel_mentions(self):
        
        return [int(x) for x in re.findall(r'<#([0-9]+)>', self.content)]
29413
def history(self, channel, **kwargs):
        
        self.params.update({
            'channel': channel,
            })
        if kwargs:
            self.params.update(kwargs)
        return FromUrl('https://slack.com/api/im.history', self._requests)(data=self.params).get()