instabot/bot/bot_direct.py
def send_message(self, text, user_ids, thread_id=None):
    """
    :param self: bot
    :param text: text of message
    :param user_ids: list of user_ids for creating group or one user_id for send to one person
    :param thread_id: thread_id
    """
    user_ids = _get_user_ids(self, user_ids)
    if not isinstance(text, str) and isinstance(user_ids, (list, str)):
        self.logger.error('Text must be an string, user_ids must be an list or string')
        return False

    if self.reached_limit('messages'):
        self.logger.info("Out of messages for today.")
        return False

    self.delay('message')
    urls = self.extract_urls(text)
    item_type = 'link' if urls else 'text'
    if self.api.send_direct_item(
        item_type,
        user_ids,
        text=text,
        thread=thread_id,
        urls=urls
    ):
        self.total['messages'] += 1
        return True

    self.logger.info("Message to {user_ids} wasn't sent".format(user_ids=user_ids))
    return False
def send_message(self, text, user_ids, thread_id=None):
    """
    :param self: bot
    :param text: text of message
    :param user_ids: list of user_ids for creating group or one user_id for send to one person
    :param thread_id: thread_id
    """
    user_ids = _get_user_ids(self, user_ids)
    if not isinstance(text, str) and isinstance(user_ids, (list, str)):
        self.logger.error('Text must be an string, user_ids must be an list or string')
        return False

    if self.reached_limit('messages'):
        self.logger.info("Out of messages for today.")
        return False

    self.delay('message')
    urls = self.extract_urls(text)
    item_type = 'link' if urls else 'text'
    if self.api.send_direct_item(
        item_type,
        user_ids,
        text=text,
        thread=thread_id,
        urls=urls
    ):
        self.total['messages'] += 1
        return True

    self.logger.info("Message to {user_ids} wasn't sent".format(user_ids=user_ids))
    return False
:param self: bot
    :param text: text of message
    :param user_ids: list of user_ids for creating group or one user_id for send to one person
    :param thread_id: thread_id