Never show bot token or session token in log
This commit is contained in:
		| @@ -973,15 +973,15 @@ class Bot(TelegramBot): | |||||||
|             self._telegram_id = me['id'] |             self._telegram_id = me['id'] | ||||||
|         except Exception as e: |         except Exception as e: | ||||||
|             logging.error( |             logging.error( | ||||||
|                 f"Information about bot with token {self.token} could not " |                 f"API getMe method failed, information about this bot could " | ||||||
|                 f"be got. Restarting in 5 minutes...\n\n" |                 f"not be retrieved. Restarting in 5 minutes...\n\n" | ||||||
|                 f"Error information:\n{e}" |                 f"Error information:\n{e}" | ||||||
|             ) |             ) | ||||||
|             await asyncio.sleep(5*60) |             await asyncio.sleep(5*60) | ||||||
|             self.__class__.stop( |             self.__class__.stop( | ||||||
|                 65, |                 65, | ||||||
|                 f"Information about bot with token {self.token} could not " |                 f"Information aformation about this bot could " | ||||||
|                 "be got. Restarting..." |                 f"not be retrieved. Restarting..." | ||||||
|             ) |             ) | ||||||
|  |  | ||||||
|     def setup(self): |     def setup(self): | ||||||
| @@ -1012,6 +1012,11 @@ class Bot(TelegramBot): | |||||||
|             allowed_updates=allowed_updates |             allowed_updates=allowed_updates | ||||||
|         )  # `setWebhook` API method returns `True` on success |         )  # `setWebhook` API method returns `True` on success | ||||||
|         webhook_information = await self.getWebhookInfo() |         webhook_information = await self.getWebhookInfo() | ||||||
|  |         webhook_information['url'] = webhook_information['url'].replace( | ||||||
|  |             self.token, "<BOT_TOKEN>" | ||||||
|  |         ).replace( | ||||||
|  |             self.session_token, "<SESSION_TOKEN>" | ||||||
|  |         ) | ||||||
|         if webhook_was_set: |         if webhook_was_set: | ||||||
|             logging.info( |             logging.info( | ||||||
|                 f"Webhook was set correctly.\n" |                 f"Webhook was set correctly.\n" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user