示例#1
0
 public function sendGIFThroughTelegram($file_path)
 {
     $back = \GroupBot\Telegram::sendDocument($this->chat_id, $file_path);
     $back = json_decode($back, true);
     $file_id = $back['result']['document']['file_id'];
     $photoSQL = new Photo($this->db);
     $photoSQL->addServerPhotoId($file_id, '', $file_path);
 }
示例#2
0
 public static function SendDocumentByPath(\PDO $db, $local_path, $chat_id)
 {
     $md5 = md5_file($local_path, true);
     if (isset($local_path)) {
         $photoSQL = new Photo($db);
         $file_id = $photoSQL->getServerPhotoId($md5, $local_path);
         if ($file_id !== false) {
             Telegram::fileIdPhotoSender($chat_id, $file_id);
         } else {
             $back = Telegram::sendDocument($chat_id, $local_path);
             $back = json_decode($back, true);
             $file_id = end($back['result']['photo'])['file_id'];
             $photoSQL->addServerPhotoId($file_id, $md5, $local_path);
         }
     }
 }