@@ -789,13 +789,26 @@ public function downloadFile(string $telegram_file_path, string $local_file_path
789789 *
790790 * @return array the JSON Telegram's reply.
791791 */
792- public function setWebhook (string $ url , string $ certificate = '' ): array
792+ public function setWebhook (
793+ string $ url ,
794+ string $ certificate = '' ,
795+ string $ ip_address = '' ,
796+ int $ max_connections = 0 ,
797+ array $ allowed_updates = [],
798+ bool $ drop_pending_updates = false
799+ ): array
793800 {
794- if ($ certificate == '' ) {
795- $ requestBody = ['url ' => $ url ];
796- } else {
797- $ requestBody = ['url ' => $ url , 'certificate ' => "@ $ certificate " ];
798- }
801+ $ requestBody = ['url ' => $ url ];
802+ if ($ certificate != '' )
803+ $ requestBody ['certificate ' ] = "@ $ certificate " ;
804+ if ($ ip_address != '' )
805+ $ requestBody ['ip_address ' ] = $ ip_address ;
806+ if ($ max_connections != 0 )
807+ $ requestBody ['max_connections ' ] = $ max_connections ;
808+ if (count ($ allowed_updates ) > 0 )
809+ $ requestBody ['allowed_updates ' ] = json_encode ($ allowed_updates );
810+ if ($ drop_pending_updates )
811+ $ requestBody ['drop_pending_updates ' ] = $ drop_pending_updates ;
799812
800813 return $ this ->endpoint ('setWebhook ' , $ requestBody , true );
801814 }
0 commit comments