Use the davtelepot.Bot.set_placeholder method
Avoid using the placeholder message if not necessary.
This commit is contained in:
parent
24952b2b82
commit
57e254140c
@ -3,6 +3,6 @@
|
|||||||
__author__ = "Davide Testa"
|
__author__ = "Davide Testa"
|
||||||
__email__ = "davide@davte.it"
|
__email__ = "davide@davte.it"
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "1.1.1"
|
__version__ = "1.1.2"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
@ -568,23 +568,18 @@ async def _ciclopi_command(bot, update, user_record, sent_message=None,
|
|||||||
show_all=False):
|
show_all=False):
|
||||||
chat_id = update['chat']['id']
|
chat_id = update['chat']['id']
|
||||||
default_stations_to_show = 5
|
default_stations_to_show = 5
|
||||||
if sent_message is None:
|
placeholder_id = bot.set_placeholder(
|
||||||
await bot.sendChatAction(
|
timeout=datetime.timedelta(seconds=1),
|
||||||
|
sent_message=sent_message,
|
||||||
chat_id=chat_id,
|
chat_id=chat_id,
|
||||||
action='typing'
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
await bot.edit_message_text(
|
|
||||||
update=sent_message,
|
|
||||||
text="<i>{message}...</i>".format(
|
text="<i>{message}...</i>".format(
|
||||||
message=bot.get_message(
|
message=bot.get_message(
|
||||||
'ciclopi', 'command', 'updating',
|
'ciclopi', 'command', 'updating',
|
||||||
update=update, user_record=user_record
|
update=update, user_record=user_record
|
||||||
)
|
)
|
||||||
),
|
|
||||||
parse_mode='HTML',
|
|
||||||
reply_markup=None
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
await asyncio.sleep(3)
|
||||||
ciclopi_data = await ciclopi_webpage.get_page()
|
ciclopi_data = await ciclopi_webpage.get_page()
|
||||||
if ciclopi_data is None or isinstance(ciclopi_data, Exception):
|
if ciclopi_data is None or isinstance(ciclopi_data, Exception):
|
||||||
text = bot.get_message(
|
text = bot.get_message(
|
||||||
@ -807,6 +802,8 @@ async def _ciclopi_command(bot, update, user_record, sent_message=None,
|
|||||||
else bot.edit_message_text
|
else bot.edit_message_text
|
||||||
)
|
)
|
||||||
await method(**parameters)
|
await method(**parameters)
|
||||||
|
# Mark request as done
|
||||||
|
bot.placeholder_requests[placeholder_id] = 1
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user