$GLOBALS['chat_id'], 'message_id'=>$msg_id, 'caption'=>"This is Me:)", ]; sendReply($photourl, $photo_post_params); sleep(4); $new_media = [ 'type'=>'photo', 'media'=>'اینحا باید یه عکس دیگه بندازی', 'caption'=>'mimi', ], $new_media_url = $GLOBALS['bot_url'].'/editMessageMedia'; $newMediaParams = [ 'chat_id'=>$GLOBALS['chat_id'], 'message_id'=>$msg_id, 'media'=>json_encode($new_media), ]; sendReply($new_media_url, $new_post_params); /* //edit and delete messages $result = send_message("First message"); $result_array = json_decode($result, true); if (isset($result_array["result"]["message_id"])) { $msg_id = $result_array["result"]["message_id"]; } sleep(1); $new_text = "UPDATED.\nThis is first message."; $new_url = $bot_url.'/editMessageText'; $new_post_params = [ 'chat_id'=>$GLOBALS['chat_id'], 'text'=>$new_text, 'message_id'=>$msg_id, ]; sendReply($new_url, $new_post_params); sleep(1); $urlDelete = $GLOBALS['bot_url'].'/deleteMessage'; $delete_post_params = [ 'chat_id' => $GLOBALS['chat_id'], 'message_id'=>$msg_id, ]; sendReply($urlDelete, $delete_post_params); */ function sendReply($url, $post_params){ $cu = curl_init(); curl_setopt($cu, CURLOPT_URL, $url); curl_setopt($cu, CURLOPT_POSTFIELDS, $post_params); curl_setopt($cu, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($cu); curl_close($cu); return$result; } function send_message($msg = 'Nam Nam'){ $reply = $msg; $url = $GLOBALS['bot_url']."/sendMessage"; $post_params = [ 'chat_id'=>$GLOBALS['chat_id'], 'text'=>$reply, ]; $resulter = sendReply($url, $post_params); return $resulter; } function send_photo(){ $url = $GLOBALS['bot_url']."/sendPhoto"; $post_params = [ 'chat_id'=>$GLOBALS['chat_id'], 'photo'=>new CURLFILE(realpath('2024-07-18 (2).png')), 'caption'=>'huhk', ]; $photo_result = sendReply($url, $post_params); return $photo_result; } ?>