mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-25 08:37:07 +01:00
Updates echobot and getUpdates logging
This commit is contained in:
parent
cad325c874
commit
6b7476c18f
2 changed files with 9 additions and 1 deletions
|
@ -24,7 +24,7 @@ def echo():
|
||||||
if LAST_UPDATE_ID < update.update_id:
|
if LAST_UPDATE_ID < update.update_id:
|
||||||
# chat_id is required to reply any message
|
# chat_id is required to reply any message
|
||||||
chat_id = update.message.chat_id
|
chat_id = update.message.chat_id
|
||||||
message = update.message.text
|
message = update.message.text.encode('utf-8')
|
||||||
|
|
||||||
if (message):
|
if (message):
|
||||||
# Reply the message
|
# Reply the message
|
||||||
|
|
|
@ -50,6 +50,8 @@ class Bot(TelegramObject):
|
||||||
self.username = bot.username
|
self.username = bot.username
|
||||||
|
|
||||||
self.__auth = True
|
self.__auth = True
|
||||||
|
|
||||||
|
self.log.info('Starting bot %s' % self.name)
|
||||||
except TelegramError:
|
except TelegramError:
|
||||||
raise TelegramError({'message': 'Bad token'})
|
raise TelegramError({'message': 'Bad token'})
|
||||||
|
|
||||||
|
@ -533,6 +535,12 @@ class Bot(TelegramObject):
|
||||||
json_data = self._requestUrl(url, 'POST', data=data)
|
json_data = self._requestUrl(url, 'POST', data=data)
|
||||||
data = self._parseAndCheckTelegram(json_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]
|
return [Update.de_json(x) for x in data]
|
||||||
|
|
||||||
@log
|
@log
|
||||||
|
|
Loading…
Reference in a new issue