Invites users to a channel.

        Args:
            channel (str): The channel id. e.g. 'C1234567890'
            users (list): An list of user id's to invite. e.g. ['U2345678901', 'U3456789012']
332003
def conversations_invite(
        self, *, channel: str, users: List[str], **kwargs
    ) -> SlackResponse:
        
        self._validate_xoxp_token()
        kwargs.update({"channel": channel, "users": users})
        return self.api_call("conversations.invite", json=kwargs)
140212
def invite_user(self, new_member, inviter=None, roster=None):
        """"""
        roster = roster or self.client.getRoster()
        jid = new_member['JID']

        logger.info('roster %s %s' % (jid, roster.getSubscription(jid)))
        if jid in roster.keys() and roster.getSubscription(jid) in ['both', 'to']:
            new_member['STATUS'] = 'ACTIVE'
            if inviter:
                self.send_message('%s is already a member' % (jid,), inviter)
        else:
            new_member['STATUS'] = 'INVITED'
            self.broadcast('inviting %s to the room' % (jid,))

            #Add nickname according to http://xmpp.org/extensions/xep-0172.html
            subscribe_presence = xmpp.dispatcher.Presence(to=jid, typ='subscribe')
            if 'NICK' in self.params:
                subscribe_presence.addChild(name='nick', namespace=xmpp.protocol.NS_NICK, payload=self.params['NICK'])
            self.client.send(subscribe_presence)

        if not self.is_member(new_member):
            new_member.setdefault('NICK', jid.split('@')[0])
            self.params['MEMBERS'].append(new_member)
120898
def hosts(self, **kwargs):
        
        kwargs['channelID'] = self.id
        return self.connection.listHosts(**kwargs)
325775
def add_user(self, user):
        """"""
        if not isinstance(user, User):
            user = User(user)
        if user.nick in self.members:
            _log.warning("Ignoring request to add user '%s' to channel '%s' "
                         "because that user is already in the member list.",
                         user, self.name)
            return
        self.members[user.nick] = user
        _log.debug("Added '%s' to channel '%s'", user, self.name)
513727
def join(self, new_channel, nick, pwd=None):
        
        self._send_packet({"cmd": "join", "channel": new_channel,
                           "nick": self._format_nick(nick, pwd)})
183782
def invite_user(self, user_id):
        
        try:
            self.client.api.invite_user(self.room_id, user_id)
            return True
        except MatrixRequestError:
            return False
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)
710056
def set_pubsub_channels(self, request, channels):
        
        facility = request.path_info.replace(settings.WEBSOCKET_URL, '', 1)

        # initialize publishers
        audience = {
            'users': 'publish-user' in channels and [SELF] or [],
            'groups': 'publish-group' in channels and [SELF] or [],
            'sessions': 'publish-session' in channels and [SELF] or [],
            'broadcast': 'publish-broadcast' in channels,
        }
        self._publishers = set()
        for key in self._get_message_channels(request=request, facility=facility, **audience):
            self._publishers.add(key)

        # initialize subscribers
        audience = {
            'users': 'subscribe-user' in channels and [SELF] or [],
            'groups': 'subscribe-group' in channels and [SELF] or [],
            'sessions': 'subscribe-session' in channels and [SELF] or [],
            'broadcast': 'subscribe-broadcast' in channels,
        }
        self._subscription = self._connection.pubsub()
        for key in self._get_message_channels(request=request, facility=facility, **audience):
            self._subscription.subscribe(key)
1071730
def raw_channel_mentions(self):
        
        return [int(x) for x in re.findall(r'<#([0-9]+)>', self.content)]
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
1004269
def select_channel(self, channel):
        
        for i in str(channel):
            key = int(i) + 0xe300
            self.send_key(key)
299627
def add_channel(channel: EFBChannel):
    
    global master, slaves
    if isinstance(channel, EFBChannel):
        if channel.channel_type == ChannelType.Slave:
            slaves[channel.channel_id] = channel
        else:
            master = channel
    else:
        raise TypeError("Channel instance is expected")
365921
def call
      return broadcast(:invalid) unless user&.invited_to_sign_up?

      user.invite!(user.invited_by, invitation_instructions: instructions)

      broadcast(:ok)
    end
1257438
async def warn_user(channel, user):
    

    data = datatools.get_data()
    server_id = channel.server.id

    if "warnings_max" not in data["discord"]["servers"][server_id][_data.modulename]:
        data["discord"]["servers"][server_id][_data.modulename]["warnings_max"] = 3
    if "warnings" not in data["discord"]["servers"][server_id][_data.modulename]:
        data["discord"]["servers"][server_id][_data.modulename]["warnings"] = {}

    if user.id in data["discord"]["servers"][server_id][_data.modulename]["warnings"]:
        data["discord"]["servers"][server_id][_data.modulename]["warnings"][user.id] += 1
    else:
        data["discord"]["servers"][server_id][_data.modulename]["warnings"][user.id] = 1

    datatools.write_data(data)

    warnings = data["discord"]["servers"][server_id][_data.modulename]["warnings"][user.id]
    max_warnings = data["discord"]["servers"][server_id][_data.modulename]["warnings_max"]

    await client.send_typing(channel)
    embed = ui_embed.user_warning(channel, user, warnings, max_warnings)
    await embed.send()

    if warnings >= max_warnings:
        await ban_user(channel, user)
878504
def url(self) -> str:
        
        if self.chat.type not in [ChatType.SUPER_GROUP, ChatType.CHANNEL]:
            raise TypeError('Invalid chat type!')
        elif not self.chat.username:
            raise TypeError('This chat does not have @username')

        return f"https://t.me/{self.chat.username}/{self.message_id}"
976310
async def ban_user(channel, user):
    

    data = datatools.get_data()
    server_id = channel.server.id

    try:
        await client.ban(user)
    except discord.errors.Forbidden:
        await client.send_typing(channel)
        embed = ui_embed.error(channel, "Ban Error", "I do not have the permissions to ban that person.")
        await embed.send()
        return

    # Set the user's warnings to 0
    if "warnings" in data["discord"]["servers"][server_id][_data.modulename]:
        if user.id in data["discord"]["servers"][server_id][_data.modulename]["warnings"]:
            data["discord"]["servers"][server_id][_data.modulename]["warnings"][user.id] = 0
            datatools.write_data(data)

    await client.send_typing(channel)
    embed = ui_embed.user_ban(channel, user)
    await embed.send()

    try:
        response = "You have been banned from the server '{}' " \
                   "contact the owners to resolve this issue.".format(channel.server.name)
        await client.send_message(user, response)
    except Exception as e:
        logger.exception(e)
293912
def commit_channel(self, channel_id):
        
        payload = {
            "channel_id":channel_id,
            "stage": config.STAGE,
        }
        response = config.SESSION.post(config.finish_channel_url(), data=json.dumps(payload))
        if response.status_code != 200:
            config.LOGGER.error("\n\nCould not activate channel: {}\n".format(response._content.decode('utf-8')))
            if response.status_code == 403:
                config.LOGGER.error("Channel can be viewed at {}\n\n".format(config.open_channel_url(channel_id, staging=True)))
                sys.exit()
        response.raise_for_status()
        new_channel = json.loads(response._content.decode("utf-8"))
        channel_link = config.open_channel_url(new_channel['new_channel'])
        return channel_id, channel_link