Exemple #1
0
    def _is_valid_user(update, associated_config=CONFIG_INTERFACES_TELEGRAM):
        update_username = update.effective_chat["username"]

        is_valid, white_list = InterfaceBot._is_valid_user(
            update_username, associated_config=associated_config)

        if white_list and not is_valid:
            LOGGER.error(
                f"An unauthorized Telegram user is trying to talk to me: username: "******"{update_username}, first_name: {update.effective_chat['first_name']}, "
                f"text: {update.effective_message['text']}")

        return is_valid
Exemple #2
0
    def _is_valid_user(update, associated_config=CONFIG_INTERFACES_TELEGRAM):

        # only authorize users from a private chat
        if not TelegramApp._is_authorized_chat(update):
            return False

        update_username = update.effective_chat["username"]

        is_valid, white_list = InterfaceBot._is_valid_user(update_username, associated_config=associated_config)

        if white_list and not is_valid:
            TelegramApp.get_logger().error(f"An unauthorized Telegram user is trying to talk to me: username: "******"{update_username}, first_name: {update.effective_chat['first_name']}, "
                                           f"text: {update.effective_message['text']}")

        return is_valid