├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── _ide_helpers.php
├── composer.json
├── config
└── telebot.php
├── pint.json
├── routes
└── telebot.php
├── src
├── Artisan
│ ├── CommandsCommand.php
│ ├── InstallCommand.php
│ ├── LongPollCommad.php
│ ├── MakeCallbackHandlerCommand.php
│ ├── MakeCommandHandlerCommand.php
│ ├── MakeKernelCommand.php
│ ├── MakeRequestInputHandlerCommand.php
│ ├── TeleBotCommand.php
│ └── WebhookCommand.php
├── Controllers
│ └── WebhookController.php
├── Log
│ ├── Handler.php
│ └── TelegramLogger.php
├── Middleware
│ └── AuthorizeWebAppRequest.php
├── Notifications
│ ├── TelegramChannel.php
│ └── TelegramNotification.php
├── Providers
│ └── TeleBotServiceProvider.php
├── Requests
│ └── UpdateRequest.php
├── Services
│ └── TelegramWebAppService.php
└── TeleBot.php
├── stubs
├── callback-handler.stub
├── command-handler.stub
├── kernel.stub
├── request-input-handler.stub
└── update-handler.stub
└── views
├── log.blade.php
└── webapp.blade.php
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to `telebot` will be documented in this file
4 |
5 | ## 3.0.0 - 2023-08-15
6 | - Laravel support moved to separate package
7 |
8 | ## 3.1.0 - 2023-09-07
9 | - Updated [Bot API](https://core.telegram.org/bots/api) to version 6.8
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Contributions are **welcome** and will be fully **credited**.
4 |
5 | Please read and understand the contribution guide before creating an issue or pull request.
6 |
7 | ## Etiquette
8 |
9 | This project is open source, and as such, the maintainers give their free time to build and maintain the source code
10 | held within. They make the code freely available in the hope that it will be of use to other developers. It would be
11 | extremely unfair for them to suffer abuse or anger for their hard work.
12 |
13 | Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
14 | world that developers are civilized and selfless people.
15 |
16 | It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
17 | quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
18 |
19 | ## Viability
20 |
21 | When requesting or submitting new features, first consider whether it might be useful to others. Open
22 | source projects are used by many developers, who may have entirely different needs to your own. Think about
23 | whether or not your feature is likely to be used by other users of the project.
24 |
25 | ## Procedure
26 |
27 | Before filing an issue:
28 |
29 | - Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
30 | - Check to make sure your feature suggestion isn't already present within the project.
31 | - Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
32 | - Check the pull requests tab to ensure that the feature isn't already in progress.
33 |
34 | Before submitting a pull request:
35 |
36 | - Check the codebase to ensure that your feature doesn't already exist.
37 | - Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
38 |
39 | ## Requirements
40 |
41 | If the project maintainer has any additional requirements, you will find them listed here.
42 |
43 | - **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
44 |
45 | - **Add tests!** - Your patch won't be accepted if it doesn't have tests.
46 |
47 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
48 |
49 | - **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
50 |
51 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
52 |
53 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
54 |
55 | **Happy coding**!
56 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2020 WeStacks
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://vshymanskyy.github.io/StandWithUkraine/)
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | TeleBot is a PHP library for telegram bots development. This project is a Laravel adapter for [TeleBot](https://github.com/westacks/telebot)
15 |
16 | ## Installation
17 |
18 | Install the package with composer:
19 |
20 | ```bash
21 | composer require westacks/telebot-laravel
22 | ```
23 |
24 | Complete setup with the following command:
25 |
26 | ```bash
27 | php artisan telebot:install
28 | ```
29 |
30 | ## Farther steps
31 |
32 | Documentation for the library can be found on the [website](https://westacks.github.io/telebot/).
33 |
34 | ## Features
35 |
36 | ### Laravel Support
37 |
38 | Library provides a Facade, artisan commands and notification channel to simplify the development process of your bot, if you are using Laravel:
39 |
40 | ##### Facade
41 | ```php
42 | TeleBot::getMe();
43 | TeleBot::bot('bot2')->getMe();
44 | ```
45 |
46 | ##### Creating update handlers
47 |
48 | You can create different types of update handlers or bot kernel with the following command:
49 | ```bash
50 | $ php artisan make:telebot:kernel
51 | $ php artisan make:telebot:update-handler
52 | $ php artisan make:telebot:command-handler
53 | $ php artisan make:telebot:callback-handler
54 | $ php artisan make:telebot:input-handler
55 | ```
56 |
57 | ##### Automatic webhook generation
58 |
59 | After you insert your bot token, to create a webhook you need only to fire the following command:
60 | ```bash
61 | $ php artisan telebot:webhook --setup
62 | ```
63 | Route for handling updates is generated automatically for your `APP_URL`
64 |
65 |
66 | ##### Long polling
67 |
68 | If you are not using webhook, or want to use bot in local or test environment, you may start long polling by only firyng this command:
69 | ```bash
70 | $ php artisan telebot:polling
71 | ```
72 |
73 | ##### Setup commands autocompletion
74 |
75 | The following command will automatically setup autocompletion for all registered bot commands on Telegram servers:
76 | ```bash
77 | $ php artisan telebot:commands --setup
78 | ```
79 |
80 | ##### Notification channel
81 |
82 | ```php
83 | bot('bot')
100 | ->sendMessage([
101 | 'chat_id' => $notifiable->telegram_chat_id,
102 | 'text' => 'Hello, from Laravel\'s notifications!'
103 | ])
104 | ->sendMessage([
105 | 'chat_id' => $notifiable->telegram_chat_id,
106 | 'text' => 'Second message'
107 | ]);
108 | }
109 | }
110 | ```
111 |
112 | ##### Log driver
113 |
114 | You may log your application errors by sending them to some Telegram chat. Simply add new log driver to a `config/logging.php`:
115 |
116 | ```php
117 | 'telegram' => [
118 | 'driver' => 'custom',
119 | 'via' => \WeStacks\TeleBot\Laravel\Log\TelegramLogger::class,
120 | 'level' => 'debug',
121 | 'bot' => 'bot',
122 | 'chat_id' => env('TELEGRAM_LOG_CHAT_ID') // Any chat where bot can write messages.
123 | ]
124 | ```
125 |
126 | ## Changelog
127 |
128 | Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
129 |
130 | ## Contributing
131 |
132 | Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
133 |
134 | ## Credits
135 |
136 | - [Dmytro Morozov](https://github.com/PunyFlash)
137 | - [All Contributors](https://github.com/westacks/telebot-laravel/graphs/contributors)
138 |
139 | ## License
140 |
141 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
142 |
--------------------------------------------------------------------------------
/_ide_helpers.php:
--------------------------------------------------------------------------------
1 | 'bot',
14 |
15 | /*-------------------------------------------------------------------------
16 | | Middleware to be applied to the webhook route
17 | |--------------------------------------------------------------------------
18 | |
19 | |
20 | */
21 |
22 | 'middleware' => [],
23 |
24 | /*-------------------------------------------------------------------------
25 | | Your Telegram Bots
26 | |--------------------------------------------------------------------------
27 | | You may use multiple bots. Each bot that you own should be configured here.
28 | |
29 | | See the docs for parameters specification:
30 | | https://westacks.github.io/telebot/#/configuration
31 | |
32 | */
33 |
34 | 'bots' => [
35 | 'bot' => [
36 | 'token' => env('TELEGRAM_BOT_TOKEN'),
37 | 'name' => env('TELEGRAM_BOT_NAME', null),
38 | 'api_url' => env('TELEGRAM_API_URL', 'https://api.telegram.org'),
39 | 'storage' => \WeStacks\TeleBot\Foundation\FileStorage::class,
40 | 'http' => [
41 | 'http_errors' => false,
42 | ],
43 |
44 | 'webhook' => [
45 | // 'url' => env('TELEGRAM_BOT_WEBHOOK_URL', env('APP_URL').'/telebot/webhook/bot/'.env('TELEGRAM_BOT_TOKEN')),
46 | // 'certificate' => env('TELEGRAM_BOT_CERT_PATH', storage_path('app/ssl/public.pem')),
47 | // 'ip_address' => '8.8.8.8',
48 | // 'max_connections' => 40,
49 | // 'allowed_updates' => ["message", "edited_channel_post", "callback_query"],
50 | // 'secret_token' => env('TELEGRAM_KEY', null),
51 | ],
52 |
53 | 'poll' => [
54 | // 'limit' => 100,
55 | // 'timeout' => 0,
56 | // 'allowed_updates' => ["message", "edited_channel_post", "callback_query"]
57 | ],
58 |
59 | 'kernel' => \WeStacks\TeleBot\Kernel::class,
60 | ],
61 |
62 | // 'second_bot' => [
63 | // 'token' => env('TELEGRAM_BOT2_TOKEN', '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11'),
64 | // ],
65 | ],
66 |
67 | /*-------------------------------------------------------------------------
68 | | Base Namespace for bot classes
69 | |--------------------------------------------------------------------------
70 | | You may change the default namespace for your bot classes.
71 | | Follows this template: `\`
72 | */
73 |
74 | 'namespace' => "Telegram",
75 | ];
76 |
--------------------------------------------------------------------------------
/pint.json:
--------------------------------------------------------------------------------
1 | {
2 | "preset": "psr12"
3 | }
--------------------------------------------------------------------------------
/routes/telebot.php:
--------------------------------------------------------------------------------
1 | middleware(config('telebot.middleware', []))
17 | ->name('telebot.webhook');
18 |
--------------------------------------------------------------------------------
/src/Artisan/CommandsCommand.php:
--------------------------------------------------------------------------------
1 | validOptions())) {
23 | $this->error($error);
24 |
25 | return 1;
26 | }
27 |
28 | $bots = $this->botsList();
29 |
30 | if ($this->option('setup')) {
31 | $this->setupCommands($bots);
32 | }
33 |
34 | if ($this->option('remove')) {
35 | $this->removeCommands($bots);
36 | }
37 |
38 | if ($this->option('info')) {
39 | $this->getCommands($bots);
40 | }
41 |
42 | return 0;
43 | }
44 |
45 | private function setupCommands($bots)
46 | {
47 | foreach ($bots as $bot) {
48 | try {
49 | $this->bot->bot($bot)->setLocalCommands();
50 | $this->info("Success! Bot commands has been set for '{$bot}' bot!");
51 | } catch (\Exception $e) {
52 | $this->error("Error while setting up bot commands for '{$bot}' bot: {$e->getMessage()}");
53 | }
54 | }
55 | }
56 |
57 | private function removeCommands($bots)
58 | {
59 | foreach ($bots as $bot) {
60 | try {
61 | $this->bot->bot($bot)->deleteLocalCommands();
62 | $this->info("Success! Bot commands has been removed for '{$bot}' bot!");
63 | } catch (\Exception $e) {
64 | $this->error("Error while removing bot commands for '{$bot}' bot: {$e->getMessage()}");
65 | }
66 | }
67 | }
68 |
69 | private function getCommands($bots)
70 | {
71 | $this->alert('Bot Commands');
72 |
73 | $promises = [];
74 | foreach ($bots as $bot) {
75 | $promises[] = $this->bot->bot($bot)
76 | ->getMyCommands(_promise: true)
77 | ->then(function (array $commands) use ($bot) {
78 | $this->makeTable($commands, $bot);
79 |
80 | return $commands;
81 | });
82 | }
83 | Utils::all($promises)->wait();
84 | }
85 |
86 | private function makeTable(array $commands, string $bot)
87 | {
88 | $rows = collect($commands)->map(function (BotCommand $command) {
89 | $key = '/'.$command->command;
90 | $value = $command->description;
91 |
92 | return compact('key', 'value');
93 | })->toArray();
94 |
95 | $this->table([
96 | [new TableCell('Bot: '.$bot, ['colspan' => 2])],
97 | ['Command', 'Description'],
98 | ], $rows);
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/Artisan/InstallCommand.php:
--------------------------------------------------------------------------------
1 | call('vendor:publish', [
17 | '--provider' => TeleBotServiceProvider::class,
18 | '--tag' => 'config',
19 | ]);
20 |
21 | $this->addEnvVariables();
22 |
23 | if ($this->confirm('Would you like to setup bot kernel and basic start command?', true)) {
24 | $this->call(MakeKernelCommand::class);
25 | $this->call(MakeCommandHandlerCommand::class, ['name' => '/start']);
26 | }
27 | }
28 |
29 | protected function addEnvVariables(): void
30 | {
31 | if (File::missing($env = app()->environmentFile())) {
32 | return;
33 | }
34 |
35 | File::append(
36 | $env,
37 | <<<'EOT'
38 |
39 | TELEGRAM_BOT_TOKEN=
40 | TELEGRAM_BOT_NAME=
41 | EOT
42 | );
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Artisan/LongPollCommad.php:
--------------------------------------------------------------------------------
1 | botsList())->map(static fn ($key) => [$key => 0])->collapse()->toArray();
22 |
23 | $this->info('Polling telegram updates...');
24 |
25 | while ($this->poll) {
26 | foreach (array_keys($bots) as $bot) {
27 | $this->handleUpdates($bot, $bots[$bot]);
28 | }
29 | if ($this->option('once')) {
30 | $this->poll = false;
31 | }
32 | }
33 |
34 | return 0;
35 | }
36 |
37 | private function handleUpdates(string $bot, int &$offset)
38 | {
39 | $updates = $this->bot->bot($bot)
40 | ->getUpdates(array_merge(config("telebot.bots.{$bot}.poll", []), [
41 | 'offset' => $offset + 1,
42 | ]));
43 |
44 | foreach ($updates as $update) {
45 | $this->logUpdate($bot, $update);
46 | $this->bot->bot($bot)->handle($update);
47 | $offset = $update->update_id;
48 | }
49 | }
50 |
51 | private function logUpdate(string $bot, Update $update)
52 | {
53 | $output = $this->getOutput();
54 |
55 | if ($output->isQuiet()) {
56 | return;
57 | } elseif ($output->isVerbose() || $output->isVeryVerbose() || $output->isDebug()) {
58 | $this->info("Bot: '{$bot}'; Update: {$update}");
59 | } else {
60 | $this->info("Bot: '{$bot}'; Update: {$update->update_id}; Type: '".$update->type()."'");
61 | }
62 | }
63 |
64 | public function getSubscribedSignals(): array
65 | {
66 | $signals = [];
67 |
68 | if (defined('SIGINT')) {
69 | $signals[] = SIGINT;
70 | }
71 | if (defined('SIGTERM')) {
72 | $signals[] = SIGTERM;
73 | }
74 | if (defined('SIGQUIT')) {
75 | $signals[] = SIGQUIT;
76 | }
77 |
78 | return $signals;
79 | }
80 |
81 | public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false
82 | {
83 | $this->warn('Shutting down Telegram polling...');
84 | $this->poll = false;
85 |
86 | return $previousExitCode;
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/Artisan/MakeCallbackHandlerCommand.php:
--------------------------------------------------------------------------------
1 | type) . 'or command alias'],
18 | ];
19 | }
20 |
21 | public function handle()
22 | {
23 | if (false === $result = parent::handle()) {
24 | return $result;
25 | }
26 |
27 | $this->components->warn("Don't forget to register the callback handler in your bot kernel!");
28 |
29 | return $result;
30 | }
31 |
32 | protected function getStub(): string
33 | {
34 | return __DIR__.'/../../stubs/callback-handler.stub';
35 | }
36 |
37 | protected function getDefaultNamespace($rootNamespace)
38 | {
39 | return $rootNamespace.'\\'. config('telebot.namespace', 'Telegram') .'\\Handlers';
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Artisan/MakeCommandHandlerCommand.php:
--------------------------------------------------------------------------------
1 | type) . 'or command alias'],
19 | ];
20 | }
21 |
22 | protected function promptForMissingArgumentsUsing()
23 | {
24 | return [
25 | 'name' => [
26 | 'What will be the '.strtolower($this->type).' name or command alias?',
27 | 'E.g. /start or StartCommandHandler',
28 | ],
29 | ];
30 | }
31 |
32 | public function handle()
33 | {
34 | if (false === $result = parent::handle()) {
35 | return $result;
36 | }
37 |
38 | $this->components->warn("Don't forget to register the command handler in your bot kernel!");
39 |
40 | return $result;
41 | }
42 |
43 | protected function getNameInput()
44 | {
45 | $name = trim($this->argument('name'));
46 |
47 | if (Str::startsWith($name, '/')) {
48 | return str($name)->after('/')->camel()->ucfirst() . 'CommandHandler';
49 | }
50 |
51 | return parent::getNameInput();
52 | }
53 |
54 | protected function getAlias(): string
55 | {
56 | $name = explode('\\', trim($this->argument('name')));
57 | $name = end($name);
58 |
59 | if (Str::startsWith($name, '/')) {
60 | return $name;
61 | }
62 |
63 | return '/'. str($name)->lcfirst()->before('CommandHandler');
64 | }
65 |
66 | protected function getStub(): string
67 | {
68 | return __DIR__.'/../../stubs/command-handler.stub';
69 | }
70 |
71 | protected function getDefaultNamespace($rootNamespace)
72 | {
73 | return $rootNamespace.'\\'. config('telebot.namespace', 'Telegram') .'\\Handlers';
74 | }
75 |
76 | protected function buildClass($name)
77 | {
78 | $replace = [
79 | '{{ alias }}' => "'{$this->getAlias()}'",
80 | ];
81 |
82 | return str_replace(
83 | array_keys($replace),
84 | array_values($replace),
85 | parent::buildClass($name)
86 | );
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/src/Artisan/MakeKernelCommand.php:
--------------------------------------------------------------------------------
1 | components->warn("Don't forget to set bot kernel in `config/telebot.php` for your bot!");
21 |
22 | return $result;
23 | }
24 |
25 | protected function getArguments()
26 | {
27 | return [
28 | ['name', InputArgument::OPTIONAL, 'The name of the '.strtolower($this->type)],
29 | ];
30 | }
31 |
32 | protected function getNameInput()
33 | {
34 | if ($this->argument('name')) {
35 | return parent::getNameInput();
36 | }
37 |
38 | return 'Kernel';
39 | }
40 |
41 | protected function getStub(): string
42 | {
43 | return __DIR__.'/../../stubs/kernel.stub';
44 | }
45 |
46 | protected function getDefaultNamespace($rootNamespace)
47 | {
48 | return $rootNamespace.'\\'. config('telebot.namespace', 'Telegram');
49 | }
50 |
51 | protected function buildClass($name)
52 | {
53 | $replace = [];
54 |
55 | if (str_ends_with($name, '\\Kernel')) {
56 | $replace = [
57 | 'use WeStacks\TeleBot\Kernel;' => 'use WeStacks\TeleBot\Kernel as TeleBotKernel;',
58 | 'extends Kernel' => 'extends TeleBotKernel',
59 | ];
60 | }
61 |
62 | return str_replace(
63 | array_keys($replace),
64 | array_values($replace),
65 | parent::buildClass($name)
66 | );
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/Artisan/MakeRequestInputHandlerCommand.php:
--------------------------------------------------------------------------------
1 | type) . 'or command alias'],
18 | ];
19 | }
20 |
21 | public function handle()
22 | {
23 | if (false === $result = parent::handle()) {
24 | return $result;
25 | }
26 |
27 | $this->components->warn("Don't forget to register the input handler in your bot kernel!");
28 |
29 | return $result;
30 | }
31 |
32 | protected function getStub(): string
33 | {
34 | return __DIR__.'/../../stubs/request-input-handler.stub';
35 | }
36 |
37 | protected function getDefaultNamespace($rootNamespace)
38 | {
39 | return $rootNamespace.'\\'. config('telebot.namespace', 'Telegram') .'\\Handlers';
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Artisan/TeleBotCommand.php:
--------------------------------------------------------------------------------
1 | bot = $bot;
16 | }
17 |
18 | /**
19 | * Check if passed options are valid.
20 | *
21 | * @return string|true - true if valid, error text if not
22 | */
23 | protected function validOptions()
24 | {
25 | if (! $this->option('setup') && ! $this->option('remove') && ! $this->option('info')) {
26 | return 'No task specified!';
27 | }
28 |
29 | if ($this->option('setup') && $this->option('remove')) {
30 | return 'You should not use --setup and --remove options in one command!';
31 | }
32 |
33 | return true;
34 | }
35 |
36 | /**
37 | * Get the list of bots for handling.
38 | *
39 | * @return array
40 | */
41 | protected function botsList()
42 | {
43 | return $this->hasOption('all') ? $this->bot->bots() : [$this->argument('bot') ?? config('telebot.default')];
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Artisan/WebhookCommand.php:
--------------------------------------------------------------------------------
1 | validOptions())) {
24 | $this->error($error);
25 |
26 | return 1;
27 | }
28 |
29 | $bots = $this->botsList();
30 |
31 | if ($this->option('setup')) {
32 | $this->setupWebhook($bots);
33 | }
34 |
35 | if ($this->option('remove')) {
36 | $this->removeWebhook($bots);
37 | }
38 |
39 | if ($this->option('info')) {
40 | $this->getInfo($bots);
41 | }
42 |
43 | return 0;
44 | }
45 |
46 | private function setupWebhook(array $bots)
47 | {
48 | $promises = [];
49 | foreach ($bots as $bot) {
50 | $config = config("telebot.bots.{$bot}");
51 | $webhook = $config['webhook'] ?? [];
52 | $token = $config['token'] ?? $config ?? null;
53 |
54 | if (! isset($webhook['url'])) {
55 | $webhook['url'] = route('telebot.webhook', [
56 | 'bot' => $bot,
57 | 'token' => $token,
58 | ]);
59 | }
60 |
61 | $webhook['_promise'] = true;
62 |
63 | $promises[] = $this->bot->bot($bot)
64 | ->setWebhook($webhook)
65 | ->then(function (bool $result) use ($bot) {
66 | if ($result) {
67 | $this->info("Success! Webhook has been set for '{$bot}' bot!");
68 | }
69 |
70 | return $result;
71 | });
72 | }
73 | Utils::all($promises)->wait();
74 | }
75 |
76 | private function removeWebhook(array $bots)
77 | {
78 | $promises = [];
79 | foreach ($bots as $bot) {
80 | $promises[] = $this->bot->bot($bot)
81 | ->deleteWebhook(_promise: true)
82 | ->then(function (bool $result) use ($bot) {
83 | if ($result) {
84 | $this->info("Success! Webhook has been removed for '{$bot}' bot!");
85 | }
86 |
87 | return $result;
88 | });
89 | }
90 | Utils::all($promises)->wait();
91 | }
92 |
93 | private function getInfo(array $bots)
94 | {
95 | $this->alert('Webhook Info');
96 |
97 | $promises = [];
98 | foreach ($bots as $bot) {
99 | $promises[] = $this->bot->bot($bot)
100 | ->getWebhookInfo(_promise: true)
101 | ->then(function (WebhookInfo $info) use ($bot) {
102 | $this->makeTable($info, $bot);
103 |
104 | return $info;
105 | });
106 | }
107 | Utils::all($promises)->wait();
108 | }
109 |
110 | private function makeTable(WebhookInfo $info, string $bot)
111 | {
112 | $rows = collect($info->toArray())->map(function ($value, $key) {
113 | $key = Str::title(str_replace('_', ' ', $key));
114 | $value = is_bool($value) ? ($value ? 'Yes' : 'No') : $value;
115 |
116 | return compact('key', 'value');
117 | })->toArray();
118 |
119 | $this->table([
120 | [new TableCell('Bot: '.$bot, ['colspan' => 2])],
121 | ['Key', 'Info'],
122 | ], $rows);
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/src/Controllers/WebhookController.php:
--------------------------------------------------------------------------------
1 | route('bot'))->handle($request->update());
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Log/Handler.php:
--------------------------------------------------------------------------------
1 | bot = app('telebot')->bot($config['bot'] ?? null);
50 | $this->chat_id = $config['chat_id'];
51 |
52 | // define variables for text message
53 | $this->app = config('app.name');
54 | $this->env = config('app.env');
55 | }
56 |
57 | public function write(LogRecord|array $record): void
58 | {
59 | $textChunks = str_split($this->formatText($record), 4096);
60 |
61 | foreach ($textChunks as $textChunk) {
62 | $this->sendMessage($textChunk);
63 | }
64 | }
65 |
66 | /**
67 | * {@inheritDoc}
68 | */
69 | protected function getDefaultFormatter(): FormatterInterface
70 | {
71 | return new LineFormatter("%message% %context% %extra%\n");
72 | }
73 |
74 | private function formatText(LogRecord|array $record): string
75 | {
76 | if (is_a($record, LogRecord::class)) {
77 | $record = array_merge($record->toArray(), ['formatted' => $record->formatted]);
78 | }
79 |
80 | return view('telebot::log', array_merge($record, [
81 | 'app' => $this->app,
82 | 'env' => $this->env,
83 | ]))->render();
84 | }
85 |
86 | private function sendMessage(string $text): void
87 | {
88 | $this->bot->sendMessage([
89 | 'chat_id' => $this->chat_id,
90 | 'parse_mode' => 'html',
91 | 'text' => $text,
92 | '_rescue' => true,
93 | ]);
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/Log/TelegramLogger.php:
--------------------------------------------------------------------------------
1 | validCredentials($bot ?? config('telebot.default')),
20 | 403,
21 | trans('Invalid credentials')
22 | );
23 |
24 | return $next($request);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Notifications/TelegramChannel.php:
--------------------------------------------------------------------------------
1 | jsonSerialize();
32 | $bot = $this->botmanager->bot($data['bot'] ?? null);
33 |
34 | $this->dispatcher->dispatch(new NotificationSending($notifiable, $notification, static::class));
35 |
36 | $promises = [];
37 | $errors = [];
38 |
39 | foreach (($data['actions'] ?? []) as $action) {
40 | $action['arguments']['_promise'] = true;
41 |
42 | $promises[] = $bot
43 | ->{$action['method']}($action['arguments'])
44 | ->otherwise(function (Exception $exception) use (&$errors) {
45 | $errors[] = $exception;
46 | report($exception);
47 |
48 | return $exception;
49 | });
50 | }
51 |
52 | $results = Utils::unwrap($promises);
53 | $report = count($errors) ?
54 | new NotificationFailed($notifiable, $notification, static::class, $results) :
55 | new NotificationSent($notifiable, $notification, static::class, $results);
56 |
57 | $this->dispatcher->dispatch($report);
58 |
59 | return $results;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/Notifications/TelegramNotification.php:
--------------------------------------------------------------------------------
1 | ” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files »
177 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
178 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
179 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
180 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
181 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
182 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
183 | *
184 | *
185 | * @method static self sendDocument(...$parameters) Use this method to send general files. On success, the sent Message is returned. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
186 | *
187 | * {@see https://core.telegram.org/bots/api#senddocument}
188 | *
189 | * Parameters:
190 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
191 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
192 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
193 | * - _InputFile|string_ `$document` __Required: Yes__. File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »
194 | * - _InputFile|string_ `$thumbnail` __Required: Optional__. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files »
195 | * - _string_ `$caption` __Required: Optional__. Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing
196 | * - _string_ `$parse_mode` __Required: Optional__. Mode for parsing entities in the document caption. See formatting options for more details.
197 | * - _MessageEntity[]_ `$caption_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
198 | * - _bool_ `$disable_content_type_detection` __Required: Optional__. Disables automatic server-side content type detection for files uploaded using multipart/form-data
199 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
200 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
201 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
202 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
203 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
204 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
205 | *
206 | *
207 | * @method static self sendVideo(...$parameters) Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
208 | *
209 | * {@see https://core.telegram.org/bots/api#sendvideo}
210 | *
211 | * Parameters:
212 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
213 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
214 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
215 | * - _InputFile|string_ `$video` __Required: Yes__. Video to send. Pass a file_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files »
216 | * - _int_ `$duration` __Required: Optional__. Duration of sent video in seconds
217 | * - _int_ `$width` __Required: Optional__. Video width
218 | * - _int_ `$height` __Required: Optional__. Video height
219 | * - _InputFile|string_ `$thumbnail` __Required: Optional__. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files »
220 | * - _InputFile|string_ `$cover` __Required: Optional__. Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More information on Sending Files »
221 | * - _int_ `$start_timestamp` __Required: Optional__. Start timestamp for the video in the message
222 | * - _string_ `$caption` __Required: Optional__. Video caption (may also be used when resending videos by file_id), 0-1024 characters after entities parsing
223 | * - _string_ `$parse_mode` __Required: Optional__. Mode for parsing entities in the video caption. See formatting options for more details.
224 | * - _MessageEntity[]_ `$caption_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
225 | * - _bool_ `$show_caption_above_media` __Required: Optional__. Pass True, if the caption must be shown above the message media
226 | * - _bool_ `$has_spoiler` __Required: Optional__. Pass True if the video needs to be covered with a spoiler animation
227 | * - _bool_ `$supports_streaming` __Required: Optional__. Pass True if the uploaded video is suitable for streaming
228 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
229 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
230 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
231 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
232 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
233 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
234 | *
235 | *
236 | * @method static self sendAnimation(...$parameters) Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). On success, the sent Message is returned. Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
237 | *
238 | * {@see https://core.telegram.org/bots/api#sendanimation}
239 | *
240 | * Parameters:
241 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
242 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
243 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
244 | * - _InputFile|string_ `$animation` __Required: Yes__. Animation to send. Pass a file_id as String to send an animation that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an animation from the Internet, or upload a new animation using multipart/form-data. More information on Sending Files »
245 | * - _int_ `$duration` __Required: Optional__. Duration of sent animation in seconds
246 | * - _int_ `$width` __Required: Optional__. Animation width
247 | * - _int_ `$height` __Required: Optional__. Animation height
248 | * - _InputFile|string_ `$thumbnail` __Required: Optional__. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files »
249 | * - _string_ `$caption` __Required: Optional__. Animation caption (may also be used when resending animation by file_id), 0-1024 characters after entities parsing
250 | * - _string_ `$parse_mode` __Required: Optional__. Mode for parsing entities in the animation caption. See formatting options for more details.
251 | * - _MessageEntity[]_ `$caption_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
252 | * - _bool_ `$show_caption_above_media` __Required: Optional__. Pass True, if the caption must be shown above the message media
253 | * - _bool_ `$has_spoiler` __Required: Optional__. Pass True if the animation needs to be covered with a spoiler animation
254 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
255 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
256 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
257 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
258 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
259 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
260 | *
261 | *
262 | * @method static self sendVoice(...$parameters) Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
263 | *
264 | * {@see https://core.telegram.org/bots/api#sendvoice}
265 | *
266 | * Parameters:
267 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
268 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
269 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
270 | * - _InputFile|string_ `$voice` __Required: Yes__. Audio file to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files »
271 | * - _string_ `$caption` __Required: Optional__. Voice message caption, 0-1024 characters after entities parsing
272 | * - _string_ `$parse_mode` __Required: Optional__. Mode for parsing entities in the voice message caption. See formatting options for more details.
273 | * - _MessageEntity[]_ `$caption_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
274 | * - _int_ `$duration` __Required: Optional__. Duration of the voice message in seconds
275 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
276 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
277 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
278 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
279 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
280 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
281 | *
282 | *
283 | * @method static self sendVideoNote(...$parameters) As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long. Use this method to send video messages. On success, the sent Message is returned.
284 | *
285 | * {@see https://core.telegram.org/bots/api#sendvideonote}
286 | *
287 | * Parameters:
288 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
289 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
290 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
291 | * - _InputFile|string_ `$video_note` __Required: Yes__. Video note to send. Pass a file_id as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. More information on Sending Files ». Sending video notes by a URL is currently unsupported
292 | * - _int_ `$duration` __Required: Optional__. Duration of sent video in seconds
293 | * - _int_ `$length` __Required: Optional__. Video width and height, i.e. diameter of the video message
294 | * - _InputFile|string_ `$thumbnail` __Required: Optional__. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More information on Sending Files »
295 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
296 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
297 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
298 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
299 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
300 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
301 | *
302 | *
303 | * @method static self sendPaidMedia(...$parameters) Use this method to send paid media. On success, the sent Message is returned.
304 | *
305 | * {@see https://core.telegram.org/bots/api#sendpaidmedia}
306 | *
307 | * Parameters:
308 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
309 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername). If the chat is a channel, all Telegram Star proceeds from this media will be credited to the chat's balance. Otherwise, they will be credited to the bot's balance.
310 | * - _int_ `$star_count` __Required: Yes__. The number of Telegram Stars that must be paid to buy access to the media; 1-10000
311 | * - _InputPaidMedia[]_ `$media` __Required: Yes__. A JSON-serialized array describing the media to be sent; up to 10 items
312 | * - _string_ `$payload` __Required: Optional__. Bot-defined paid media payload, 0-128 bytes. This will not be displayed to the user, use it for your internal processes.
313 | * - _string_ `$caption` __Required: Optional__. Media caption, 0-1024 characters after entities parsing
314 | * - _string_ `$parse_mode` __Required: Optional__. Mode for parsing entities in the media caption. See formatting options for more details.
315 | * - _MessageEntity[]_ `$caption_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
316 | * - _bool_ `$show_caption_above_media` __Required: Optional__. Pass True, if the caption must be shown above the message media
317 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
318 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
319 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
320 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
321 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
322 | *
323 | *
324 | * @method static self sendMediaGroup(...$parameters) Use this method to send a group of photos, videos, documents or audios as an album. Documents and audio files can be only grouped in an album with messages of the same type. On success, an array of Messages that were sent is returned.
325 | *
326 | * {@see https://core.telegram.org/bots/api#sendmediagroup}
327 | *
328 | * Parameters:
329 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
330 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
331 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
332 | * - _InputMediaAudio[]|InputMediaDocument[]|InputMediaPhoto[]|InputMediaVideo[]_ `$media` __Required: Yes__. A JSON-serialized array describing messages to be sent, must include 2-10 items
333 | * - _bool_ `$disable_notification` __Required: Optional__. Sends messages silently. Users will receive a notification with no sound.
334 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent messages from forwarding and saving
335 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
336 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
337 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
338 | *
339 | *
340 | * @method static self sendLocation(...$parameters) Use this method to send point on the map. On success, the sent Message is returned.
341 | *
342 | * {@see https://core.telegram.org/bots/api#sendlocation}
343 | *
344 | * Parameters:
345 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
346 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
347 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
348 | * - _float_ `$latitude` __Required: Yes__. Latitude of the location
349 | * - _float_ `$longitude` __Required: Yes__. Longitude of the location
350 | * - _float_ `$horizontal_accuracy` __Required: Optional__. The radius of uncertainty for the location, measured in meters; 0-1500
351 | * - _int_ `$live_period` __Required: Optional__. Period in seconds during which the location will be updated (see Live Locations, should be between 60 and 86400, or 0x7FFFFFFF for live locations that can be edited indefinitely.
352 | * - _int_ `$heading` __Required: Optional__. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
353 | * - _int_ `$proximity_alert_radius` __Required: Optional__. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
354 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
355 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
356 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
357 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
358 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
359 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
360 | *
361 | *
362 | * @method static self sendVenue(...$parameters) Use this method to send information about a venue. On success, the sent Message is returned.
363 | *
364 | * {@see https://core.telegram.org/bots/api#sendvenue}
365 | *
366 | * Parameters:
367 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
368 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
369 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
370 | * - _float_ `$latitude` __Required: Yes__. Latitude of the venue
371 | * - _float_ `$longitude` __Required: Yes__. Longitude of the venue
372 | * - _string_ `$title` __Required: Yes__. Name of the venue
373 | * - _string_ `$address` __Required: Yes__. Address of the venue
374 | * - _string_ `$foursquare_id` __Required: Optional__. Foursquare identifier of the venue
375 | * - _string_ `$foursquare_type` __Required: Optional__. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
376 | * - _string_ `$google_place_id` __Required: Optional__. Google Places identifier of the venue
377 | * - _string_ `$google_place_type` __Required: Optional__. Google Places type of the venue. (See supported types.)
378 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
379 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
380 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
381 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
382 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
383 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
384 | *
385 | *
386 | * @method static self sendContact(...$parameters) Use this method to send phone contacts. On success, the sent Message is returned.
387 | *
388 | * {@see https://core.telegram.org/bots/api#sendcontact}
389 | *
390 | * Parameters:
391 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
392 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
393 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
394 | * - _string_ `$phone_number` __Required: Yes__. Contact's phone number
395 | * - _string_ `$first_name` __Required: Yes__. Contact's first name
396 | * - _string_ `$last_name` __Required: Optional__. Contact's last name
397 | * - _string_ `$vcard` __Required: Optional__. Additional data about the contact in the form of a vCard, 0-2048 bytes
398 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
399 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
400 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
401 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
402 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
403 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
404 | *
405 | *
406 | * @method static self sendPoll(...$parameters) Use this method to send a native poll. On success, the sent Message is returned.
407 | *
408 | * {@see https://core.telegram.org/bots/api#sendpoll}
409 | *
410 | * Parameters:
411 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
412 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
413 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
414 | * - _string_ `$question` __Required: Yes__. Poll question, 1-300 characters
415 | * - _string_ `$question_parse_mode` __Required: Optional__. Mode for parsing entities in the question. See formatting options for more details. Currently, only custom emoji entities are allowed
416 | * - _MessageEntity[]_ `$question_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the poll question. It can be specified instead of question_parse_mode
417 | * - _InputPollOption[]_ `$options` __Required: Yes__. A JSON-serialized list of 2-10 answer options
418 | * - _bool_ `$is_anonymous` __Required: Optional__. True, if the poll needs to be anonymous, defaults to True
419 | * - _string_ `$type` __Required: Optional__. Poll type, “quiz” or “regular”, defaults to “regular”
420 | * - _bool_ `$allows_multiple_answers` __Required: Optional__. True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
421 | * - _int_ `$correct_option_id` __Required: Optional__. 0-based identifier of the correct answer option, required for polls in quiz mode
422 | * - _string_ `$explanation` __Required: Optional__. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters with at most 2 line feeds after entities parsing
423 | * - _string_ `$explanation_parse_mode` __Required: Optional__. Mode for parsing entities in the explanation. See formatting options for more details.
424 | * - _MessageEntity[]_ `$explanation_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the poll explanation. It can be specified instead of explanation_parse_mode
425 | * - _int_ `$open_period` __Required: Optional__. Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date.
426 | * - _int_ `$close_date` __Required: Optional__. Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with open_period.
427 | * - _bool_ `$is_closed` __Required: Optional__. Pass True if the poll needs to be immediately closed. This can be useful for poll preview.
428 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
429 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
430 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
431 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
432 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
433 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
434 | *
435 | *
436 | * @method static self sendDice(...$parameters) Use this method to send an animated emoji that will display a random value. On success, the sent Message is returned.
437 | *
438 | * {@see https://core.telegram.org/bots/api#senddice}
439 | *
440 | * Parameters:
441 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
442 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
443 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
444 | * - _string_ `$emoji` __Required: Optional__. Emoji on which the dice throw animation is based. Currently, must be one of “”, “”, “”, “”, “”, or “”. Dice can have values 1-6 for “”, “” and “”, values 1-5 for “” and “”, and values 1-64 for “”. Defaults to “”
445 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
446 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding
447 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
448 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
449 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
450 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
451 | *
452 | *
453 | * @method static self sendChatAction(...$parameters) Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.
454 | *
455 | * We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
456 | *
457 | * {@see https://core.telegram.org/bots/api#sendchataction}
458 | *
459 | * Parameters:
460 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the action will be sent
461 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
462 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread; for supergroups only
463 | * - _string_ `$action` __Required: Yes__. Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.
464 | *
465 | *
466 | * @method static self setMessageReaction(...$parameters) Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.
467 | *
468 | * {@see https://core.telegram.org/bots/api#setmessagereaction}
469 | *
470 | * Parameters:
471 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
472 | * - _int_ `$message_id` __Required: Yes__. Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
473 | * - _ReactionType[]_ `$reaction` __Required: Optional__. A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.
474 | * - _bool_ `$is_big` __Required: Optional__. Pass True to set the reaction with a big animation
475 | *
476 | *
477 | * @method static self getUserProfilePhotos(...$parameters) Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
478 | *
479 | * {@see https://core.telegram.org/bots/api#getuserprofilephotos}
480 | *
481 | * Parameters:
482 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
483 | * - _int_ `$offset` __Required: Optional__. Sequential number of the first photo to be returned. By default, all photos are returned.
484 | * - _int_ `$limit` __Required: Optional__. Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.
485 | *
486 | *
487 | * @method static self setUserEmojiStatus(...$parameters) Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
488 | *
489 | * {@see https://core.telegram.org/bots/api#setuseremojistatus}
490 | *
491 | * Parameters:
492 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
493 | * - _string_ `$emoji_status_custom_emoji_id` __Required: Optional__. Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
494 | * - _int_ `$emoji_status_expiration_date` __Required: Optional__. Expiration date of the emoji status, if any
495 | *
496 | *
497 | * @method static self getFile(...$parameters) Use this method to get basic information about a file and prepare it for downloading. For the moment, bots can download files of up to 20MB in size. On success, a File object is returned. The file can then be downloaded via the link https://api.telegram.org/file/bot/, where is taken from the response. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile again.
498 | *
499 | * Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
500 | *
501 | * {@see https://core.telegram.org/bots/api#getfile}
502 | *
503 | * Parameters:
504 | * - _string_ `$file_id` __Required: Yes__. File identifier to get information about
505 | *
506 | *
507 | * @method static self banChatMember(...$parameters) Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
508 | *
509 | * {@see https://core.telegram.org/bots/api#banchatmember}
510 | *
511 | * Parameters:
512 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
513 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
514 | * - _int_ `$until_date` __Required: Optional__. Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.
515 | * - _bool_ `$revoke_messages` __Required: Optional__. Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels.
516 | *
517 | *
518 | * @method static self unbanChatMember(...$parameters) Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success.
519 | *
520 | * {@see https://core.telegram.org/bots/api#unbanchatmember}
521 | *
522 | * Parameters:
523 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target group or username of the target supergroup or channel (in the format @channelusername)
524 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
525 | * - _bool_ `$only_if_banned` __Required: Optional__. Do nothing if the user is not banned
526 | *
527 | *
528 | * @method static self restrictChatMember(...$parameters) Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
529 | *
530 | * {@see https://core.telegram.org/bots/api#restrictchatmember}
531 | *
532 | * Parameters:
533 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
534 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
535 | * - _ChatPermissions_ `$permissions` __Required: Yes__. A JSON-serialized object for new user permissions
536 | * - _bool_ `$use_independent_chat_permissions` __Required: Optional__. Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
537 | * - _int_ `$until_date` __Required: Optional__. Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
538 | *
539 | *
540 | * @method static self promoteChatMember(...$parameters) Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Pass False for all boolean parameters to demote a user. Returns True on success.
541 | *
542 | * {@see https://core.telegram.org/bots/api#promotechatmember}
543 | *
544 | * Parameters:
545 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
546 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
547 | * - _bool_ `$is_anonymous` __Required: Optional__. Pass True if the administrator's presence in the chat is hidden
548 | * - _bool_ `$can_manage_chat` __Required: Optional__. Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege.
549 | * - _bool_ `$can_delete_messages` __Required: Optional__. Pass True if the administrator can delete messages of other users
550 | * - _bool_ `$can_manage_video_chats` __Required: Optional__. Pass True if the administrator can manage video chats
551 | * - _bool_ `$can_restrict_members` __Required: Optional__. Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics
552 | * - _bool_ `$can_promote_members` __Required: Optional__. Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)
553 | * - _bool_ `$can_change_info` __Required: Optional__. Pass True if the administrator can change chat title, photo and other settings
554 | * - _bool_ `$can_invite_users` __Required: Optional__. Pass True if the administrator can invite new users to the chat
555 | * - _bool_ `$can_post_stories` __Required: Optional__. Pass True if the administrator can post stories to the chat
556 | * - _bool_ `$can_edit_stories` __Required: Optional__. Pass True if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive
557 | * - _bool_ `$can_delete_stories` __Required: Optional__. Pass True if the administrator can delete stories posted by other users
558 | * - _bool_ `$can_post_messages` __Required: Optional__. Pass True if the administrator can post messages in the channel, or access channel statistics; for channels only
559 | * - _bool_ `$can_edit_messages` __Required: Optional__. Pass True if the administrator can edit messages of other users and can pin messages; for channels only
560 | * - _bool_ `$can_pin_messages` __Required: Optional__. Pass True if the administrator can pin messages; for supergroups only
561 | * - _bool_ `$can_manage_topics` __Required: Optional__. Pass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
562 | *
563 | *
564 | * @method static self setChatAdministratorCustomTitle(...$parameters) Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success.
565 | *
566 | * {@see https://core.telegram.org/bots/api#setchatadministratorcustomtitle}
567 | *
568 | * Parameters:
569 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
570 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
571 | * - _string_ `$custom_title` __Required: Yes__. New custom title for the administrator; 0-16 characters, emoji are not allowed
572 | *
573 | *
574 | * @method static self banChatSenderChat(...$parameters) Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.
575 | *
576 | * {@see https://core.telegram.org/bots/api#banchatsenderchat}
577 | *
578 | * Parameters:
579 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
580 | * - _int_ `$sender_chat_id` __Required: Yes__. Unique identifier of the target sender chat
581 | *
582 | *
583 | * @method static self unbanChatSenderChat(...$parameters) Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns True on success.
584 | *
585 | * {@see https://core.telegram.org/bots/api#unbanchatsenderchat}
586 | *
587 | * Parameters:
588 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
589 | * - _int_ `$sender_chat_id` __Required: Yes__. Unique identifier of the target sender chat
590 | *
591 | *
592 | * @method static self setChatPermissions(...$parameters) Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
593 | *
594 | * {@see https://core.telegram.org/bots/api#setchatpermissions}
595 | *
596 | * Parameters:
597 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
598 | * - _ChatPermissions_ `$permissions` __Required: Yes__. A JSON-serialized object for new default chat permissions
599 | * - _bool_ `$use_independent_chat_permissions` __Required: Optional__. Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.
600 | *
601 | *
602 | * @method static self exportChatInviteLink(...$parameters) Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.
603 | *
604 | * {@see https://core.telegram.org/bots/api#exportchatinvitelink}
605 | *
606 | * Parameters:
607 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
608 | *
609 | *
610 | * @method static self createChatInviteLink(...$parameters) Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.
611 | *
612 | * {@see https://core.telegram.org/bots/api#createchatinvitelink}
613 | *
614 | * Parameters:
615 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
616 | * - _string_ `$name` __Required: Optional__. Invite link name; 0-32 characters
617 | * - _int_ `$expire_date` __Required: Optional__. Point in time (Unix timestamp) when the link will expire
618 | * - _int_ `$member_limit` __Required: Optional__. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
619 | * - _bool_ `$creates_join_request` __Required: Optional__. True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
620 | *
621 | *
622 | * @method static self editChatInviteLink(...$parameters) Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the edited invite link as a ChatInviteLink object.
623 | *
624 | * {@see https://core.telegram.org/bots/api#editchatinvitelink}
625 | *
626 | * Parameters:
627 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
628 | * - _string_ `$invite_link` __Required: Yes__. The invite link to edit
629 | * - _string_ `$name` __Required: Optional__. Invite link name; 0-32 characters
630 | * - _int_ `$expire_date` __Required: Optional__. Point in time (Unix timestamp) when the link will expire
631 | * - _int_ `$member_limit` __Required: Optional__. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
632 | * - _bool_ `$creates_join_request` __Required: Optional__. True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified
633 | *
634 | *
635 | * @method static self createChatSubscriptionInviteLink(...$parameters) Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.
636 | *
637 | * {@see https://core.telegram.org/bots/api#createchatsubscriptioninvitelink}
638 | *
639 | * Parameters:
640 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target channel chat or username of the target channel (in the format @channelusername)
641 | * - _string_ `$name` __Required: Optional__. Invite link name; 0-32 characters
642 | * - _int_ `$subscription_period` __Required: Yes__. The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
643 | * - _int_ `$subscription_price` __Required: Yes__. The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000
644 | *
645 | *
646 | * @method static self editChatSubscriptionInviteLink(...$parameters) Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.
647 | *
648 | * {@see https://core.telegram.org/bots/api#editchatsubscriptioninvitelink}
649 | *
650 | * Parameters:
651 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
652 | * - _string_ `$invite_link` __Required: Yes__. The invite link to edit
653 | * - _string_ `$name` __Required: Optional__. Invite link name; 0-32 characters
654 | *
655 | *
656 | * @method static self revokeChatInviteLink(...$parameters) Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.
657 | *
658 | * {@see https://core.telegram.org/bots/api#revokechatinvitelink}
659 | *
660 | * Parameters:
661 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier of the target chat or username of the target channel (in the format @channelusername)
662 | * - _string_ `$invite_link` __Required: Yes__. The invite link to revoke
663 | *
664 | *
665 | * @method static self approveChatJoinRequest(...$parameters) Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
666 | *
667 | * {@see https://core.telegram.org/bots/api#approvechatjoinrequest}
668 | *
669 | * Parameters:
670 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
671 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
672 | *
673 | *
674 | * @method static self declineChatJoinRequest(...$parameters) Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
675 | *
676 | * {@see https://core.telegram.org/bots/api#declinechatjoinrequest}
677 | *
678 | * Parameters:
679 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
680 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
681 | *
682 | *
683 | * @method static self setChatPhoto(...$parameters) Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
684 | *
685 | * {@see https://core.telegram.org/bots/api#setchatphoto}
686 | *
687 | * Parameters:
688 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
689 | * - _InputFile_ `$photo` __Required: Yes__. New chat photo, uploaded using multipart/form-data
690 | *
691 | *
692 | * @method static self deleteChatPhoto(...$parameters) Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
693 | *
694 | * {@see https://core.telegram.org/bots/api#deletechatphoto}
695 | *
696 | * Parameters:
697 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
698 | *
699 | *
700 | * @method static self setChatTitle(...$parameters) Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
701 | *
702 | * {@see https://core.telegram.org/bots/api#setchattitle}
703 | *
704 | * Parameters:
705 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
706 | * - _string_ `$title` __Required: Yes__. New chat title, 1-128 characters
707 | *
708 | *
709 | * @method static self setChatDescription(...$parameters) Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
710 | *
711 | * {@see https://core.telegram.org/bots/api#setchatdescription}
712 | *
713 | * Parameters:
714 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
715 | * - _string_ `$description` __Required: Optional__. New chat description, 0-255 characters
716 | *
717 | *
718 | * @method static self pinChatMessage(...$parameters) Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
719 | *
720 | * {@see https://core.telegram.org/bots/api#pinchatmessage}
721 | *
722 | * Parameters:
723 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be pinned
724 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
725 | * - _int_ `$message_id` __Required: Yes__. Identifier of a message to pin
726 | * - _bool_ `$disable_notification` __Required: Optional__. Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats.
727 | *
728 | *
729 | * @method static self unpinChatMessage(...$parameters) Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
730 | *
731 | * {@see https://core.telegram.org/bots/api#unpinchatmessage}
732 | *
733 | * Parameters:
734 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be unpinned
735 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
736 | * - _int_ `$message_id` __Required: Optional__. Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the most recent pinned message (by sending date) will be unpinned.
737 | *
738 | *
739 | * @method static self unpinAllChatMessages(...$parameters) Use this method to clear the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.
740 | *
741 | * {@see https://core.telegram.org/bots/api#unpinallchatmessages}
742 | *
743 | * Parameters:
744 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
745 | *
746 | *
747 | * @method static self leaveChat(...$parameters) Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
748 | *
749 | * {@see https://core.telegram.org/bots/api#leavechat}
750 | *
751 | * Parameters:
752 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
753 | *
754 | *
755 | * @method static self getChat(...$parameters) Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success.
756 | *
757 | * {@see https://core.telegram.org/bots/api#getchat}
758 | *
759 | * Parameters:
760 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
761 | *
762 | *
763 | * @method static self getChatAdministrators(...$parameters) Use this method to get a list of administrators in a chat, which aren't bots. Returns an Array of ChatMember objects.
764 | *
765 | * {@see https://core.telegram.org/bots/api#getchatadministrators}
766 | *
767 | * Parameters:
768 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
769 | *
770 | *
771 | * @method static self getChatMemberCount(...$parameters) Use this method to get the number of members in a chat. Returns Int on success.
772 | *
773 | * {@see https://core.telegram.org/bots/api#getchatmembercount}
774 | *
775 | * Parameters:
776 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
777 | *
778 | *
779 | * @method static self getChatMember(...$parameters) Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success.
780 | *
781 | * {@see https://core.telegram.org/bots/api#getchatmember}
782 | *
783 | * Parameters:
784 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
785 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
786 | *
787 | *
788 | * @method static self setChatStickerSet(...$parameters) Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
789 | *
790 | * {@see https://core.telegram.org/bots/api#setchatstickerset}
791 | *
792 | * Parameters:
793 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
794 | * - _string_ `$sticker_set_name` __Required: Yes__. Name of the sticker set to be set as the group sticker set
795 | *
796 | *
797 | * @method static self deleteChatStickerSet(...$parameters) Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
798 | *
799 | * {@see https://core.telegram.org/bots/api#deletechatstickerset}
800 | *
801 | * Parameters:
802 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
803 | *
804 | *
805 | * @method static self getForumTopicIconStickers(...$parameters) Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects.
806 | *
807 | * {@see https://core.telegram.org/bots/api#getforumtopiciconstickers}
808 | * @method static self createForumTopic(...$parameters) Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a ForumTopic object.
809 | *
810 | * {@see https://core.telegram.org/bots/api#createforumtopic}
811 | *
812 | * Parameters:
813 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
814 | * - _string_ `$name` __Required: Yes__. Topic name, 1-128 characters
815 | * - _int_ `$icon_color` __Required: Optional__. Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F)
816 | * - _string_ `$icon_custom_emoji_id` __Required: Optional__. Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.
817 | *
818 | *
819 | * @method static self editForumTopic(...$parameters) Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
820 | *
821 | * {@see https://core.telegram.org/bots/api#editforumtopic}
822 | *
823 | * Parameters:
824 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
825 | * - _int_ `$message_thread_id` __Required: Yes__. Unique identifier for the target message thread of the forum topic
826 | * - _string_ `$name` __Required: Optional__. New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept
827 | * - _string_ `$icon_custom_emoji_id` __Required: Optional__. New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept
828 | *
829 | *
830 | * @method static self closeForumTopic(...$parameters) Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
831 | *
832 | * {@see https://core.telegram.org/bots/api#closeforumtopic}
833 | *
834 | * Parameters:
835 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
836 | * - _int_ `$message_thread_id` __Required: Yes__. Unique identifier for the target message thread of the forum topic
837 | *
838 | *
839 | * @method static self reopenForumTopic(...$parameters) Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
840 | *
841 | * {@see https://core.telegram.org/bots/api#reopenforumtopic}
842 | *
843 | * Parameters:
844 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
845 | * - _int_ `$message_thread_id` __Required: Yes__. Unique identifier for the target message thread of the forum topic
846 | *
847 | *
848 | * @method static self deleteForumTopic(...$parameters) Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success.
849 | *
850 | * {@see https://core.telegram.org/bots/api#deleteforumtopic}
851 | *
852 | * Parameters:
853 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
854 | * - _int_ `$message_thread_id` __Required: Yes__. Unique identifier for the target message thread of the forum topic
855 | *
856 | *
857 | * @method static self unpinAllForumTopicMessages(...$parameters) Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
858 | *
859 | * {@see https://core.telegram.org/bots/api#unpinallforumtopicmessages}
860 | *
861 | * Parameters:
862 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
863 | * - _int_ `$message_thread_id` __Required: Yes__. Unique identifier for the target message thread of the forum topic
864 | *
865 | *
866 | * @method static self editGeneralForumTopic(...$parameters) Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
867 | *
868 | * {@see https://core.telegram.org/bots/api#editgeneralforumtopic}
869 | *
870 | * Parameters:
871 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
872 | * - _string_ `$name` __Required: Yes__. New topic name, 1-128 characters
873 | *
874 | *
875 | * @method static self closeGeneralForumTopic(...$parameters) Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
876 | *
877 | * {@see https://core.telegram.org/bots/api#closegeneralforumtopic}
878 | *
879 | * Parameters:
880 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
881 | *
882 | *
883 | * @method static self reopenGeneralForumTopic(...$parameters) Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.
884 | *
885 | * {@see https://core.telegram.org/bots/api#reopengeneralforumtopic}
886 | *
887 | * Parameters:
888 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
889 | *
890 | *
891 | * @method static self hideGeneralForumTopic(...$parameters) Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.
892 | *
893 | * {@see https://core.telegram.org/bots/api#hidegeneralforumtopic}
894 | *
895 | * Parameters:
896 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
897 | *
898 | *
899 | * @method static self unhideGeneralForumTopic(...$parameters) Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
900 | *
901 | * {@see https://core.telegram.org/bots/api#unhidegeneralforumtopic}
902 | *
903 | * Parameters:
904 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
905 | *
906 | *
907 | * @method static self unpinAllGeneralForumTopicMessages(...$parameters) Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
908 | *
909 | * {@see https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages}
910 | *
911 | * Parameters:
912 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
913 | *
914 | *
915 | * @method static self answerCallbackQuery(...$parameters) Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
916 | *
917 | * {@see https://core.telegram.org/bots/api#answercallbackquery}
918 | *
919 | * Parameters:
920 | * - _string_ `$callback_query_id` __Required: Yes__. Unique identifier for the query to be answered
921 | * - _string_ `$text` __Required: Optional__. Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
922 | * - _bool_ `$show_alert` __Required: Optional__. If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.
923 | * - _string_ `$url` __Required: Optional__. URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button.Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
924 | * - _int_ `$cache_time` __Required: Optional__. The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.
925 | *
926 | *
927 | * @method static self getUserChatBoosts(...$parameters) Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.
928 | *
929 | * {@see https://core.telegram.org/bots/api#getuserchatboosts}
930 | *
931 | * Parameters:
932 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the chat or username of the channel (in the format @channelusername)
933 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
934 | *
935 | *
936 | * @method static self getBusinessConnection(...$parameters) Use this method to get information about the connection of the bot with a business account. Returns a BusinessConnection object on success.
937 | *
938 | * {@see https://core.telegram.org/bots/api#getbusinessconnection}
939 | *
940 | * Parameters:
941 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
942 | *
943 | *
944 | * @method static self setMyCommands(...$parameters) Use this method to change the list of the bot's commands. See this manual for more details about bot commands. Returns True on success.
945 | *
946 | * {@see https://core.telegram.org/bots/api#setmycommands}
947 | *
948 | * Parameters:
949 | * - _BotCommand[]_ `$commands` __Required: Yes__. A JSON-serialized list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
950 | * - _BotCommandScope_ `$scope` __Required: Optional__. A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
951 | * - _string_ `$language_code` __Required: Optional__. A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands
952 | *
953 | *
954 | * @method static self deleteMyCommands(...$parameters) Use this method to delete the list of the bot's commands for the given scope and user language. After deletion, higher level commands will be shown to affected users. Returns True on success.
955 | *
956 | * {@see https://core.telegram.org/bots/api#deletemycommands}
957 | *
958 | * Parameters:
959 | * - _BotCommandScope_ `$scope` __Required: Optional__. A JSON-serialized object, describing scope of users for which the commands are relevant. Defaults to BotCommandScopeDefault.
960 | * - _string_ `$language_code` __Required: Optional__. A two-letter ISO 639-1 language code. If empty, commands will be applied to all users from the given scope, for whose language there are no dedicated commands
961 | *
962 | *
963 | * @method static self getMyCommands(...$parameters) 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.
964 | *
965 | * {@see https://core.telegram.org/bots/api#getmycommands}
966 | *
967 | * Parameters:
968 | * - _BotCommandScope_ `$scope` __Required: Optional__. A JSON-serialized object, describing scope of users. Defaults to BotCommandScopeDefault.
969 | * - _string_ `$language_code` __Required: Optional__. A two-letter ISO 639-1 language code or an empty string
970 | *
971 | *
972 | * @method static self setMyName(...$parameters) Use this method to change the bot's name. Returns True on success.
973 | *
974 | * {@see https://core.telegram.org/bots/api#setmyname}
975 | *
976 | * Parameters:
977 | * - _string_ `$name` __Required: Optional__. New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
978 | * - _string_ `$language_code` __Required: Optional__. A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.
979 | *
980 | *
981 | * @method static self getMyName(...$parameters) Use this method to get the current bot name for the given user language. Returns BotName on success.
982 | *
983 | * {@see https://core.telegram.org/bots/api#getmyname}
984 | *
985 | * Parameters:
986 | * - _string_ `$language_code` __Required: Optional__. A two-letter ISO 639-1 language code or an empty string
987 | *
988 | *
989 | * @method static self setMyDescription(...$parameters) Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty. Returns True on success.
990 | *
991 | * {@see https://core.telegram.org/bots/api#setmydescription}
992 | *
993 | * Parameters:
994 | * - _string_ `$description` __Required: Optional__. New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
995 | * - _string_ `$language_code` __Required: Optional__. A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
996 | *
997 | *
998 | * @method static self getMyDescription(...$parameters) Use this method to get the current bot description for the given user language. Returns BotDescription on success.
999 | *
1000 | * {@see https://core.telegram.org/bots/api#getmydescription}
1001 | *
1002 | * Parameters:
1003 | * - _string_ `$language_code` __Required: Optional__. A two-letter ISO 639-1 language code or an empty string
1004 | *
1005 | *
1006 | * @method static self setMyShortDescription(...$parameters) Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot. Returns True on success.
1007 | *
1008 | * {@see https://core.telegram.org/bots/api#setmyshortdescription}
1009 | *
1010 | * Parameters:
1011 | * - _string_ `$short_description` __Required: Optional__. New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
1012 | * - _string_ `$language_code` __Required: Optional__. A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.
1013 | *
1014 | *
1015 | * @method static self getMyShortDescription(...$parameters) Use this method to get the current bot short description for the given user language. Returns BotShortDescription on success.
1016 | *
1017 | * {@see https://core.telegram.org/bots/api#getmyshortdescription}
1018 | *
1019 | * Parameters:
1020 | * - _string_ `$language_code` __Required: Optional__. A two-letter ISO 639-1 language code or an empty string
1021 | *
1022 | *
1023 | * @method static self setChatMenuButton(...$parameters) Use this method to change the bot's menu button in a private chat, or the default menu button. Returns True on success.
1024 | *
1025 | * {@see https://core.telegram.org/bots/api#setchatmenubutton}
1026 | *
1027 | * Parameters:
1028 | * - _int_ `$chat_id` __Required: Optional__. Unique identifier for the target private chat. If not specified, default bot's menu button will be changed
1029 | * - _MenuButton_ `$menu_button` __Required: Optional__. A JSON-serialized object for the bot's new menu button. Defaults to MenuButtonDefault
1030 | *
1031 | *
1032 | * @method static self getChatMenuButton(...$parameters) Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.
1033 | *
1034 | * {@see https://core.telegram.org/bots/api#getchatmenubutton}
1035 | *
1036 | * Parameters:
1037 | * - _int_ `$chat_id` __Required: Optional__. Unique identifier for the target private chat. If not specified, default bot's menu button will be returned
1038 | *
1039 | *
1040 | * @method static self setMyDefaultAdministratorRights(...$parameters) Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels. These rights will be suggested to users, but they are free to modify the list before adding the bot. Returns True on success.
1041 | *
1042 | * {@see https://core.telegram.org/bots/api#setmydefaultadministratorrights}
1043 | *
1044 | * Parameters:
1045 | * - _ChatAdministratorRights_ `$rights` __Required: Optional__. A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared.
1046 | * - _bool_ `$for_channels` __Required: Optional__. Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed.
1047 | *
1048 | *
1049 | * @method static self getMyDefaultAdministratorRights(...$parameters) Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
1050 | *
1051 | * {@see https://core.telegram.org/bots/api#getmydefaultadministratorrights}
1052 | *
1053 | * Parameters:
1054 | * - _bool_ `$for_channels` __Required: Optional__. Pass True to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned.
1055 | *
1056 | *
1057 | * @method static self editMessageText(...$parameters) Use this method to edit text and game messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
1058 | *
1059 | * {@see https://core.telegram.org/bots/api#editmessagetext}
1060 | *
1061 | * Parameters:
1062 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message to be edited was sent
1063 | * - _int|string_ `$chat_id` __Required: Optional__. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1064 | * - _int_ `$message_id` __Required: Optional__. Required if inline_message_id is not specified. Identifier of the message to edit
1065 | * - _string_ `$inline_message_id` __Required: Optional__. Required if chat_id and message_id are not specified. Identifier of the inline message
1066 | * - _string_ `$text` __Required: Yes__. New text of the message, 1-4096 characters after entities parsing
1067 | * - _string_ `$parse_mode` __Required: Optional__. Mode for parsing entities in the message text. See formatting options for more details.
1068 | * - _MessageEntity[]_ `$entities` __Required: Optional__. A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
1069 | * - _LinkPreviewOptions_ `$link_preview_options` __Required: Optional__. Link preview generation options for the message
1070 | * - _InlineKeyboardMarkup_ `$reply_markup` __Required: Optional__. A JSON-serialized object for an inline keyboard.
1071 | *
1072 | *
1073 | * @method static self editMessageCaption(...$parameters) Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
1074 | *
1075 | * {@see https://core.telegram.org/bots/api#editmessagecaption}
1076 | *
1077 | * Parameters:
1078 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message to be edited was sent
1079 | * - _int|string_ `$chat_id` __Required: Optional__. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1080 | * - _int_ `$message_id` __Required: Optional__. Required if inline_message_id is not specified. Identifier of the message to edit
1081 | * - _string_ `$inline_message_id` __Required: Optional__. Required if chat_id and message_id are not specified. Identifier of the inline message
1082 | * - _string_ `$caption` __Required: Optional__. New caption of the message, 0-1024 characters after entities parsing
1083 | * - _string_ `$parse_mode` __Required: Optional__. Mode for parsing entities in the message caption. See formatting options for more details.
1084 | * - _MessageEntity[]_ `$caption_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
1085 | * - _bool_ `$show_caption_above_media` __Required: Optional__. Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
1086 | * - _InlineKeyboardMarkup_ `$reply_markup` __Required: Optional__. A JSON-serialized object for an inline keyboard.
1087 | *
1088 | *
1089 | * @method static self editMessageMedia(...$parameters) Use this method to edit animation, audio, document, photo, or video messages, or to add media to text messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
1090 | *
1091 | * {@see https://core.telegram.org/bots/api#editmessagemedia}
1092 | *
1093 | * Parameters:
1094 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message to be edited was sent
1095 | * - _int|string_ `$chat_id` __Required: Optional__. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1096 | * - _int_ `$message_id` __Required: Optional__. Required if inline_message_id is not specified. Identifier of the message to edit
1097 | * - _string_ `$inline_message_id` __Required: Optional__. Required if chat_id and message_id are not specified. Identifier of the inline message
1098 | * - _InputMedia_ `$media` __Required: Yes__. A JSON-serialized object for a new media content of the message
1099 | * - _InlineKeyboardMarkup_ `$reply_markup` __Required: Optional__. A JSON-serialized object for a new inline keyboard.
1100 | *
1101 | *
1102 | * @method static self editMessageLiveLocation(...$parameters) Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to stopMessageLiveLocation. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
1103 | *
1104 | * {@see https://core.telegram.org/bots/api#editmessagelivelocation}
1105 | *
1106 | * Parameters:
1107 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message to be edited was sent
1108 | * - _int|string_ `$chat_id` __Required: Optional__. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1109 | * - _int_ `$message_id` __Required: Optional__. Required if inline_message_id is not specified. Identifier of the message to edit
1110 | * - _string_ `$inline_message_id` __Required: Optional__. Required if chat_id and message_id are not specified. Identifier of the inline message
1111 | * - _float_ `$latitude` __Required: Yes__. Latitude of new location
1112 | * - _float_ `$longitude` __Required: Yes__. Longitude of new location
1113 | * - _int_ `$live_period` __Required: Optional__. New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current live_period by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then live_period remains unchanged
1114 | * - _float_ `$horizontal_accuracy` __Required: Optional__. The radius of uncertainty for the location, measured in meters; 0-1500
1115 | * - _int_ `$heading` __Required: Optional__. Direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
1116 | * - _int_ `$proximity_alert_radius` __Required: Optional__. The maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
1117 | * - _InlineKeyboardMarkup_ `$reply_markup` __Required: Optional__. A JSON-serialized object for a new inline keyboard.
1118 | *
1119 | *
1120 | * @method static self stopMessageLiveLocation(...$parameters) Use this method to stop updating a live location message before live_period expires. On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
1121 | *
1122 | * {@see https://core.telegram.org/bots/api#stopmessagelivelocation}
1123 | *
1124 | * Parameters:
1125 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message to be edited was sent
1126 | * - _int|string_ `$chat_id` __Required: Optional__. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1127 | * - _int_ `$message_id` __Required: Optional__. Required if inline_message_id is not specified. Identifier of the message with live location to stop
1128 | * - _string_ `$inline_message_id` __Required: Optional__. Required if chat_id and message_id are not specified. Identifier of the inline message
1129 | * - _InlineKeyboardMarkup_ `$reply_markup` __Required: Optional__. A JSON-serialized object for a new inline keyboard.
1130 | *
1131 | *
1132 | * @method static self editMessageReplyMarkup(...$parameters) Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
1133 | *
1134 | * {@see https://core.telegram.org/bots/api#editmessagereplymarkup}
1135 | *
1136 | * Parameters:
1137 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message to be edited was sent
1138 | * - _int|string_ `$chat_id` __Required: Optional__. Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1139 | * - _int_ `$message_id` __Required: Optional__. Required if inline_message_id is not specified. Identifier of the message to edit
1140 | * - _string_ `$inline_message_id` __Required: Optional__. Required if chat_id and message_id are not specified. Identifier of the inline message
1141 | * - _InlineKeyboardMarkup_ `$reply_markup` __Required: Optional__. A JSON-serialized object for an inline keyboard.
1142 | *
1143 | *
1144 | * @method static self stopPoll(...$parameters) Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned.
1145 | *
1146 | * {@see https://core.telegram.org/bots/api#stoppoll}
1147 | *
1148 | * Parameters:
1149 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message to be edited was sent
1150 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1151 | * - _int_ `$message_id` __Required: Yes__. Identifier of the original message with the poll
1152 | * - _InlineKeyboardMarkup_ `$reply_markup` __Required: Optional__. A JSON-serialized object for a new message inline keyboard.
1153 | *
1154 | *
1155 | * @method static self deleteMessage(...$parameters) Use this method to delete a message, including service messages, with the following limitations:- A message can only be deleted if it was sent less than 48 hours ago.- Service messages about a supergroup, channel, or forum topic creation can't be deleted.- A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.- Bots can delete outgoing messages in private chats, groups, and supergroups.- Bots can delete incoming messages in private chats.- Bots granted can_post_messages permissions can delete outgoing messages in channels.- If the bot is an administrator of a group, it can delete any message there.- If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.Returns True on success.
1156 | *
1157 | * {@see https://core.telegram.org/bots/api#deletemessage}
1158 | *
1159 | * Parameters:
1160 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1161 | * - _int_ `$message_id` __Required: Yes__. Identifier of the message to delete
1162 | *
1163 | *
1164 | * @method static self deleteMessages(...$parameters) Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped. Returns True on success.
1165 | *
1166 | * {@see https://core.telegram.org/bots/api#deletemessages}
1167 | *
1168 | * Parameters:
1169 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1170 | * - _int[]_ `$message_ids` __Required: Yes__. A JSON-serialized list of 1-100 identifiers of messages to delete. See deleteMessage for limitations on which messages can be deleted
1171 | *
1172 | *
1173 | * @method static self getAvailableGifts(...$parameters) Returns the list of gifts that can be sent by the bot to users and channel chats. Requires no parameters. Returns a Gifts object.
1174 | *
1175 | * {@see https://core.telegram.org/bots/api#getavailablegifts}
1176 | * @method static self sendGift(...$parameters) Sends a gift to the given user or channel chat. The gift can't be converted to Telegram Stars by the receiver. Returns True on success.
1177 | *
1178 | * {@see https://core.telegram.org/bots/api#sendgift}
1179 | *
1180 | * Parameters:
1181 | * - _int_ `$user_id` __Required: Optional__. Required if chat_id is not specified. Unique identifier of the target user who will receive the gift.
1182 | * - _int|string_ `$chat_id` __Required: Optional__. Required if user_id is not specified. Unique identifier for the chat or username of the channel (in the format @channelusername) that will receive the gift.
1183 | * - _string_ `$gift_id` __Required: Yes__. Identifier of the gift
1184 | * - _bool_ `$pay_for_upgrade` __Required: Optional__. Pass True to pay for the gift upgrade from the bot's balance, thereby making the upgrade free for the receiver
1185 | * - _string_ `$text` __Required: Optional__. Text that will be shown along with the gift; 0-128 characters
1186 | * - _string_ `$text_parse_mode` __Required: Optional__. Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored.
1187 | * - _MessageEntity[]_ `$text_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored.
1188 | *
1189 | *
1190 | * @method static self giftPremiumSubscription(...$parameters) Gifts a Telegram Premium subscription to the given user. Returns True on success.
1191 | *
1192 | * {@see https://core.telegram.org/bots/api#giftpremiumsubscription}
1193 | *
1194 | * Parameters:
1195 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user who will receive a Telegram Premium subscription
1196 | * - _int_ `$month_count` __Required: Yes__. Number of months the Telegram Premium subscription will be active for the user; must be one of 3, 6, or 12
1197 | * - _int_ `$star_count` __Required: Yes__. Number of Telegram Stars to pay for the Telegram Premium subscription; must be 1000 for 3 months, 1500 for 6 months, and 2500 for 12 months
1198 | * - _string_ `$text` __Required: Optional__. Text that will be shown along with the service message about the subscription; 0-128 characters
1199 | * - _string_ `$text_parse_mode` __Required: Optional__. Mode for parsing entities in the text. See formatting options for more details. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored.
1200 | * - _MessageEntity[]_ `$text_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than “bold”, “italic”, “underline”, “strikethrough”, “spoiler”, and “custom_emoji” are ignored.
1201 | *
1202 | *
1203 | * @method static self verifyUser(...$parameters) Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.
1204 | *
1205 | * {@see https://core.telegram.org/bots/api#verifyuser}
1206 | *
1207 | * Parameters:
1208 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
1209 | * - _string_ `$custom_description` __Required: Optional__. Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
1210 | *
1211 | *
1212 | * @method static self verifyChat(...$parameters) Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.
1213 | *
1214 | * {@see https://core.telegram.org/bots/api#verifychat}
1215 | *
1216 | * Parameters:
1217 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1218 | * - _string_ `$custom_description` __Required: Optional__. Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.
1219 | *
1220 | *
1221 | * @method static self removeUserVerification(...$parameters) Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.
1222 | *
1223 | * {@see https://core.telegram.org/bots/api#removeuserverification}
1224 | *
1225 | * Parameters:
1226 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user
1227 | *
1228 | *
1229 | * @method static self removeChatVerification(...$parameters) Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.
1230 | *
1231 | * {@see https://core.telegram.org/bots/api#removechatverification}
1232 | *
1233 | * Parameters:
1234 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1235 | *
1236 | *
1237 | * @method static self readBusinessMessage(...$parameters) Marks incoming message as read on behalf of a business account. Requires the can_read_messages business bot right. Returns True on success.
1238 | *
1239 | * {@see https://core.telegram.org/bots/api#readbusinessmessage}
1240 | *
1241 | * Parameters:
1242 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection on behalf of which to read the message
1243 | * - _int_ `$chat_id` __Required: Yes__. Unique identifier of the chat in which the message was received. The chat must have been active in the last 24 hours.
1244 | * - _int_ `$message_id` __Required: Yes__. Unique identifier of the message to mark as read
1245 | *
1246 | *
1247 | * @method static self deleteBusinessMessages(...$parameters) Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success.
1248 | *
1249 | * {@see https://core.telegram.org/bots/api#deletebusinessmessages}
1250 | *
1251 | * Parameters:
1252 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection on behalf of which to delete the messages
1253 | * - _int[]_ `$message_ids` __Required: Yes__. A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See deleteMessage for limitations on which messages can be deleted
1254 | *
1255 | *
1256 | * @method static self setBusinessAccountName(...$parameters) Changes the first and last name of a managed business account. Requires the can_change_name business bot right. Returns True on success.
1257 | *
1258 | * {@see https://core.telegram.org/bots/api#setbusinessaccountname}
1259 | *
1260 | * Parameters:
1261 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1262 | * - _string_ `$first_name` __Required: Yes__. The new value of the first name for the business account; 1-64 characters
1263 | * - _string_ `$last_name` __Required: Optional__. The new value of the last name for the business account; 0-64 characters
1264 | *
1265 | *
1266 | * @method static self setBusinessAccountUsername(...$parameters) Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success.
1267 | *
1268 | * {@see https://core.telegram.org/bots/api#setbusinessaccountusername}
1269 | *
1270 | * Parameters:
1271 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1272 | * - _string_ `$username` __Required: Optional__. The new value of the username for the business account; 0-32 characters
1273 | *
1274 | *
1275 | * @method static self setBusinessAccountBio(...$parameters) Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success.
1276 | *
1277 | * {@see https://core.telegram.org/bots/api#setbusinessaccountbio}
1278 | *
1279 | * Parameters:
1280 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1281 | * - _string_ `$bio` __Required: Optional__. The new value of the bio for the business account; 0-140 characters
1282 | *
1283 | *
1284 | * @method static self setBusinessAccountProfilePhoto(...$parameters) Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success.
1285 | *
1286 | * {@see https://core.telegram.org/bots/api#setbusinessaccountprofilephoto}
1287 | *
1288 | * Parameters:
1289 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1290 | * - _InputProfilePhoto_ `$photo` __Required: Yes__. The new profile photo to set
1291 | * - _bool_ `$is_public` __Required: Optional__. Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo.
1292 | *
1293 | *
1294 | * @method static self removeBusinessAccountProfilePhoto(...$parameters) Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success.
1295 | *
1296 | * {@see https://core.telegram.org/bots/api#removebusinessaccountprofilephoto}
1297 | *
1298 | * Parameters:
1299 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1300 | * - _bool_ `$is_public` __Required: Optional__. Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo.
1301 | *
1302 | *
1303 | * @method static self setBusinessAccountGiftSettings(...$parameters) Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success.
1304 | *
1305 | * {@see https://core.telegram.org/bots/api#setbusinessaccountgiftsettings}
1306 | *
1307 | * Parameters:
1308 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1309 | * - _bool_ `$show_gift_button` __Required: Yes__. Pass True, if a button for sending a gift to the user or by the business account must always be shown in the input field
1310 | * - _AcceptedGiftTypes_ `$accepted_gift_types` __Required: Yes__. Types of gifts accepted by the business account
1311 | *
1312 | *
1313 | * @method static self getBusinessAccountStarBalance(...$parameters) Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success.
1314 | *
1315 | * {@see https://core.telegram.org/bots/api#getbusinessaccountstarbalance}
1316 | *
1317 | * Parameters:
1318 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1319 | *
1320 | *
1321 | * @method static self transferBusinessAccountStars(...$parameters) Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success.
1322 | *
1323 | * {@see https://core.telegram.org/bots/api#transferbusinessaccountstars}
1324 | *
1325 | * Parameters:
1326 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1327 | * - _int_ `$star_count` __Required: Yes__. Number of Telegram Stars to transfer; 1-10000
1328 | *
1329 | *
1330 | * @method static self getBusinessAccountGifts(...$parameters) Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success.
1331 | *
1332 | * {@see https://core.telegram.org/bots/api#getbusinessaccountgifts}
1333 | *
1334 | * Parameters:
1335 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1336 | * - _bool_ `$exclude_unsaved` __Required: Optional__. Pass True to exclude gifts that aren't saved to the account's profile page
1337 | * - _bool_ `$exclude_saved` __Required: Optional__. Pass True to exclude gifts that are saved to the account's profile page
1338 | * - _bool_ `$exclude_unlimited` __Required: Optional__. Pass True to exclude gifts that can be purchased an unlimited number of times
1339 | * - _bool_ `$exclude_limited` __Required: Optional__. Pass True to exclude gifts that can be purchased a limited number of times
1340 | * - _bool_ `$exclude_unique` __Required: Optional__. Pass True to exclude unique gifts
1341 | * - _bool_ `$sort_by_price` __Required: Optional__. Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
1342 | * - _string_ `$offset` __Required: Optional__. Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results
1343 | * - _int_ `$limit` __Required: Optional__. The maximum number of gifts to be returned; 1-100. Defaults to 100
1344 | *
1345 | *
1346 | * @method static self convertGiftToStars(...$parameters) Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success.
1347 | *
1348 | * {@see https://core.telegram.org/bots/api#convertgifttostars}
1349 | *
1350 | * Parameters:
1351 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1352 | * - _string_ `$owned_gift_id` __Required: Yes__. Unique identifier of the regular gift that should be converted to Telegram Stars
1353 | *
1354 | *
1355 | * @method static self upgradeGift(...$parameters) Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success.
1356 | *
1357 | * {@see https://core.telegram.org/bots/api#upgradegift}
1358 | *
1359 | * Parameters:
1360 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1361 | * - _string_ `$owned_gift_id` __Required: Yes__. Unique identifier of the regular gift that should be upgraded to a unique one
1362 | * - _bool_ `$keep_original_details` __Required: Optional__. Pass True to keep the original gift text, sender and receiver in the upgraded gift
1363 | * - _int_ `$star_count` __Required: Optional__. The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If gift.prepaid_upgrade_star_count > 0, then pass 0, otherwise, the can_transfer_stars business bot right is required and gift.upgrade_star_count must be passed.
1364 | *
1365 | *
1366 | * @method static self transferGift(...$parameters) Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires can_transfer_stars business bot right if the transfer is paid. Returns True on success.
1367 | *
1368 | * {@see https://core.telegram.org/bots/api#transfergift}
1369 | *
1370 | * Parameters:
1371 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1372 | * - _string_ `$owned_gift_id` __Required: Yes__. Unique identifier of the regular gift that should be transferred
1373 | * - _int_ `$new_owner_chat_id` __Required: Yes__. Unique identifier of the chat which will own the gift. The chat must be active in the last 24 hours.
1374 | * - _int_ `$star_count` __Required: Optional__. The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the can_transfer_stars business bot right is required.
1375 | *
1376 | *
1377 | * @method static self postStory(...$parameters) Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.
1378 | *
1379 | * {@see https://core.telegram.org/bots/api#poststory}
1380 | *
1381 | * Parameters:
1382 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1383 | * - _InputStoryContent_ `$content` __Required: Yes__. Content of the story
1384 | * - _int_ `$active_period` __Required: Yes__. Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400
1385 | * - _string_ `$caption` __Required: Optional__. Caption of the story, 0-2048 characters after entities parsing
1386 | * - _string_ `$parse_mode` __Required: Optional__. Mode for parsing entities in the story caption. See formatting options for more details.
1387 | * - _MessageEntity[]_ `$caption_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
1388 | * - _StoryArea[]_ `$areas` __Required: Optional__. A JSON-serialized list of clickable areas to be shown on the story
1389 | * - _bool_ `$post_to_chat_page` __Required: Optional__. Pass True to keep the story accessible after it expires
1390 | * - _bool_ `$protect_content` __Required: Optional__. Pass True if the content of the story must be protected from forwarding and screenshotting
1391 | *
1392 | *
1393 | * @method static self editStory(...$parameters) Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.
1394 | *
1395 | * {@see https://core.telegram.org/bots/api#editstory}
1396 | *
1397 | * Parameters:
1398 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1399 | * - _int_ `$story_id` __Required: Yes__. Unique identifier of the story to edit
1400 | * - _InputStoryContent_ `$content` __Required: Yes__. Content of the story
1401 | * - _string_ `$caption` __Required: Optional__. Caption of the story, 0-2048 characters after entities parsing
1402 | * - _string_ `$parse_mode` __Required: Optional__. Mode for parsing entities in the story caption. See formatting options for more details.
1403 | * - _MessageEntity[]_ `$caption_entities` __Required: Optional__. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
1404 | * - _StoryArea[]_ `$areas` __Required: Optional__. A JSON-serialized list of clickable areas to be shown on the story
1405 | *
1406 | *
1407 | * @method static self deleteStory(...$parameters) Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success.
1408 | *
1409 | * {@see https://core.telegram.org/bots/api#deletestory}
1410 | *
1411 | * Parameters:
1412 | * - _string_ `$business_connection_id` __Required: Yes__. Unique identifier of the business connection
1413 | * - _int_ `$story_id` __Required: Yes__. Unique identifier of the story to delete
1414 | *
1415 | *
1416 | * @method static self sendSticker(...$parameters) Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers. On success, the sent Message is returned.
1417 | *
1418 | * {@see https://core.telegram.org/bots/api#sendsticker}
1419 | *
1420 | * Parameters:
1421 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
1422 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1423 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
1424 | * - _InputFile|string_ `$sticker` __Required: Yes__. Sticker to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data. More information on Sending Files ». Video and animated stickers can't be sent via an HTTP URL.
1425 | * - _string_ `$emoji` __Required: Optional__. Emoji associated with the sticker; only for just uploaded stickers
1426 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
1427 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
1428 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
1429 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
1430 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
1431 | * - _InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply_ `$reply_markup` __Required: Optional__. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
1432 | *
1433 | *
1434 | * @method static self getStickerSet(...$parameters) Use this method to get a sticker set. On success, a StickerSet object is returned.
1435 | *
1436 | * {@see https://core.telegram.org/bots/api#getstickerset}
1437 | *
1438 | * Parameters:
1439 | * - _string_ `$name` __Required: Yes__. Name of the sticker set
1440 | *
1441 | *
1442 | * @method static self getCustomEmojiStickers(...$parameters) Use this method to get information about custom emoji stickers by their identifiers. Returns an Array of Sticker objects.
1443 | *
1444 | * {@see https://core.telegram.org/bots/api#getcustomemojistickers}
1445 | *
1446 | * Parameters:
1447 | * - _string[]_ `$custom_emoji_ids` __Required: Yes__. A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.
1448 | *
1449 | *
1450 | * @method static self uploadStickerFile(...$parameters) Use this method to upload a file with a sticker for later use in the createNewStickerSet, addStickerToSet, or replaceStickerInSet methods (the file can be used multiple times). Returns the uploaded File on success.
1451 | *
1452 | * {@see https://core.telegram.org/bots/api#uploadstickerfile}
1453 | *
1454 | * Parameters:
1455 | * - _int_ `$user_id` __Required: Yes__. User identifier of sticker file owner
1456 | * - _InputFile_ `$sticker` __Required: Yes__. A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. More information on Sending Files »
1457 | * - _string_ `$sticker_format` __Required: Yes__. Format of the sticker, must be one of “static”, “animated”, “video”
1458 | *
1459 | *
1460 | * @method static self createNewStickerSet(...$parameters) Use this method to create a new sticker set owned by a user. The bot will be able to edit the sticker set thus created. Returns True on success.
1461 | *
1462 | * {@see https://core.telegram.org/bots/api#createnewstickerset}
1463 | *
1464 | * Parameters:
1465 | * - _int_ `$user_id` __Required: Yes__. User identifier of created sticker set owner
1466 | * - _string_ `$name` __Required: Yes__. Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_". is case insensitive. 1-64 characters.
1467 | * - _string_ `$title` __Required: Yes__. Sticker set title, 1-64 characters
1468 | * - _InputSticker[]_ `$stickers` __Required: Yes__. A JSON-serialized list of 1-50 initial stickers to be added to the sticker set
1469 | * - _string_ `$sticker_type` __Required: Optional__. Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created.
1470 | * - _bool_ `$needs_repainting` __Required: Optional__. Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only
1471 | *
1472 | *
1473 | * @method static self addStickerToSet(...$parameters) Use this method to add a new sticker to a set created by the bot. Emoji sticker sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers. Returns True on success.
1474 | *
1475 | * {@see https://core.telegram.org/bots/api#addstickertoset}
1476 | *
1477 | * Parameters:
1478 | * - _int_ `$user_id` __Required: Yes__. User identifier of sticker set owner
1479 | * - _string_ `$name` __Required: Yes__. Sticker set name
1480 | * - _InputSticker_ `$sticker` __Required: Yes__. A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.
1481 | *
1482 | *
1483 | * @method static self setStickerPositionInSet(...$parameters) Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.
1484 | *
1485 | * {@see https://core.telegram.org/bots/api#setstickerpositioninset}
1486 | *
1487 | * Parameters:
1488 | * - _string_ `$sticker` __Required: Yes__. File identifier of the sticker
1489 | * - _int_ `$position` __Required: Yes__. New sticker position in the set, zero-based
1490 | *
1491 | *
1492 | * @method static self deleteStickerFromSet(...$parameters) Use this method to delete a sticker from a set created by the bot. Returns True on success.
1493 | *
1494 | * {@see https://core.telegram.org/bots/api#deletestickerfromset}
1495 | *
1496 | * Parameters:
1497 | * - _string_ `$sticker` __Required: Yes__. File identifier of the sticker
1498 | *
1499 | *
1500 | * @method static self replaceStickerInSet(...$parameters) Use this method to replace an existing sticker in a sticker set with a new one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet, then setStickerPositionInSet. Returns True on success.
1501 | *
1502 | * {@see https://core.telegram.org/bots/api#replacestickerinset}
1503 | *
1504 | * Parameters:
1505 | * - _int_ `$user_id` __Required: Yes__. User identifier of the sticker set owner
1506 | * - _string_ `$name` __Required: Yes__. Sticker set name
1507 | * - _string_ `$old_sticker` __Required: Yes__. File identifier of the replaced sticker
1508 | * - _InputSticker_ `$sticker` __Required: Yes__. A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.
1509 | *
1510 | *
1511 | * @method static self setStickerEmojiList(...$parameters) Use this method to change the list of emoji assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.
1512 | *
1513 | * {@see https://core.telegram.org/bots/api#setstickeremojilist}
1514 | *
1515 | * Parameters:
1516 | * - _string_ `$sticker` __Required: Yes__. File identifier of the sticker
1517 | * - _string[]_ `$emoji_list` __Required: Yes__. A JSON-serialized list of 1-20 emoji associated with the sticker
1518 | *
1519 | *
1520 | * @method static self setStickerKeywords(...$parameters) Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.
1521 | *
1522 | * {@see https://core.telegram.org/bots/api#setstickerkeywords}
1523 | *
1524 | * Parameters:
1525 | * - _string_ `$sticker` __Required: Yes__. File identifier of the sticker
1526 | * - _string[]_ `$keywords` __Required: Optional__. A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
1527 | *
1528 | *
1529 | * @method static self setStickerMaskPosition(...$parameters) Use this method to change the mask position of a mask sticker. The sticker must belong to a sticker set that was created by the bot. Returns True on success.
1530 | *
1531 | * {@see https://core.telegram.org/bots/api#setstickermaskposition}
1532 | *
1533 | * Parameters:
1534 | * - _string_ `$sticker` __Required: Yes__. File identifier of the sticker
1535 | * - _MaskPosition_ `$mask_position` __Required: Optional__. A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.
1536 | *
1537 | *
1538 | * @method static self setStickerSetTitle(...$parameters) Use this method to set the title of a created sticker set. Returns True on success.
1539 | *
1540 | * {@see https://core.telegram.org/bots/api#setstickersettitle}
1541 | *
1542 | * Parameters:
1543 | * - _string_ `$name` __Required: Yes__. Sticker set name
1544 | * - _string_ `$title` __Required: Yes__. Sticker set title, 1-64 characters
1545 | *
1546 | *
1547 | * @method static self setStickerSetThumbnail(...$parameters) Use this method to set the thumbnail of a regular or mask sticker set. The format of the thumbnail file must match the format of the stickers in the set. Returns True on success.
1548 | *
1549 | * {@see https://core.telegram.org/bots/api#setstickersetthumbnail}
1550 | *
1551 | * Parameters:
1552 | * - _string_ `$name` __Required: Yes__. Sticker set name
1553 | * - _int_ `$user_id` __Required: Yes__. User identifier of the sticker set owner
1554 | * - _InputFile|string_ `$thumbnail` __Required: Optional__. A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a .WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
1555 | * - _string_ `$format` __Required: Yes__. Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a .WEBM video
1556 | *
1557 | *
1558 | * @method static self setCustomEmojiStickerSetThumbnail(...$parameters) Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.
1559 | *
1560 | * {@see https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail}
1561 | *
1562 | * Parameters:
1563 | * - _string_ `$name` __Required: Yes__. Sticker set name
1564 | * - _string_ `$custom_emoji_id` __Required: Optional__. Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
1565 | *
1566 | *
1567 | * @method static self deleteStickerSet(...$parameters) Use this method to delete a sticker set that was created by the bot. Returns True on success.
1568 | *
1569 | * {@see https://core.telegram.org/bots/api#deletestickerset}
1570 | *
1571 | * Parameters:
1572 | * - _string_ `$name` __Required: Yes__. Sticker set name
1573 | *
1574 | *
1575 | * @method static self answerInlineQuery(...$parameters) Use this method to send answers to an inline query. On success, True is returned.No more than 50 results per query are allowed.
1576 | *
1577 | * {@see https://core.telegram.org/bots/api#answerinlinequery}
1578 | *
1579 | * Parameters:
1580 | * - _string_ `$inline_query_id` __Required: Yes__. Unique identifier for the answered query
1581 | * - _InlineQueryResult[]_ `$results` __Required: Yes__. A JSON-serialized array of results for the inline query
1582 | * - _int_ `$cache_time` __Required: Optional__. The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
1583 | * - _bool_ `$is_personal` __Required: Optional__. Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.
1584 | * - _string_ `$next_offset` __Required: Optional__. Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.
1585 | * - _InlineQueryResultsButton_ `$button` __Required: Optional__. A JSON-serialized object describing a button to be shown above inline query results
1586 | *
1587 | *
1588 | * @method static self answerWebAppQuery(...$parameters) Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.
1589 | *
1590 | * {@see https://core.telegram.org/bots/api#answerwebappquery}
1591 | *
1592 | * Parameters:
1593 | * - _string_ `$web_app_query_id` __Required: Yes__. Unique identifier for the query to be answered
1594 | * - _InlineQueryResult_ `$result` __Required: Yes__. A JSON-serialized object describing the message to be sent
1595 | *
1596 | *
1597 | * @method static self savePreparedInlineMessage(...$parameters) Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
1598 | *
1599 | * {@see https://core.telegram.org/bots/api#savepreparedinlinemessage}
1600 | *
1601 | * Parameters:
1602 | * - _int_ `$user_id` __Required: Yes__. Unique identifier of the target user that can use the prepared message
1603 | * - _InlineQueryResult_ `$result` __Required: Yes__. A JSON-serialized object describing the message to be sent
1604 | * - _bool_ `$allow_user_chats` __Required: Optional__. Pass True if the message can be sent to private chats with users
1605 | * - _bool_ `$allow_bot_chats` __Required: Optional__. Pass True if the message can be sent to private chats with bots
1606 | * - _bool_ `$allow_group_chats` __Required: Optional__. Pass True if the message can be sent to group and supergroup chats
1607 | * - _bool_ `$allow_channel_chats` __Required: Optional__. Pass True if the message can be sent to channel chats
1608 | *
1609 | *
1610 | * @method static self sendInvoice(...$parameters) Use this method to send invoices. On success, the sent Message is returned.
1611 | *
1612 | * {@see https://core.telegram.org/bots/api#sendinvoice}
1613 | *
1614 | * Parameters:
1615 | * - _int|string_ `$chat_id` __Required: Yes__. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
1616 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
1617 | * - _string_ `$title` __Required: Yes__. Product name, 1-32 characters
1618 | * - _string_ `$description` __Required: Yes__. Product description, 1-255 characters
1619 | * - _string_ `$payload` __Required: Yes__. Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
1620 | * - _string_ `$provider_token` __Required: Optional__. Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
1621 | * - _string_ `$currency` __Required: Yes__. Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars.
1622 | * - _LabeledPrice[]_ `$prices` __Required: Yes__. Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.
1623 | * - _int_ `$max_tip_amount` __Required: Optional__. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars.
1624 | * - _int[]_ `$suggested_tip_amounts` __Required: Optional__. A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
1625 | * - _string_ `$start_parameter` __Required: Optional__. Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter
1626 | * - _string_ `$provider_data` __Required: Optional__. JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
1627 | * - _string_ `$photo_url` __Required: Optional__. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.
1628 | * - _int_ `$photo_size` __Required: Optional__. Photo size in bytes
1629 | * - _int_ `$photo_width` __Required: Optional__. Photo width
1630 | * - _int_ `$photo_height` __Required: Optional__. Photo height
1631 | * - _bool_ `$need_name` __Required: Optional__. Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars.
1632 | * - _bool_ `$need_phone_number` __Required: Optional__. Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars.
1633 | * - _bool_ `$need_email` __Required: Optional__. Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars.
1634 | * - _bool_ `$need_shipping_address` __Required: Optional__. Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars.
1635 | * - _bool_ `$send_phone_number_to_provider` __Required: Optional__. Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars.
1636 | * - _bool_ `$send_email_to_provider` __Required: Optional__. Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars.
1637 | * - _bool_ `$is_flexible` __Required: Optional__. Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars.
1638 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
1639 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
1640 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
1641 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
1642 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
1643 | * - _InlineKeyboardMarkup_ `$reply_markup` __Required: Optional__. A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button.
1644 | *
1645 | *
1646 | * @method static self createInvoiceLink(...$parameters) Use this method to create a link for an invoice. Returns the created invoice link as String on success.
1647 | *
1648 | * {@see https://core.telegram.org/bots/api#createinvoicelink}
1649 | *
1650 | * Parameters:
1651 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the link will be created. For payments in Telegram Stars only.
1652 | * - _string_ `$title` __Required: Yes__. Product name, 1-32 characters
1653 | * - _string_ `$description` __Required: Yes__. Product description, 1-255 characters
1654 | * - _string_ `$payload` __Required: Yes__. Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
1655 | * - _string_ `$provider_token` __Required: Optional__. Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
1656 | * - _string_ `$currency` __Required: Yes__. Three-letter ISO 4217 currency code, see more on currencies. Pass “XTR” for payments in Telegram Stars.
1657 | * - _LabeledPrice[]_ `$prices` __Required: Yes__. Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in Telegram Stars.
1658 | * - _int_ `$subscription_period` __Required: Optional__. The number of seconds the subscription will be active for before the next payment. The currency must be set to “XTR” (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified. Any number of subscriptions can be active for a given bot at the same time, including multiple concurrent subscriptions from the same user. Subscription price must no exceed 10000 Telegram Stars.
1659 | * - _int_ `$max_tip_amount` __Required: Optional__. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in Telegram Stars.
1660 | * - _int[]_ `$suggested_tip_amounts` __Required: Optional__. A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
1661 | * - _string_ `$provider_data` __Required: Optional__. JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
1662 | * - _string_ `$photo_url` __Required: Optional__. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.
1663 | * - _int_ `$photo_size` __Required: Optional__. Photo size in bytes
1664 | * - _int_ `$photo_width` __Required: Optional__. Photo width
1665 | * - _int_ `$photo_height` __Required: Optional__. Photo height
1666 | * - _bool_ `$need_name` __Required: Optional__. Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars.
1667 | * - _bool_ `$need_phone_number` __Required: Optional__. Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars.
1668 | * - _bool_ `$need_email` __Required: Optional__. Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars.
1669 | * - _bool_ `$need_shipping_address` __Required: Optional__. Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars.
1670 | * - _bool_ `$send_phone_number_to_provider` __Required: Optional__. Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars.
1671 | * - _bool_ `$send_email_to_provider` __Required: Optional__. Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars.
1672 | * - _bool_ `$is_flexible` __Required: Optional__. Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars.
1673 | *
1674 | *
1675 | * @method static self answerShippingQuery(...$parameters) If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the Bot API will send an Update with a shipping_query field to the bot. Use this method to reply to shipping queries. On success, True is returned.
1676 | *
1677 | * {@see https://core.telegram.org/bots/api#answershippingquery}
1678 | *
1679 | * Parameters:
1680 | * - _string_ `$shipping_query_id` __Required: Yes__. Unique identifier for the query to be answered
1681 | * - _bool_ `$ok` __Required: Yes__. Pass True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)
1682 | * - _ShippingOption[]_ `$shipping_options` __Required: Optional__. Required if ok is True. A JSON-serialized array of available shipping options.
1683 | * - _string_ `$error_message` __Required: Optional__. Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. “Sorry, delivery to your desired address is unavailable”). Telegram will display this message to the user.
1684 | *
1685 | *
1686 | * @method static self answerPreCheckoutQuery(...$parameters) Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
1687 | *
1688 | * {@see https://core.telegram.org/bots/api#answerprecheckoutquery}
1689 | *
1690 | * Parameters:
1691 | * - _string_ `$pre_checkout_query_id` __Required: Yes__. Unique identifier for the query to be answered
1692 | * - _bool_ `$ok` __Required: Yes__. Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.
1693 | * - _string_ `$error_message` __Required: Optional__. Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
1694 | *
1695 | *
1696 | * @method static self getStarTransactions(...$parameters) Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.
1697 | *
1698 | * {@see https://core.telegram.org/bots/api#getstartransactions}
1699 | *
1700 | * Parameters:
1701 | * - _int_ `$offset` __Required: Optional__. Number of transactions to skip in the response
1702 | * - _int_ `$limit` __Required: Optional__. The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.
1703 | *
1704 | *
1705 | * @method static self refundStarPayment(...$parameters) Refunds a successful payment in Telegram Stars. Returns True on success.
1706 | *
1707 | * {@see https://core.telegram.org/bots/api#refundstarpayment}
1708 | *
1709 | * Parameters:
1710 | * - _int_ `$user_id` __Required: Yes__. Identifier of the user whose payment will be refunded
1711 | * - _string_ `$telegram_payment_charge_id` __Required: Yes__. Telegram payment identifier
1712 | *
1713 | *
1714 | * @method static self editUserStarSubscription(...$parameters) Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.
1715 | *
1716 | * {@see https://core.telegram.org/bots/api#edituserstarsubscription}
1717 | *
1718 | * Parameters:
1719 | * - _int_ `$user_id` __Required: Yes__. Identifier of the user whose subscription will be edited
1720 | * - _string_ `$telegram_payment_charge_id` __Required: Yes__. Telegram payment identifier for the subscription
1721 | * - _bool_ `$is_canceled` __Required: Yes__. Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.
1722 | *
1723 | *
1724 | * @method static self setPassportDataErrors(...$parameters) Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.
1725 | *
1726 | * Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.
1727 | *
1728 | * {@see https://core.telegram.org/bots/api#setpassportdataerrors}
1729 | *
1730 | * Parameters:
1731 | * - _int_ `$user_id` __Required: Yes__. User identifier
1732 | * - _PassportElementError[]_ `$errors` __Required: Yes__. A JSON-serialized array describing the errors
1733 | *
1734 | *
1735 | * @method static self sendGame(...$parameters) Use this method to send a game. On success, the sent Message is returned.
1736 | *
1737 | * {@see https://core.telegram.org/bots/api#sendgame}
1738 | *
1739 | * Parameters:
1740 | * - _string_ `$business_connection_id` __Required: Optional__. Unique identifier of the business connection on behalf of which the message will be sent
1741 | * - _int_ `$chat_id` __Required: Yes__. Unique identifier for the target chat
1742 | * - _int_ `$message_thread_id` __Required: Optional__. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
1743 | * - _string_ `$game_short_name` __Required: Yes__. Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather.
1744 | * - _bool_ `$disable_notification` __Required: Optional__. Sends the message silently. Users will receive a notification with no sound.
1745 | * - _bool_ `$protect_content` __Required: Optional__. Protects the contents of the sent message from forwarding and saving
1746 | * - _bool_ `$allow_paid_broadcast` __Required: Optional__. Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
1747 | * - _string_ `$message_effect_id` __Required: Optional__. Unique identifier of the message effect to be added to the message; for private chats only
1748 | * - _ReplyParameters_ `$reply_parameters` __Required: Optional__. Description of the message to reply to
1749 | * - _InlineKeyboardMarkup_ `$reply_markup` __Required: Optional__. A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game.
1750 | *
1751 | *
1752 | * @method static self setGameScore(...$parameters) Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
1753 | *
1754 | * {@see https://core.telegram.org/bots/api#setgamescore}
1755 | *
1756 | * Parameters:
1757 | * - _int_ `$user_id` __Required: Yes__. User identifier
1758 | * - _int_ `$score` __Required: Yes__. New score, must be non-negative
1759 | * - _bool_ `$force` __Required: Optional__. Pass True if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters
1760 | * - _bool_ `$disable_edit_message` __Required: Optional__. Pass True if the game message should not be automatically edited to include the current scoreboard
1761 | * - _int_ `$chat_id` __Required: Optional__. Required if inline_message_id is not specified. Unique identifier for the target chat
1762 | * - _int_ `$message_id` __Required: Optional__. Required if inline_message_id is not specified. Identifier of the sent message
1763 | * - _string_ `$inline_message_id` __Required: Optional__. Required if chat_id and message_id are not specified. Identifier of the inline message
1764 | *
1765 | *
1766 | * @method static self getGameHighScores(...$parameters) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. Returns an Array of GameHighScore objects.
1767 | *
1768 | * {@see https://core.telegram.org/bots/api#getgamehighscores}
1769 | *
1770 | * Parameters:
1771 | * - _int_ `$user_id` __Required: Yes__. Target user id
1772 | * - _int_ `$chat_id` __Required: Optional__. Required if inline_message_id is not specified. Unique identifier for the target chat
1773 | * - _int_ `$message_id` __Required: Optional__. Required if inline_message_id is not specified. Identifier of the sent message
1774 | * - _string_ `$inline_message_id` __Required: Optional__. Required if chat_id and message_id are not specified. Identifier of the inline message
1775 | */
1776 | class TelegramNotification implements \JsonSerializable, \Stringable
1777 | {
1778 | use \WeStacks\TeleBot\Foundation\HasTelegramMethods;
1779 |
1780 | protected $data;
1781 |
1782 | /**
1783 | * Create new notification instance.
1784 | *
1785 | * @param string|null $data JSON data object representation
1786 | */
1787 | public function __construct(?string $data = null)
1788 | {
1789 | $this->data = $data ? json_decode($data, true) : [
1790 | 'bot' => null,
1791 | 'actions' => [],
1792 | ];
1793 | }
1794 |
1795 | public static function __callStatic(string $name, array $arguments)
1796 | {
1797 | return (new static())->$name(...$arguments);
1798 | }
1799 |
1800 | public function __call(string $method, array $arguments)
1801 | {
1802 | if (! static::method($method)) {
1803 | throw new \BadMethodCallException('Method "'.$method.'" does not exist.');
1804 | }
1805 |
1806 | $this->data['actions'][] = [
1807 | 'method' => $method,
1808 | 'arguments' => is_array($arguments[0]) ? $arguments[0] : [],
1809 | ];
1810 |
1811 | return $this;
1812 | }
1813 |
1814 | /**
1815 | * Set bot to send notification.
1816 | *
1817 | * @return self
1818 | */
1819 | public function bot(string $bot)
1820 | {
1821 | $this->data['bot'] = $bot;
1822 |
1823 | return $this;
1824 | }
1825 |
1826 | #[\ReturnTypeWillChange]
1827 | public function jsonSerialize()
1828 | {
1829 | return $this->data;
1830 | }
1831 |
1832 | public function __toString(): string
1833 | {
1834 | return (string) json_encode($this->data);
1835 | }
1836 | }
1837 |
--------------------------------------------------------------------------------
/src/Providers/TeleBotServiceProvider.php:
--------------------------------------------------------------------------------
1 | loadViewsFrom(__DIR__.'/../../views', 'telebot');
19 | $this->loadRoutesFrom(__DIR__.'/../../routes/telebot.php');
20 | $this->mergeConfigFrom(__DIR__.'/../../config/telebot.php', 'telebot');
21 |
22 | $this->publishes([
23 | __DIR__.'/../../config/telebot.php' => $this->app->configPath('telebot.php'),
24 | ], 'config');
25 |
26 | $this->publishes([
27 | __DIR__.'/../../views' => $this->app->resourcePath('views/vendor/telebot'),
28 | ], 'views');
29 | }
30 |
31 | public function register()
32 | {
33 | $this->commands([
34 | \WeStacks\TeleBot\Laravel\Artisan\WebhookCommand::class,
35 | \WeStacks\TeleBot\Laravel\Artisan\LongPollCommad::class,
36 | \WeStacks\TeleBot\Laravel\Artisan\CommandsCommand::class,
37 | \WeStacks\TeleBot\Laravel\Artisan\InstallCommand::class,
38 | \WeStacks\TeleBot\Laravel\Artisan\MakeKernelCommand::class,
39 | \WeStacks\TeleBot\Laravel\Artisan\MakeCommandHandlerCommand::class,
40 | \WeStacks\TeleBot\Laravel\Artisan\MakeCallbackHandlerCommand::class,
41 | \WeStacks\TeleBot\Laravel\Artisan\MakeRequestInputHandlerCommand::class,
42 | ]);
43 |
44 | $this->app->scoped(BotManager::class, fn () => new BotManager(config('telebot.bots', []), config('telebot.default')));
45 | $this->app->alias(BotManager::class, 'telebot');
46 |
47 | Notification::resolved(
48 | fn (ChannelManager $service) =>
49 | $service->extend('telegram', fn ($app) => $app->make(TelegramChannel::class))
50 | );
51 |
52 | Request::macro(
53 | 'telegramWebAppUser',
54 | fn (?string $key = null, $default = null) =>
55 | Arr::get(app(TelegramWebAppService::class)->user(), $key, $default)
56 | );
57 | }
58 |
59 | public function provides()
60 | {
61 | return [BotManager::class, 'telebot'];
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/Requests/UpdateRequest.php:
--------------------------------------------------------------------------------
1 | isMethod('post') &&
32 | $this->isJson() &&
33 | $this->validToken() &&
34 | $this->validSecret();
35 | }
36 |
37 | private function validToken()
38 | {
39 | $bot = $this->route('bot');
40 | $token = $this->route('token');
41 |
42 | $config = config("telebot.bots.$bot");
43 | $realToken = $config['token'] ?? $config;
44 |
45 | return $token === $realToken;
46 | }
47 |
48 | private function validSecret()
49 | {
50 | $bot = $this->route('bot');
51 |
52 | $secret = $this->header('X-Telegram-Bot-Api-Secret-Token');
53 | $token = config("telebot.bots.$bot.webhook.secret_token");
54 |
55 | return $secret === $token;
56 | }
57 |
58 | protected function onlyOnePresent(string $type)
59 | {
60 | $types = implode(',', array_filter($this->types, fn ($value) => $value !== $type));
61 |
62 | return "required_without_all:$types|prohibits:$types";
63 | }
64 |
65 | protected function prepareForValidation()
66 | {
67 | // Crutch to prevent any data modifications from Laravel
68 | // For now, Laravel not allowing to disable global middleware per request,
69 | // so we can't ignore middlewares like: ConvertEmptyStringsToNull, TrimStrings etc.
70 | $this->merge(json_decode($this->getContent(), true));
71 | }
72 |
73 | public function rules()
74 | {
75 | return collect($this->types)
76 | ->mapWithKeys(fn ($type) => [$type => [$this->onlyOnePresent($type), 'array']])
77 | ->prepend(['required', 'numeric'], 'update_id')
78 | ->toArray();
79 | }
80 |
81 | public function update()
82 | {
83 | if (empty($this->update)) {
84 | $this->update = Update::from($this->validated());
85 | }
86 |
87 | return $this->update;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/src/Services/TelegramWebAppService.php:
--------------------------------------------------------------------------------
1 | request->header('X-Telegram-Web-App')) {
18 | return null;
19 | }
20 |
21 | return collect(explode('&', urldecode($data)))
22 | ->mapWithKeys(function ($value) {
23 | [$key, $val] = explode('=', $value);
24 |
25 | return [$key => $val];
26 | });
27 | }
28 |
29 | public function validCredentials(string $bot): bool
30 | {
31 | if (! $credentials = $this->getCredentials()) {
32 | return false;
33 | }
34 |
35 | $hash = $credentials->get('hash');
36 |
37 | $data_check_string = $credentials->except('hash')
38 | ->sortKeys()
39 | ->transform(fn ($val, $key) => "$key=$val")
40 | ->join("\n");
41 |
42 | $secret_key = hash_hmac('sha256', preg_replace("/\/test$/", '', config("telebot.bots.$bot.token")), 'WebAppData', true);
43 | $hash_hmac = bin2hex(hash_hmac('sha256', $data_check_string, $secret_key, true));
44 |
45 | return $hash === $hash_hmac;
46 | }
47 |
48 | public function user(): ?array
49 | {
50 | if (! $credentials = $this->getCredentials()) {
51 | return null;
52 | }
53 |
54 | return json_decode($credentials->get('user'), true);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/stubs/callback-handler.stub:
--------------------------------------------------------------------------------
1 | accept();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/stubs/update-handler.stub:
--------------------------------------------------------------------------------
1 | {{ $app }} {{ $level_name }} ({{ $env }}):
2 | {{ $formatted }}
--------------------------------------------------------------------------------
/views/webapp.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | @stack('scripts')
11 | @stack('styles')
12 |
13 | @yield('title', config('app.name'))
14 |
15 |
16 | @yield('template')
17 |
18 |
19 |
--------------------------------------------------------------------------------