How handle media(photo, pdf) messages from chat ? #441
Answered
by
fabio-ivona
Nurbolaaaat
asked this question in
Q&A
-
Hi !
|
Beta Was this translation helpful? Give feedback.
Answered by
fabio-ivona
Dec 5, 2023
Replies: 2 comments 5 replies
-
**Also, one moment ! I can not send jpeg file from project to chat (telgraph_chat_id = 102). File is exists. Symlink is configured. In logs from webhook everything is ok. Please, help !)** |
Beta Was this translation helpful? Give feedback.
4 replies
-
as for this one: starting from a Message DTO from a webhook $this->message or Telegraph::botUpdates() method: $message = Telegraph::botUpdates()->send()->json('result.0.message');
$message = Message::fromArray($message); you can extract photos (or documents as well) $photo = collect($message->photos())->last(); and then, store it: Telegraph::store($photo, Storage::path('incoming/photos'), 'new-photo.jpg');
for this one, your code is correct ( |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Nurbolaaaat
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
as for this one: starting from a Message DTO
from a webhook
or Telegraph::botUpdates() method:
you can extract photos (or documents as well)
and then, store it:
for this one, your code is correct (
->photo(...)->send()
)