bot/bot.py
def checkUpdates(self):
        """Check new messages received by the bot"""

        response = requests.post(
            url='https://api.telegram.org/bot{0}/{1}'.format(self.token, 'getUpdates'),
            data={'offset': self.update_id}
        ).json()
        
        if response['ok'] == True:
            if response['result']:
                if self.update_id == None:
                    self.update_id = response['result'][0]['update_id']
                    print 'Update_id updated! (%s)' % str(self.update_id)
                
                if response['result'][0]['update_id'] == self.update_id:
                    message = response['result'][0]['message']
                    self.update_id += 1
                    print message
                    return message
        else:
            print 'Unsuccessful request. Error code: %s. %s' % (response['error_code'], response['description'])
Check new messages received by the bot
Check new messages received by the bot
Check new messages received by the bot
def checkUpdates(self):
        response = requests.post(
            url='https://api.telegram.org/bot{0}/{1}'.format(self.token, 'getUpdates'),
            data={'offset': self.update_id}
        ).json()
        if response['ok'] == True:
            if response['result']:
                if self.update_id == None:
                    self.update_id = response['result'][0]['update_id']
                    print 'Update_id updated! (%s)' % str(self.update_id)
                if response['result'][0]['update_id'] == self.update_id:
                    message = response['result'][0]['message']
                    self.update_id += 1
                    print message
                    return message
        else:
            print 'Unsuccessful request. Error code: %s. %s' % (response['error_code'], response['description'])
def checkUpdates ( self ) : response = requests . post ( url = 'https://api.telegram.org/bot{0}/{1}' . format ( self . token , 'getUpdates' ) , data = { 'offset' : self . update_id } ) . json ( ) if response [ 'ok' ] == True : if response [ 'result' ] : if self . update_id == None : self . update_id = response [ 'result' ] [ 0 ] [ 'update_id' ] print 'Update_id updated! (%s)' % str ( self . update_id ) if response [ 'result' ] [ 0 ] [ 'update_id' ] == self . update_id : message = response [ 'result' ] [ 0 ] [ 'message' ] self . update_id += 1 print message return message else : print 'Unsuccessful request. Error code: %s. %s' % ( response [ 'error_code' ] , response [ 'description' ] )
Check new messages received by the bot
Check new messages received by the bot
"""Check new messages received by the bot"""
self