Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try{
- do {
- $messages_Messages = $MadelineProto->messages->getHistory(['peer' => $channel, 'offset_id' => $offset_id, 'offset_date' => 0, 'add_offset' => 0, 'limit' => $limit, 'max_id' => 0, 'min_id' => $min_id, 'hash' => 0 ]);
- if (count($messages_Messages['messages']) == 0) break;
- foreach ($messages_Messages['messages'] as $message) {
- //print_r($message);
- // echo "id: " . $message['id'] . "\n";//. " message: " . @$message['message'] . "\n";
- //https://core.telegram.org/type/MessageMedia
- /* if(!empty($message['media']) && ($message['media']['_']=='messageMediaPhoto'||$message['media']['_']=='messageMediaDocument')){
- try{
- $info =$MadelineProto->getDownloadInfo($message['media']);
- // $info['ext'] - The file extension // $info['name'] - The file name, without the extension
- // $info['mime'] - The file mime type // $info['size'] - The file size echo $info['name'];
- $tmpfile = tempnam("/tmp", "tl");
- if($info['size']>0){
- $MadelineProto->downloadToFile($message['media'], $tmpfile);
- $file_url=uploadS3($sender,$info['name'].$info['ext'],$tmpfile);
- unlink($tmpfile);
- }
- }catch(Exception $e){
- //$info =$MadelineProto->getDownloadInfo($message['media']);
- // [_] => messageMediaWebPage
- }
- } */
- if(isset($message['message'])){
- echo "id: " . $message['id'];//.':'.$file_url['url'] . "\n";
- echo "\n";
- $q->push([
- 'id'=>$message['id'],
- //'media_url'=>@$file_url['url'],
- 'msg'=>@$message['message'],
- ]);
- }
- }
- $offset_id = end($messages_Messages['messages'])['id'];
- } while (true);
- }catch(Exception $e){}
Add Comment
Please, Sign In to add comment