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

How to download images attached to a message? #31

Open
qwertyexp opened this issue Aug 9, 2023 · 2 comments
Open

How to download images attached to a message? #31

qwertyexp opened this issue Aug 9, 2023 · 2 comments

Comments

@qwertyexp
Copy link

qwertyexp commented Aug 9, 2023

I tried reading Context.message.base64_attachments, but it only contains metadata, not the image itself.

{'envelope': {'source': '+xxxxx', 'sourceNumber': '+xxxx', 'sourceUuid': '245c2a4e-706c-4ed0-b5db-a4212adf02b0', 'sourceName': 'tommaso', 'sourceDevice': 3, 'timestamp': 1691597569365, 'syncMessage': {'sentMessage': {'destination': None, 'destinationNumber': None, 'destinationUuid': None, 'timestamp': 1691597569365, 'message': 'stampa giovanni-ciao', 'expiresInSeconds': 0, 'viewOnce': False, 'attachments': [{'contentType': 'image/png', 'filename': 'Schermata da 2023-07-27 15-21-23.png', 'id': 'xxxx', 'size': 67513}], 'groupInfo': {'groupId': xxxx', 'type': 'DELIVER'}}}}, 'account': '+xxxx', 'subscription': 0}

@jbaiter
Copy link

jbaiter commented Sep 16, 2024

Has this been implemented? I still see a TODO in the source code for the base64_attachments field on the message type, and it doesn't seem to be set from anywhere.

@filipre filipre reopened this Sep 16, 2024
@Era-Dorta
Copy link
Collaborator

Hi, I've implemented this in this PR #70 You can do ctx.message.attachments_filenames to get the file names.

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

4 participants