<commit_before>from http_client import HttpClient
 
from models.message import ReceivedMessage

class Bot():
    """
    @brief Facebook messenger bot
    """

    def __init__(self, token):
        self.api_token = token
        self.client = HttpClient(token)

    def send_message(self, message):

        response, error = self.client.submit_request(
                            '/me/messages', 
                            'POST', 
                            message.to_json())

        if error is not None:
            print 'Error Encountered! Could not send message\n'
            print 'Message: %s' % error
        
        return response, error

    def set_welcome(self, message, completion):

        self.client.submit_request(
            '/me/thread_settings',
            'POST',
            message.to_json())

    def messages_for_request(self, request):
        """
        Handle incoming requests from the webhook
        """

        entries = request.json['entry']
        messages = []
        for entry in entries:
            message = {}
            for msg in entry['messaging']:
                messages.append(ReceivedMessage(msg))

        return messages

    def message_from_reciept(receipt):
        """
        Handle receipts
        """

        raise NotImplementedError
<commit_msg>Adding msg safety to not respond to msg delivery notices<commit_after>from http_client import HttpClient
 
from models.message import ReceivedMessage

class Bot():
    """
    @brief Facebook messenger bot
    """

    def __init__(self, token):
        self.api_token = token
        self.client = HttpClient(token)

    def send_message(self, message):

        response, error = self.client.submit_request(
                            '/me/messages', 
                            'POST', 
                            message.to_json())

        if error is not None:
            print 'Error Encountered! Could not send message\n'
            print 'Message: %s' % error
        
        return response, error

    def set_welcome(self, message, completion):

        self.client.submit_request(
            '/me/thread_settings',
            'POST',
            message.to_json())

    def messages_for_request(self, request):
        """
        Handle incoming requests from the webhook
        """

        entries = request.json['entry']
        messages = []
        for entry in entries:
            message = {}
            for msg in entry['messaging']:
                if msg.get('message') and msg['message'].get('text'):
                    messages.append(ReceivedMessage(msg))

        return messages

    def message_from_reciept(receipt):
        """
        Handle receipts
        """

        raise NotImplementedError

{'fraction_non_alphanumeric': 0.09064644275911882, 'fraction_numerical': 0.0, 'mean_word_length': 1.6998050682261208, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2705726', 'n_tokens_mistral': 717, 'n_tokens_neox': 673, 'n_words': 187}