Updates echobot and getUpdates logging

This commit is contained in:
leandrotoledo 2015-07-20 08:59:41 -03:00
parent cad325c874
commit 6b7476c18f
2 changed files with 9 additions and 1 deletions

View file

@ -24,7 +24,7 @@ def echo():
if LAST_UPDATE_ID < update.update_id:
# chat_id is required to reply any message
chat_id = update.message.chat_id
message = update.message.text
message = update.message.text.encode('utf-8')
if (message):
# Reply the message

View file

@ -50,6 +50,8 @@ class Bot(TelegramObject):
self.username = bot.username
self.__auth = True
self.log.info('Starting bot %s' % self.name)
except TelegramError:
raise TelegramError({'message': 'Bad token'})
@ -533,6 +535,12 @@ class Bot(TelegramObject):
json_data = self._requestUrl(url, 'POST', data=data)
data = self._parseAndCheckTelegram(json_data)
if data:
self.log.info(
'Getting updates: %s' % [u['update_id'] for u in data])
else:
self.log.info('No new updates found.')
return [Update.de_json(x) for x in data]
@log