-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetMyCommandsMethod.php
43 lines (37 loc) · 1.15 KB
/
GetMyCommandsMethod.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Kolirt\Telegram\Core\Methods\Commands;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Http\Client\PendingRequest;
/**
* @see https://core.telegram.org/bots/api#getmycommands
*/
trait GetMyCommandsMethod
{
/**
* Use this method to get the current list of the bot's commands for the
* given scope and user language. Returns an Array of BotCommand objects.
* If commands aren't set, an empty list is returned.
*
* @param string|null $language_code
*
* @return GetMyCommandsResponse
*
* @throws ConnectionException
* @throws GuzzleException
*/
public function getMyCommands(
// BotCommandScopeType|null $scope = null,
string|null $language_code = null,
): GetMyCommandsResponse
{
/**
* @var PendingRequest $this ->client
*/
$response = $this->client->get('getMyCommands', request_params([
// 'scope' => $scope,
'language_code' => $language_code,
]))->getBody();
return new GetMyCommandsResponse(json_decode($response, true));
}
}