Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for albums #4

Closed
Lonami opened this issue Jan 7, 2018 · 4 comments
Closed

Add support for albums #4

Lonami opened this issue Jan 7, 2018 · 4 comments

Comments

@Lonami
Copy link

Lonami commented Jan 7, 2018

I don't even know if it's possible. I won't even use it. But you told me to do this:
image

@udf
Copy link
Owner

udf commented Jan 8, 2018

ok thanks ill get back to you tomorrow

@Lonami
Copy link
Author

Lonami commented Jan 9, 2018

Hello, today is yesterday's tomorrow.

@Lonami
Copy link
Author

Lonami commented May 25, 2019

with bot:
    @bot.on(events.NewMessage)
    async def handler(event):
        async with bot.conversation(event.chat_id) as conv:
            await conv.send_message('Send me an album')
            items = [await conv.get_response()]
            if not items[0].photo:
                await conv.send_message("That's not a photo at all")
                return

            try:
                while items[0].grouped_id:  # only loop if it's an album
                    item = await conv.get_response(timeout=0.1)
                    if item.grouped_id != items[0].grouped_id:
                        break

                    items.append(item)
            except asyncio.TimeoutError:
                pass

            await conv.send_message(f'Thank you for your {len(items)} photo(s)')

    bot.run_until_disconnected()

@udf
Copy link
Owner

udf commented May 25, 2019

thanks lonami, very cool.

@udf udf closed this as completed in 122fed9 Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants