public function sendAsync(): Promise
	{
		$mappedParams = $this->map();

		$curler = new \GuzzleHttp\Client(['base_uri' => $this->tgUrl]);

		if (empty($this->multipart)) {
			$promise = $curler->requestAsync("POST", static::$method, [
				"query" => $mappedParams
			]);
		} else {
			$promise = $curler->requestAsync("POST", static::$method, [
				"query" => $mappedParams,
				"multipart" => $this->multipart
			]);
		}

		$processedPromise = $promise->then(function ($response) {
			$jsonResponse = json_decode((string)$response->getBody(), true);
			$result = $jsonResponse['result'];
			return static::decodeResult($result);
		});

		$this->bot->addPromise($processedPromise);
		return $processedPromise;
	}
public function sendAsync(): Promise
	{
		$mappedParams = $this->map();

		$curler = new \GuzzleHttp\Client(['base_uri' => $this->tgUrl]);

		if (empty($this->multipart)) {
			$promise = $curler->requestAsync("POST", static::$method, [
				"query" => $mappedParams
			]);
		} else {
			$promise = $curler->requestAsync("POST", static::$method, [
				"query" => $mappedParams,
				"multipart" => $this->multipart
			]);
		}

		$processedPromise = $promise->then(function ($response) {
			$jsonResponse = json_decode((string)$response->getBody(), true);
			$result = $jsonResponse['result'];
			return static::decodeResult($result);
		});

		$this->bot->addPromise($processedPromise);
		return $processedPromise;
	}
public function sendAsync ( ) : Promise { $ mappedParams = $ this -> map ( ) ; $ curler = new \ GuzzleHttp \ Client ( [ 'base_uri' => $ this -> tgUrl ] ) ; if ( empty ( $ this -> multipart ) ) { $ promise = $ curler -> requestAsync ( "POST" , static :: $ method , [ "query" => $ mappedParams ] ) ; } else { $ promise = $ curler -> requestAsync ( "POST" , static :: $ method , [ "query" => $ mappedParams , "multipart" => $ this -> multipart ] ) ; } $ processedPromise = $ promise -> then ( function ( $ response ) { $ jsonResponse = json_decode ( ( string ) $ response -> getBody ( ) , true ) ; $ result = $ jsonResponse [ 'result' ] ; return static :: decodeResult ( $ result ) ; } ) ; $ this -> bot -> addPromise ( $ processedPromise ) ; return $ processedPromise ; }
Map the set parameters and send it to Telegram asynchronously.
Map the set parameters and send it to Telegram asynchronously .