Provide to cancel next message waiter.

This commit is contained in:
Alex Root Junior 2017-06-03 10:50:48 +03:00
parent bf9657dfc5
commit 03c7e4a6d8
4 changed files with 39 additions and 9 deletions

View file

@ -37,7 +37,12 @@ async def save_sticker(message):
# It can only be a sticker
msg = await dp.next_message(message,
content_types=[ContentType.STICKER],
otherwise=handle_bad_message)
otherwise=handle_bad_message,
include_cancel=True)
if not msg:
# If user send /cancel
return await message.reply('Canceled.')
# Download file to memory (io.BytesIO)
photo = await bot.download_file(msg.sticker.file_id)