Avoid second try, as it is useless

If first try fails, why should a second try succeed?
This commit is contained in:
Davte 2019-07-03 19:13:53 +02:00
parent 0610c0ce19
commit 4036971302

View File

@ -745,8 +745,7 @@ class Bot(TelegramBot, ObjectWithDatabase):
update=dict(), update=dict(),
reply_to_update=False, reply_to_update=False,
send_default_keyboard=True, send_default_keyboard=True,
use_stored_file_id=True, use_stored_file_id=True):
is_second_try=False):
"""Send photos. """Send photos.
This method wraps lower-level `TelegramBot.sendPhoto` method. This method wraps lower-level `TelegramBot.sendPhoto` method.
@ -829,22 +828,6 @@ class Bot(TelegramBot, ObjectWithDatabase):
), ),
['path'] ['path']
) )
if not is_second_try:
logging.info("Trying again (only once)...")
sent_update = await self.send_photo(
chat_id=chat_id,
photo=photo,
caption=caption,
parse_mode=parse_mode,
disable_notification=disable_notification,
reply_to_message_id=reply_to_message_id,
reply_markup=reply_markup,
update=update,
reply_to_update=reply_to_update,
send_default_keyboard=send_default_keyboard,
use_stored_file_id=use_stored_file_id,
is_second_try=True
)
if ( if (
type(sent_update) is dict type(sent_update) is dict
and 'photo' in sent_update and 'photo' in sent_update