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

message_handler: Processes the first two media together when sent simultaneously (type: media_group_id) #2391

Open
tandat132 opened this issue Aug 31, 2024 · 3 comments
Labels

Comments

@tandat132
Copy link

tandat132 commented Aug 31, 2024

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using?
    4.22.1
  2. What OS are you using?
    windows
  3. What version of python are you using?
    3.11.9

The first two media files are processed together, leading to the same output or action being applied to both.
Code:

i = 1
@bot.message_handler(func=lambda message: True)
def handle_message(message):
     global i
     print(i)
     print(message)
     i = i+1

Result:

1
1
message
message
2
message
3
message
...
@coder2020official
Copy link
Collaborator

Hi. This behaviour is not due to library but API.

The only solution I can offer is implementing a logic yourself.
Examples:

  • timeframe in which all photos are gathered
  • "done" callback button
  • ...etc

@Badiboy
Copy link
Collaborator

Badiboy commented Sep 18, 2024

@coder2020official Frankly speaking, receiving gallery is a real pain. I suppose when (if) we have time it may be useful to make some joint handler for media gallery, that will allow to receive gallery itself. I did not make long thinking on it, but it may be useful.

@coder2020official
Copy link
Collaborator

Yes, I will take a look at this at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants