from http_client import HttpClient

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

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

    def send_message(self, message, completion):

        def _completion(response, error):
            print error
            if error is None:
                # TODO: Is there anything the bot needs to do?
                # maybe retry if it fails...?
                pass
            else:
                print response
                completion(response)

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

    def set_welcome(self, message, completion):
        url = "/me/thread_settings?access_token=%s" % (self.access_token)
        
        def _completion(response, error):
            print error
            if error is None:
                # TODO: Is there anything the bot needs to do?
                # maybe retry if it fails...?
                pass
            else:
                print response
                completion(response)

        self.client.submit_request(
            url,
            'POST'
            message.to_json(),
            _completion)
        

@@ -188,16 +188,21 @@
 pClient(
+token
 )%0A%0A    d
@@ -755,82 +755,8 @@
 n):%0A
-        url = %22/me/thread_settings?access_token=%25s%22 %25 (self.access_token)%0A
     
@@ -1125,11 +1125,29 @@
     
-url
+'/me/thread_settings'
 ,%0A  
@@ -1162,16 +1162,17 @@
   'POST'
+,
 %0A       

Fix errors in set_welcome and update for http_client