diff --git a/ciclopibot/__init__.py b/ciclopibot/__init__.py index d44e423..2951aeb 100644 --- a/ciclopibot/__init__.py +++ b/ciclopibot/__init__.py @@ -3,6 +3,6 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __license__ = "GNU General Public License v3.0" -__version__ = "1.1.1" +__version__ = "1.1.2" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/ciclopibot/ciclopi.py b/ciclopibot/ciclopi.py index b060fe7..045576b 100644 --- a/ciclopibot/ciclopi.py +++ b/ciclopibot/ciclopi.py @@ -568,23 +568,18 @@ async def _ciclopi_command(bot, update, user_record, sent_message=None, show_all=False): chat_id = update['chat']['id'] default_stations_to_show = 5 - if sent_message is None: - await bot.sendChatAction( - chat_id=chat_id, - action='typing' - ) - else: - await bot.edit_message_text( - update=sent_message, - text="{message}...".format( - message=bot.get_message( - 'ciclopi', 'command', 'updating', - update=update, user_record=user_record - ) - ), - parse_mode='HTML', - reply_markup=None + placeholder_id = bot.set_placeholder( + timeout=datetime.timedelta(seconds=1), + sent_message=sent_message, + chat_id=chat_id, + text="{message}...".format( + message=bot.get_message( + 'ciclopi', 'command', 'updating', + update=update, user_record=user_record + ) ) + ) + await asyncio.sleep(3) ciclopi_data = await ciclopi_webpage.get_page() if ciclopi_data is None or isinstance(ciclopi_data, Exception): text = bot.get_message( @@ -807,6 +802,8 @@ async def _ciclopi_command(bot, update, user_record, sent_message=None, else bot.edit_message_text ) await method(**parameters) + # Mark request as done + bot.placeholder_requests[placeholder_id] = 1 return