Skip to content

Commit

Permalink
added returning result as array
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirmuxsin committed Nov 26, 2023
1 parent 48faf77 commit 62e06f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Laragram.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ public static function __callStatic(string $name, array $arguments)
/**
* @throws GuzzleException
*/
public static function request (string $method, array $array): string
public static function request (string $method, array $array): array
{
$token = self::$token ?? config('laragram.token');
$client = new Client([
'verify' => false,
'http_errors' => false
]);

return $client->get("https://api.telegram.org/bot" . $token . "/" . $method, [
return json_decode($client->get("https://api.telegram.org/bot" . $token . "/" . $method, [
"query" => $array,
'http_errors' => false
])->getBody()->getContents();
])->getBody()->getContents(), true);
}

public static function setUrl ($url) {
Expand Down
2 changes: 1 addition & 1 deletion src/Methods/Methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
abstract class Methods
{
abstract static function request (string $method, array $array): string;
abstract static function request (string $method, array $array): array;

/**
* @var int|null $offset <p>Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as <a href="https://core.telegram.org/bots/api/#getupdates">getUpdates</a> is called with an *offset* higher than its *update\_id*. The negative offset can be specified to retrieve updates starting from *-offset* update from the end of the updates queue. All previous updates will be forgotten.</p>
Expand Down
2 changes: 1 addition & 1 deletion src/app/Console/Commands/laragram.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private function putMethod ($methods, $bar) {
*/
abstract class Methods
{
abstract static function request (string \$method, array \$array): string;
abstract static function request (string \$method, array \$array): array;
$arguments
}
Expand Down

0 comments on commit 62e06f5

Please sign in to comment.