• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vjik / telegram-bot-api / 14511512774

17 Apr 2025 08:32AM UTC coverage: 99.907% (-0.09%) from 100.0%
14511512774

Pull #155

github

web-flow
Merge 63c485155 into f22eec9d4
Pull Request #155: Native transport

158 of 164 new or added lines in 7 files covered. (96.34%)

6444 of 6450 relevant lines covered (99.91%)

27.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

99.45
/src/TelegramBotApi.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Vjik\TelegramBot\Api;
6

7
use DateTimeImmutable;
8
use DateTimeInterface;
9
use LogicException;
10
use Psr\Log\LoggerInterface;
11
use SensitiveParameter;
12
use Vjik\TelegramBot\Api\Method\AnswerCallbackQuery;
13
use Vjik\TelegramBot\Api\Method\ApproveChatJoinRequest;
14
use Vjik\TelegramBot\Api\Method\BanChatMember;
15
use Vjik\TelegramBot\Api\Method\BanChatSenderChat;
16
use Vjik\TelegramBot\Api\Method\Close;
17
use Vjik\TelegramBot\Api\Method\CloseForumTopic;
18
use Vjik\TelegramBot\Api\Method\CloseGeneralForumTopic;
19
use Vjik\TelegramBot\Api\Method\ConvertGiftToStars;
20
use Vjik\TelegramBot\Api\Method\CopyMessage;
21
use Vjik\TelegramBot\Api\Method\CopyMessages;
22
use Vjik\TelegramBot\Api\Method\CreateChatInviteLink;
23
use Vjik\TelegramBot\Api\Method\CreateChatSubscriptionInviteLink;
24
use Vjik\TelegramBot\Api\Method\CreateForumTopic;
25
use Vjik\TelegramBot\Api\Method\DeclineChatJoinRequest;
26
use Vjik\TelegramBot\Api\Method\DeleteChatPhoto;
27
use Vjik\TelegramBot\Api\Method\DeleteChatStickerSet;
28
use Vjik\TelegramBot\Api\Method\DeleteForumTopic;
29
use Vjik\TelegramBot\Api\Method\DeleteMyCommands;
30
use Vjik\TelegramBot\Api\Method\DeleteStory;
31
use Vjik\TelegramBot\Api\Method\EditChatInviteLink;
32
use Vjik\TelegramBot\Api\Method\EditChatSubscriptionInviteLink;
33
use Vjik\TelegramBot\Api\Method\EditForumTopic;
34
use Vjik\TelegramBot\Api\Method\EditGeneralForumTopic;
35
use Vjik\TelegramBot\Api\Method\EditStory;
36
use Vjik\TelegramBot\Api\Method\ExportChatInviteLink;
37
use Vjik\TelegramBot\Api\Method\ForwardMessage;
38
use Vjik\TelegramBot\Api\Method\ForwardMessages;
39
use Vjik\TelegramBot\Api\Method\Game\GetGameHighScores;
40
use Vjik\TelegramBot\Api\Method\Game\SendGame;
41
use Vjik\TelegramBot\Api\Method\Game\SetGameScore;
42
use Vjik\TelegramBot\Api\Method\GetBusinessAccountGifts;
43
use Vjik\TelegramBot\Api\Method\GetBusinessAccountStarBalance;
44
use Vjik\TelegramBot\Api\Method\GetBusinessConnection;
45
use Vjik\TelegramBot\Api\Method\GetChat;
46
use Vjik\TelegramBot\Api\Method\GetChatAdministrators;
47
use Vjik\TelegramBot\Api\Method\GetChatMember;
48
use Vjik\TelegramBot\Api\Method\GetChatMemberCount;
49
use Vjik\TelegramBot\Api\Method\GetChatMenuButton;
50
use Vjik\TelegramBot\Api\Method\GetFile;
51
use Vjik\TelegramBot\Api\Method\GetForumTopicIconStickers;
52
use Vjik\TelegramBot\Api\Method\GetMe;
53
use Vjik\TelegramBot\Api\Method\GetMyCommands;
54
use Vjik\TelegramBot\Api\Method\GetMyDefaultAdministratorRights;
55
use Vjik\TelegramBot\Api\Method\GetMyDescription;
56
use Vjik\TelegramBot\Api\Method\GetMyName;
57
use Vjik\TelegramBot\Api\Method\GetMyShortDescription;
58
use Vjik\TelegramBot\Api\Method\GetUserChatBoosts;
59
use Vjik\TelegramBot\Api\Method\GetUserProfilePhotos;
60
use Vjik\TelegramBot\Api\Method\GiftPremiumSubscription;
61
use Vjik\TelegramBot\Api\Method\HideGeneralForumTopic;
62
use Vjik\TelegramBot\Api\Method\Inline\AnswerInlineQuery;
63
use Vjik\TelegramBot\Api\Method\Inline\AnswerWebAppQuery;
64
use Vjik\TelegramBot\Api\Method\Inline\SavePreparedInlineMessage;
65
use Vjik\TelegramBot\Api\Method\LeaveChat;
66
use Vjik\TelegramBot\Api\Method\LogOut;
67
use Vjik\TelegramBot\Api\Method\Passport\SetPassportDataErrors;
68
use Vjik\TelegramBot\Api\Method\Payment\AnswerPreCheckoutQuery;
69
use Vjik\TelegramBot\Api\Method\Payment\AnswerShippingQuery;
70
use Vjik\TelegramBot\Api\Method\Payment\CreateInvoiceLink;
71
use Vjik\TelegramBot\Api\Method\Payment\EditUserStarSubscription;
72
use Vjik\TelegramBot\Api\Method\Payment\GetStarTransactions;
73
use Vjik\TelegramBot\Api\Method\Payment\RefundStarPayment;
74
use Vjik\TelegramBot\Api\Method\Payment\SendInvoice;
75
use Vjik\TelegramBot\Api\Method\PinChatMessage;
76
use Vjik\TelegramBot\Api\Method\PostStory;
77
use Vjik\TelegramBot\Api\Method\PromoteChatMember;
78
use Vjik\TelegramBot\Api\Method\RemoveBusinessAccountProfilePhoto;
79
use Vjik\TelegramBot\Api\Method\RemoveChatVerification;
80
use Vjik\TelegramBot\Api\Method\RemoveUserVerification;
81
use Vjik\TelegramBot\Api\Method\ReopenForumTopic;
82
use Vjik\TelegramBot\Api\Method\ReopenGeneralForumTopic;
83
use Vjik\TelegramBot\Api\Method\RestrictChatMember;
84
use Vjik\TelegramBot\Api\Method\RevokeChatInviteLink;
85
use Vjik\TelegramBot\Api\Method\SendAnimation;
86
use Vjik\TelegramBot\Api\Method\SendAudio;
87
use Vjik\TelegramBot\Api\Method\SendChatAction;
88
use Vjik\TelegramBot\Api\Method\SendContact;
89
use Vjik\TelegramBot\Api\Method\SendDice;
90
use Vjik\TelegramBot\Api\Method\SendDocument;
91
use Vjik\TelegramBot\Api\Method\SendLocation;
92
use Vjik\TelegramBot\Api\Method\SendMediaGroup;
93
use Vjik\TelegramBot\Api\Method\SendMessage;
94
use Vjik\TelegramBot\Api\Method\SendPaidMedia;
95
use Vjik\TelegramBot\Api\Method\SendPhoto;
96
use Vjik\TelegramBot\Api\Method\SendPoll;
97
use Vjik\TelegramBot\Api\Method\SendVenue;
98
use Vjik\TelegramBot\Api\Method\SendVideo;
99
use Vjik\TelegramBot\Api\Method\SendVideoNote;
100
use Vjik\TelegramBot\Api\Method\SendVoice;
101
use Vjik\TelegramBot\Api\Method\SetBusinessAccountBio;
102
use Vjik\TelegramBot\Api\Method\SetBusinessAccountGiftSettings;
103
use Vjik\TelegramBot\Api\Method\SetBusinessAccountName;
104
use Vjik\TelegramBot\Api\Method\SetBusinessAccountProfilePhoto;
105
use Vjik\TelegramBot\Api\Method\SetBusinessAccountUsername;
106
use Vjik\TelegramBot\Api\Method\SetChatAdministratorCustomTitle;
107
use Vjik\TelegramBot\Api\Method\SetChatDescription;
108
use Vjik\TelegramBot\Api\Method\SetChatMenuButton;
109
use Vjik\TelegramBot\Api\Method\SetChatPermissions;
110
use Vjik\TelegramBot\Api\Method\SetChatPhoto;
111
use Vjik\TelegramBot\Api\Method\SetChatStickerSet;
112
use Vjik\TelegramBot\Api\Method\SetChatTitle;
113
use Vjik\TelegramBot\Api\Method\SetMessageReaction;
114
use Vjik\TelegramBot\Api\Method\SetMyCommands;
115
use Vjik\TelegramBot\Api\Method\SetMyDefaultAdministratorRights;
116
use Vjik\TelegramBot\Api\Method\SetMyDescription;
117
use Vjik\TelegramBot\Api\Method\SetMyName;
118
use Vjik\TelegramBot\Api\Method\SetMyShortDescription;
119
use Vjik\TelegramBot\Api\Method\SetUserEmojiStatus;
120
use Vjik\TelegramBot\Api\Method\Sticker\AddStickerToSet;
121
use Vjik\TelegramBot\Api\Method\Sticker\CreateNewStickerSet;
122
use Vjik\TelegramBot\Api\Method\Sticker\DeleteStickerFromSet;
123
use Vjik\TelegramBot\Api\Method\Sticker\DeleteStickerSet;
124
use Vjik\TelegramBot\Api\Method\Sticker\GetAvailableGifts;
125
use Vjik\TelegramBot\Api\Method\Sticker\GetCustomEmojiStickers;
126
use Vjik\TelegramBot\Api\Method\Sticker\GetStickerSet;
127
use Vjik\TelegramBot\Api\Method\Sticker\ReplaceStickerInSet;
128
use Vjik\TelegramBot\Api\Method\Sticker\SendGift;
129
use Vjik\TelegramBot\Api\Method\Sticker\SendSticker;
130
use Vjik\TelegramBot\Api\Method\Sticker\SetCustomEmojiStickerSetThumbnail;
131
use Vjik\TelegramBot\Api\Method\Sticker\SetStickerEmojiList;
132
use Vjik\TelegramBot\Api\Method\Sticker\SetStickerKeywords;
133
use Vjik\TelegramBot\Api\Method\Sticker\SetStickerMaskPosition;
134
use Vjik\TelegramBot\Api\Method\Sticker\SetStickerPositionInSet;
135
use Vjik\TelegramBot\Api\Method\Sticker\SetStickerSetThumbnail;
136
use Vjik\TelegramBot\Api\Method\Sticker\SetStickerSetTitle;
137
use Vjik\TelegramBot\Api\Method\Sticker\UploadStickerFile;
138
use Vjik\TelegramBot\Api\Method\TransferBusinessAccountStars;
139
use Vjik\TelegramBot\Api\Method\TransferGift;
140
use Vjik\TelegramBot\Api\Method\UnbanChatMember;
141
use Vjik\TelegramBot\Api\Method\UnbanChatSenderChat;
142
use Vjik\TelegramBot\Api\Method\UnhideGeneralForumTopic;
143
use Vjik\TelegramBot\Api\Method\UnpinAllChatMessages;
144
use Vjik\TelegramBot\Api\Method\UnpinAllForumTopicMessages;
145
use Vjik\TelegramBot\Api\Method\UnpinAllGeneralForumTopicMessages;
146
use Vjik\TelegramBot\Api\Method\UnpinChatMessage;
147
use Vjik\TelegramBot\Api\Method\Update\DeleteWebhook;
148
use Vjik\TelegramBot\Api\Method\Update\GetUpdates;
149
use Vjik\TelegramBot\Api\Method\Update\GetWebhookInfo;
150
use Vjik\TelegramBot\Api\Method\Update\SetWebhook;
151
use Vjik\TelegramBot\Api\Method\UpdatingMessage\DeleteBusinessMessages;
152
use Vjik\TelegramBot\Api\Method\UpdatingMessage\DeleteMessage;
153
use Vjik\TelegramBot\Api\Method\UpdatingMessage\DeleteMessages;
154
use Vjik\TelegramBot\Api\Method\UpdatingMessage\EditMessageCaption;
155
use Vjik\TelegramBot\Api\Method\UpdatingMessage\EditMessageLiveLocation;
156
use Vjik\TelegramBot\Api\Method\UpdatingMessage\EditMessageMedia;
157
use Vjik\TelegramBot\Api\Method\UpdatingMessage\EditMessageReplyMarkup;
158
use Vjik\TelegramBot\Api\Method\UpdatingMessage\EditMessageText;
159
use Vjik\TelegramBot\Api\Method\UpdatingMessage\ReadBusinessMessage;
160
use Vjik\TelegramBot\Api\Method\UpdatingMessage\StopMessageLiveLocation;
161
use Vjik\TelegramBot\Api\Method\UpdatingMessage\StopPoll;
162
use Vjik\TelegramBot\Api\Method\UpgradeGift;
163
use Vjik\TelegramBot\Api\Method\VerifyChat;
164
use Vjik\TelegramBot\Api\Method\VerifyUser;
165
use Vjik\TelegramBot\Api\Transport\CurlTransport;
166
use Vjik\TelegramBot\Api\Transport\DownloadFileException;
167
use Vjik\TelegramBot\Api\Transport\NativeTransport;
168
use Vjik\TelegramBot\Api\Transport\SaveFileException;
169
use Vjik\TelegramBot\Api\Transport\TransportInterface;
170
use Vjik\TelegramBot\Api\Type\AcceptedGiftTypes;
171
use Vjik\TelegramBot\Api\Type\BotCommand;
172
use Vjik\TelegramBot\Api\Type\BotCommandScope;
173
use Vjik\TelegramBot\Api\Type\BotDescription;
174
use Vjik\TelegramBot\Api\Type\BotName;
175
use Vjik\TelegramBot\Api\Type\BotShortDescription;
176
use Vjik\TelegramBot\Api\Type\BusinessConnection;
177
use Vjik\TelegramBot\Api\Type\ChatAdministratorRights;
178
use Vjik\TelegramBot\Api\Type\ChatFullInfo;
179
use Vjik\TelegramBot\Api\Type\ChatInviteLink;
180
use Vjik\TelegramBot\Api\Type\ChatMember;
181
use Vjik\TelegramBot\Api\Type\ChatPermissions;
182
use Vjik\TelegramBot\Api\Type\File;
183
use Vjik\TelegramBot\Api\Type\ForceReply;
184
use Vjik\TelegramBot\Api\Type\ForumTopic;
185
use Vjik\TelegramBot\Api\Type\Game\GameHighScore;
186
use Vjik\TelegramBot\Api\Type\Inline\InlineQueryResult;
187
use Vjik\TelegramBot\Api\Type\Inline\InlineQueryResultsButton;
188
use Vjik\TelegramBot\Api\Type\Inline\PreparedInlineMessage;
189
use Vjik\TelegramBot\Api\Type\Inline\SentWebAppMessage;
190
use Vjik\TelegramBot\Api\Type\InlineKeyboardMarkup;
191
use Vjik\TelegramBot\Api\Type\InputFile;
192
use Vjik\TelegramBot\Api\Type\InputMedia;
193
use Vjik\TelegramBot\Api\Type\InputMediaAudio;
194
use Vjik\TelegramBot\Api\Type\InputMediaDocument;
195
use Vjik\TelegramBot\Api\Type\InputMediaPhoto;
196
use Vjik\TelegramBot\Api\Type\InputMediaVideo;
197
use Vjik\TelegramBot\Api\Type\InputPaidMedia;
198
use Vjik\TelegramBot\Api\Type\InputPollOption;
199
use Vjik\TelegramBot\Api\Type\InputProfilePhoto;
200
use Vjik\TelegramBot\Api\Type\InputStoryContent;
201
use Vjik\TelegramBot\Api\Type\LinkPreviewOptions;
202
use Vjik\TelegramBot\Api\Type\MenuButton;
203
use Vjik\TelegramBot\Api\Type\Message;
204
use Vjik\TelegramBot\Api\Type\MessageEntity;
205
use Vjik\TelegramBot\Api\Type\MessageId;
206
use Vjik\TelegramBot\Api\Type\OwnedGifts;
207
use Vjik\TelegramBot\Api\Type\Passport\PassportElementError;
208
use Vjik\TelegramBot\Api\Type\Payment\LabeledPrice;
209
use Vjik\TelegramBot\Api\Type\Payment\ShippingOption;
210
use Vjik\TelegramBot\Api\Type\Payment\StarTransactions;
211
use Vjik\TelegramBot\Api\Type\Poll;
212
use Vjik\TelegramBot\Api\Type\ReactionType;
213
use Vjik\TelegramBot\Api\Type\ReplyKeyboardMarkup;
214
use Vjik\TelegramBot\Api\Type\ReplyKeyboardRemove;
215
use Vjik\TelegramBot\Api\Type\ReplyParameters;
216
use Vjik\TelegramBot\Api\Type\StarAmount;
217
use Vjik\TelegramBot\Api\Type\Sticker\Gifts;
218
use Vjik\TelegramBot\Api\Type\Sticker\InputSticker;
219
use Vjik\TelegramBot\Api\Type\Sticker\MaskPosition;
220
use Vjik\TelegramBot\Api\Type\Sticker\Sticker;
221
use Vjik\TelegramBot\Api\Type\Sticker\StickerSet;
222
use Vjik\TelegramBot\Api\Type\Story;
223
use Vjik\TelegramBot\Api\Type\StoryArea;
224
use Vjik\TelegramBot\Api\Type\Update\Update;
225
use Vjik\TelegramBot\Api\Type\Update\WebhookInfo;
226
use Vjik\TelegramBot\Api\Type\User;
227
use Vjik\TelegramBot\Api\Type\UserChatBoosts;
228
use Vjik\TelegramBot\Api\Type\UserProfilePhotos;
229

230
use function extension_loaded;
231
use function ini_get;
232

233
/**
234
 * @api
235
 */
236
final class TelegramBotApi
237
{
238
    private readonly Api $api;
239
    private readonly TransportInterface $transport;
240

241
    public function __construct(
981✔
242
        #[SensitiveParameter]
243
        private readonly string $token,
244
        private readonly string $baseUrl = 'https://api.telegram.org',
245
        ?TransportInterface $transport = null,
246
        private ?LoggerInterface $logger = null,
247
    ) {
248
        $this->transport = $transport ?? $this->defaultTransport();
981✔
249
        $this->api = new Api($token, $baseUrl, $this->transport);
981✔
250
    }
251

252
    public function withLogger(?LoggerInterface $logger): self
3✔
253
    {
254
        $new = clone $this;
3✔
255
        $new->logger = $logger;
3✔
256
        return $new;
3✔
257
    }
258

259
    /**
260
     * @see https://core.telegram.org/bots/api#making-requests
261
     *
262
     * @psalm-template TValue
263
     * @psalm-param MethodInterface<TValue> $method
264
     * @psalm-return TValue|FailResult
265
     */
266
    public function call(MethodInterface $method): mixed
966✔
267
    {
268
        return $this->api->call($method, $this->logger);
966✔
269
    }
270

271
    /**
272
     * Make a file URL on Telegram servers.
273
     *
274
     * @see https://core.telegram.org/bots/api#file
275
     * @see https://core.telegram.org/bots/api#getfile
276
     *
277
     * @param string|File $file File path or {@see File} object.
278
     *
279
     * @return string The file URL.
280
     *
281
     * @throws LogicException If the file path is not specified in `File` object.
282
     */
283
    public function makeFileUrl(string|File $file): string
15✔
284
    {
285
        if ($file instanceof File) {
15✔
286
            $path = $file->filePath;
6✔
287
            if ($path === null) {
6✔
288
                throw new LogicException('The file path is not specified.');
3✔
289
            }
290
        } else {
291
            $path = $file;
9✔
292
        }
293

294
        return $this->baseUrl . '/file/bot' . $this->token . '/' . $path;
12✔
295
    }
296

297
    /**
298
     * Downloads a file from the Telegram servers and returns its content.
299
     *
300
     * @param string|File $file File path or {@see File} object.
301
     *
302
     * @return string The file content.
303
     *
304
     * @throws DownloadFileException If an error occurred while downloading the file.
305
     * @throws LogicException If the file path is not specified in `File` object.
306
     */
307
    public function downloadFile(string|File $file): string
3✔
308
    {
309
        return $this->transport->downloadFile(
3✔
310
            $this->makeFileUrl($file),
3✔
311
        );
3✔
312
    }
313

314
    /**
315
     * Downloads a file from the Telegram servers and saves it to a file.
316
     *
317
     * @param string|File $file File path or {@see File} object.
318
     * @param string $savePath The path to save the file.
319
     *
320
     * @throws DownloadFileException If an error occurred while downloading the file.
321
     * @throws SaveFileException If an error occurred while saving the file.
322
     * @throws LogicException If the file path is not specified in `File` object.
323
     */
324
    public function downloadFileTo(string|File $file, string $savePath): void
3✔
325
    {
326
        $this->transport->downloadFileTo(
3✔
327
            $this->makeFileUrl($file),
3✔
328
            $savePath,
3✔
329
        );
3✔
330
    }
331

332
    /**
333
     * @see https://core.telegram.org/bots/api#addstickertoset
334
     */
335
    public function addStickerToSet(int $userId, string $name, InputSticker $sticker): FailResult|true
3✔
336
    {
337
        return $this->call(
3✔
338
            new AddStickerToSet($userId, $name, $sticker),
3✔
339
        );
3✔
340
    }
341

342
    /**
343
     * @see https://core.telegram.org/bots/api#answercallbackquery
344
     */
345
    public function answerCallbackQuery(
3✔
346
        string $callbackQueryId,
347
        ?string $text = null,
348
        ?bool $showAlert = null,
349
        ?string $url = null,
350
        ?int $cacheTime = null,
351
    ): FailResult|true {
352
        return $this->call(
3✔
353
            new AnswerCallbackQuery($callbackQueryId, $text, $showAlert, $url, $cacheTime),
3✔
354
        );
3✔
355
    }
356

357
    /**
358
     * @see https://core.telegram.org/bots/api#answerinlinequery
359
     *
360
     * @param InlineQueryResult[] $results
361
     */
362
    public function answerInlineQuery(
3✔
363
        string $inlineQueryId,
364
        array $results,
365
        ?int $cacheTime = null,
366
        ?bool $isPersonal = null,
367
        ?string $nextOffset = null,
368
        ?InlineQueryResultsButton $button = null,
369
    ): FailResult|true {
370
        return $this->call(
3✔
371
            new AnswerInlineQuery($inlineQueryId, $results, $cacheTime, $isPersonal, $nextOffset, $button),
3✔
372
        );
3✔
373
    }
374

375
    /**
376
     * @see https://core.telegram.org/bots/api#answerprecheckoutquery
377
     */
378
    public function answerPreCheckoutQuery(
3✔
379
        string $preCheckoutQueryId,
380
        bool $ok,
381
        ?string $errorMessage = null,
382
    ): FailResult|true {
383
        return $this->call(
3✔
384
            new AnswerPreCheckoutQuery($preCheckoutQueryId, $ok, $errorMessage),
3✔
385
        );
3✔
386
    }
387

388
    /**
389
     * @see https://core.telegram.org/bots/api#answershippingquery
390
     *
391
     * @param ShippingOption[]|null $shippingOptions
392
     */
393
    public function answerShippingQuery(
3✔
394
        string $shippingQueryId,
395
        bool $ok,
396
        ?array $shippingOptions = null,
397
        ?string $errorMessage = null,
398
    ): FailResult|true {
399
        return $this->call(
3✔
400
            new AnswerShippingQuery($shippingQueryId, $ok, $shippingOptions, $errorMessage),
3✔
401
        );
3✔
402
    }
403

404
    /**
405
     * @see https://core.telegram.org/bots/api#answerwebappquery
406
     */
407
    public function answerWebAppQuery(string $webAppQueryId, InlineQueryResult $result): FailResult|SentWebAppMessage
3✔
408
    {
409
        return $this->call(
3✔
410
            new AnswerWebAppQuery($webAppQueryId, $result),
3✔
411
        );
3✔
412
    }
413

414
    /**
415
     * @see https://core.telegram.org/bots/api#approvechatjoinrequest
416
     */
417
    public function approveChatJoinRequest(int|string $chatId, int $userId): FailResult|true
3✔
418
    {
419
        return $this->call(
3✔
420
            new ApproveChatJoinRequest($chatId, $userId),
3✔
421
        );
3✔
422
    }
423

424
    /**
425
     * @see https://core.telegram.org/bots/api#banchatmember
426
     */
427
    public function banChatMember(
3✔
428
        int|string $chatId,
429
        int $userId,
430
        ?DateTimeInterface $untilDate = null,
431
        ?bool $revokeMessages = null,
432
    ): FailResult|true {
433
        return $this->call(
3✔
434
            new BanChatMember($chatId, $userId, $untilDate, $revokeMessages),
3✔
435
        );
3✔
436
    }
437

438
    /**
439
     * @see https://core.telegram.org/bots/api#banchatsenderchat
440
     */
441
    public function banChatSenderChat(int|string $chatId, int $senderChatId): FailResult|true
3✔
442
    {
443
        return $this->call(
3✔
444
            new BanChatSenderChat($chatId, $senderChatId),
3✔
445
        );
3✔
446
    }
447

448
    /**
449
     * @see https://core.telegram.org/bots/api#close
450
     */
451
    public function close(): FailResult|true
3✔
452
    {
453
        return $this->call(new Close());
3✔
454
    }
455

456
    /**
457
     * @see https://core.telegram.org/bots/api#closeforumtopic
458
     */
459
    public function closeForumTopic(int|string $chatId, int $messageThreadId): FailResult|true
3✔
460
    {
461
        return $this->call(new CloseForumTopic($chatId, $messageThreadId));
3✔
462
    }
463

464
    /**
465
     * @see https://core.telegram.org/bots/api#closegeneralforumtopic
466
     */
467
    public function closeGeneralForumTopic(int|string $chatId): FailResult|true
3✔
468
    {
469
        return $this->call(new CloseGeneralForumTopic($chatId));
3✔
470
    }
471

472
    /**
473
     * @see https://core.telegram.org/bots/api#convertgifttostars
474
     */
475
    public function convertGiftToStars(
3✔
476
        string $businessConnectionId,
477
        string $ownedGiftId,
478
    ): FailResult|true {
479
        return $this->call(
3✔
480
            new ConvertGiftToStars($businessConnectionId, $ownedGiftId),
3✔
481
        );
3✔
482
    }
483

484
    /**
485
     * @see https://core.telegram.org/bots/api#copymessage
486
     *
487
     * @param MessageEntity[]|null $captionEntities
488
     */
489
    public function copyMessage(
3✔
490
        int|string $chatId,
491
        int|string $fromChatId,
492
        int $messageId,
493
        ?int $messageThreadId = null,
494
        ?string $caption = null,
495
        ?string $parseMode = null,
496
        ?array $captionEntities = null,
497
        ?bool $showCaptionAboveMedia = null,
498
        ?bool $disableNotification = null,
499
        ?bool $protectContent = null,
500
        ?ReplyParameters $replyParameters = null,
501
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
502
        ?bool $allowPaidBroadcast = null,
503
        ?int $videoStartTimestamp = null,
504
    ): FailResult|MessageId {
505
        return $this->call(
3✔
506
            new CopyMessage(
3✔
507
                $chatId,
3✔
508
                $fromChatId,
3✔
509
                $messageId,
3✔
510
                $messageThreadId,
3✔
511
                $caption,
3✔
512
                $parseMode,
3✔
513
                $captionEntities,
3✔
514
                $showCaptionAboveMedia,
3✔
515
                $disableNotification,
3✔
516
                $protectContent,
3✔
517
                $replyParameters,
3✔
518
                $replyMarkup,
3✔
519
                $allowPaidBroadcast,
3✔
520
                $videoStartTimestamp,
3✔
521
            ),
3✔
522
        );
3✔
523
    }
524

525
    /**
526
     * @see https://core.telegram.org/bots/api#copymessages
527
     *
528
     * @param int[] $messageIds
529
     * @return FailResult|MessageId[]
530
     */
531
    public function copyMessages(
3✔
532
        int|string $chatId,
533
        int|string $fromChatId,
534
        array $messageIds,
535
        ?int $messageThreadId = null,
536
        ?bool $disableNotification = null,
537
        ?bool $protectContent = null,
538
        ?bool $removeCaption = null,
539
    ): FailResult|array {
540
        return $this->call(
3✔
541
            new CopyMessages(
3✔
542
                $chatId,
3✔
543
                $fromChatId,
3✔
544
                $messageIds,
3✔
545
                $messageThreadId,
3✔
546
                $disableNotification,
3✔
547
                $protectContent,
3✔
548
                $removeCaption,
3✔
549
            ),
3✔
550
        );
3✔
551
    }
552

553
    /**
554
     * @see https://core.telegram.org/bots/api#createchatinvitelink
555
     */
556
    public function createChatInviteLink(
3✔
557
        int|string $chatId,
558
        ?string $name = null,
559
        ?DateTimeImmutable $expireDate = null,
560
        ?int $memberLimit = null,
561
        ?bool $createsJoinRequest = null,
562
    ): FailResult|ChatInviteLink {
563
        return $this->call(
3✔
564
            new CreateChatInviteLink($chatId, $name, $expireDate, $memberLimit, $createsJoinRequest),
3✔
565
        );
3✔
566
    }
567

568
    /**
569
     * @see https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
570
     */
571
    public function createChatSubscriptionInviteLink(
3✔
572
        int|string $chatId,
573
        int $subscriptionPeriod,
574
        int $subscriptionPrice,
575
        ?string $name = null,
576
    ): FailResult|ChatInviteLink {
577
        return $this->call(
3✔
578
            new CreateChatSubscriptionInviteLink($chatId, $subscriptionPeriod, $subscriptionPrice, $name),
3✔
579
        );
3✔
580
    }
581

582
    /**
583
     * @see https://core.telegram.org/bots/api#createforumtopic
584
     */
585
    public function createForumTopic(
3✔
586
        int|string $chatId,
587
        string $name,
588
        ?int $iconColor = null,
589
        ?string $iconCustomEmojiId = null,
590
    ): FailResult|ForumTopic {
591
        return $this->call(
3✔
592
            new CreateForumTopic($chatId, $name, $iconColor, $iconCustomEmojiId),
3✔
593
        );
3✔
594
    }
595

596
    /**
597
     * @see https://core.telegram.org/bots/api#createinvoicelink
598
     *
599
     * @param LabeledPrice[] $prices
600
     * @param int[]|null $suggestedTipAmounts
601
     */
602
    public function createInvoiceLink(
3✔
603
        string $title,
604
        string $description,
605
        string $payload,
606
        string $currency,
607
        array $prices,
608
        #[SensitiveParameter]
609
        ?string $providerToken = null,
610
        ?int $maxTipAmount = null,
611
        ?array $suggestedTipAmounts = null,
612
        ?string $providerData = null,
613
        ?string $photoUrl = null,
614
        ?int $photoSize = null,
615
        ?int $photoWidth = null,
616
        ?int $photoHeight = null,
617
        ?bool $needName = null,
618
        ?bool $needPhoneNumber = null,
619
        ?bool $needEmail = null,
620
        ?bool $needShippingAddress = null,
621
        ?bool $sendPhoneNumberToProvider = null,
622
        ?bool $sendEmailToProvider = null,
623
        ?bool $isFlexible = null,
624
        ?int $subscriptionPeriod = null,
625
        ?string $businessConnectionId = null,
626
    ): FailResult|string {
627
        return $this->call(
3✔
628
            new CreateInvoiceLink(
3✔
629
                $title,
3✔
630
                $description,
3✔
631
                $payload,
3✔
632
                $currency,
3✔
633
                $prices,
3✔
634
                $providerToken,
3✔
635
                $maxTipAmount,
3✔
636
                $suggestedTipAmounts,
3✔
637
                $providerData,
3✔
638
                $photoUrl,
3✔
639
                $photoSize,
3✔
640
                $photoWidth,
3✔
641
                $photoHeight,
3✔
642
                $needName,
3✔
643
                $needPhoneNumber,
3✔
644
                $needEmail,
3✔
645
                $needShippingAddress,
3✔
646
                $sendPhoneNumberToProvider,
3✔
647
                $sendEmailToProvider,
3✔
648
                $isFlexible,
3✔
649
                $subscriptionPeriod,
3✔
650
                $businessConnectionId,
3✔
651
            ),
3✔
652
        );
3✔
653
    }
654

655
    /**
656
     * @see https://core.telegram.org/bots/api#createnewstickerset
657
     *
658
     * @param InputSticker[] $stickers
659
     */
660
    public function createNewStickerSet(
3✔
661
        int $userId,
662
        string $name,
663
        string $title,
664
        array $stickers,
665
        ?string $stickerType = null,
666
        ?bool $needsRepainting = null,
667
    ): FailResult|true {
668
        return $this->call(
3✔
669
            new CreateNewStickerSet($userId, $name, $title, $stickers, $stickerType, $needsRepainting),
3✔
670
        );
3✔
671
    }
672

673
    /**
674
     * @see https://core.telegram.org/bots/api#declinechatjoinrequest
675
     */
676
    public function declineChatJoinRequest(int|string $chatId, int $userId): FailResult|true
3✔
677
    {
678
        return $this->call(
3✔
679
            new DeclineChatJoinRequest($chatId, $userId),
3✔
680
        );
3✔
681
    }
682

683
    /**
684
     * @see https://core.telegram.org/bots/api#deletebusinessmessages
685
     *
686
     * @param int[] $messageIds
687
     */
688
    public function deleteBusinessMessages(
3✔
689
        string $businessConnectionId,
690
        array $messageIds,
691
    ): FailResult|true {
692
        return $this->call(
3✔
693
            new DeleteBusinessMessages($businessConnectionId, $messageIds),
3✔
694
        );
3✔
695
    }
696

697
    /**
698
     * @see https://core.telegram.org/bots/api#deletechatphoto
699
     */
700
    public function deleteChatPhoto(int|string $chatId): FailResult|true
3✔
701
    {
702
        return $this->call(
3✔
703
            new DeleteChatPhoto($chatId),
3✔
704
        );
3✔
705
    }
706

707
    /**
708
     * @see https://core.telegram.org/bots/api#deletechatstickerset
709
     */
710
    public function deleteChatStickerSet(int|string $chatId): FailResult|true
3✔
711
    {
712
        return $this->call(
3✔
713
            new DeleteChatStickerSet($chatId),
3✔
714
        );
3✔
715
    }
716

717
    /**
718
     * @see https://core.telegram.org/bots/api#deleteforumtopic
719
     */
720
    public function deleteForumTopic(int|string $chatId, int $messageThreadId): FailResult|true
3✔
721
    {
722
        return $this->call(new DeleteForumTopic($chatId, $messageThreadId));
3✔
723
    }
724

725
    /**
726
     * @see https://core.telegram.org/bots/api#deletemessage
727
     */
728
    public function deleteMessage(int|string $chatId, int $messageId): FailResult|true
3✔
729
    {
730
        return $this->call(new DeleteMessage($chatId, $messageId));
3✔
731
    }
732

733
    /**
734
     * @see https://core.telegram.org/bots/api#deletemessages
735
     *
736
     * @param int[] $messageIds
737
     */
738
    public function deleteMessages(int|string $chatId, array $messageIds): FailResult|true
3✔
739
    {
740
        return $this->call(new DeleteMessages($chatId, $messageIds));
3✔
741
    }
742

743
    /**
744
     * @see https://core.telegram.org/bots/api#deletemycommands
745
     */
746
    public function deleteMyCommands(?BotCommandScope $scope = null, ?string $languageCode = null): FailResult|true
3✔
747
    {
748
        return $this->call(new DeleteMyCommands($scope, $languageCode));
3✔
749
    }
750

751
    /**
752
     * @see https://core.telegram.org/bots/api#deletestickerfromset
753
     */
754
    public function deleteStickerFromSet(string $sticker): FailResult|true
3✔
755
    {
756
        return $this->call(
3✔
757
            new DeleteStickerFromSet($sticker),
3✔
758
        );
3✔
759
    }
760

761
    /**
762
     * @see https://core.telegram.org/bots/api#deletestickerset
763
     */
764
    public function deleteStickerSet(string $name): FailResult|true
3✔
765
    {
766
        return $this->call(new DeleteStickerSet($name));
3✔
767
    }
768

769
    /**
770
     * @see https://core.telegram.org/bots/api#editchatinvitelink
771
     */
772
    public function editChatInviteLink(
3✔
773
        int|string $chatId,
774
        string $inviteLink,
775
        ?string $name = null,
776
        ?DateTimeImmutable $expireDate = null,
777
        ?int $memberLimit = null,
778
        ?bool $createsJoinRequest = null,
779
    ): FailResult|ChatInviteLink {
780
        return $this->call(
3✔
781
            new EditChatInviteLink($chatId, $inviteLink, $name, $expireDate, $memberLimit, $createsJoinRequest),
3✔
782
        );
3✔
783
    }
784

785
    /**
786
     * @see https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
787
     */
788
    public function editChatSubscriptionInviteLink(
3✔
789
        int|string $chatId,
790
        string $inviteLink,
791
        ?string $name = null,
792
    ): FailResult|ChatInviteLink {
793
        return $this->call(
3✔
794
            new EditChatSubscriptionInviteLink($chatId, $inviteLink, $name),
3✔
795
        );
3✔
796
    }
797

798
    /**
799
     * @see https://core.telegram.org/bots/api#editforumtopic
800
     */
801
    public function editForumTopic(
3✔
802
        int|string $chatId,
803
        int $messageThreadId,
804
        ?string $name = null,
805
        ?string $iconCustomEmojiId = null,
806
    ): FailResult|true {
807
        return $this->call(
3✔
808
            new EditForumTopic($chatId, $messageThreadId, $name, $iconCustomEmojiId),
3✔
809
        );
3✔
810
    }
811

812
    /**
813
     * @see https://core.telegram.org/bots/api#editgeneralforumtopic
814
     */
815
    public function editGeneralForumTopic(int|string $chatId, string $name): FailResult|true
3✔
816
    {
817
        return $this->call(
3✔
818
            new EditGeneralForumTopic($chatId, $name),
3✔
819
        );
3✔
820
    }
821

822
    /**
823
     * @see https://core.telegram.org/bots/api#editmessagecaption
824
     *
825
     * @param MessageEntity[]|null $captionEntities
826
     */
827
    public function editMessageCaption(
3✔
828
        ?string $businessConnectionId = null,
829
        int|string|null $chatId = null,
830
        ?int $messageId = null,
831
        ?string $inlineMessageId = null,
832
        ?string $caption = null,
833
        ?string $parseMode = null,
834
        ?array $captionEntities = null,
835
        ?bool $showCaptionAboveMedia = null,
836
        ?InlineKeyboardMarkup $replyMarkup = null,
837
    ): FailResult|Message|true {
838
        return $this->call(
3✔
839
            new EditMessageCaption(
3✔
840
                $businessConnectionId,
3✔
841
                $chatId,
3✔
842
                $messageId,
3✔
843
                $inlineMessageId,
3✔
844
                $caption,
3✔
845
                $parseMode,
3✔
846
                $captionEntities,
3✔
847
                $showCaptionAboveMedia,
3✔
848
                $replyMarkup,
3✔
849
            ),
3✔
850
        );
3✔
851
    }
852

853
    /**
854
     * @see https://core.telegram.org/bots/api#editmessagelivelocation
855
     */
856
    public function editMessageLiveLocation(
3✔
857
        float $latitude,
858
        float $longitude,
859
        ?string $businessConnectionId = null,
860
        int|string|null $chatId = null,
861
        ?int $messageId = null,
862
        ?string $inlineMessageId = null,
863
        ?int $livePeriod = null,
864
        ?float $horizontalAccuracy = null,
865
        ?int $heading = null,
866
        ?int $proximityAlertRadius = null,
867
        ?InlineKeyboardMarkup $replyMarkup = null,
868
    ): FailResult|Message|true {
869
        return $this->call(
3✔
870
            new EditMessageLiveLocation(
3✔
871
                $latitude,
3✔
872
                $longitude,
3✔
873
                $businessConnectionId,
3✔
874
                $chatId,
3✔
875
                $messageId,
3✔
876
                $inlineMessageId,
3✔
877
                $livePeriod,
3✔
878
                $horizontalAccuracy,
3✔
879
                $heading,
3✔
880
                $proximityAlertRadius,
3✔
881
                $replyMarkup,
3✔
882
            ),
3✔
883
        );
3✔
884
    }
885

886
    /**
887
     * @see https://core.telegram.org/bots/api#editmessagemedia
888
     */
889
    public function editMessageMedia(
3✔
890
        InputMedia $media,
891
        ?string $businessConnectionId = null,
892
        int|string|null $chatId = null,
893
        ?int $messageId = null,
894
        ?string $inlineMessageId = null,
895
        ?InlineKeyboardMarkup $replyMarkup = null,
896
    ): FailResult|Message|true {
897
        return $this->call(
3✔
898
            new EditMessageMedia(
3✔
899
                $media,
3✔
900
                $businessConnectionId,
3✔
901
                $chatId,
3✔
902
                $messageId,
3✔
903
                $inlineMessageId,
3✔
904
                $replyMarkup,
3✔
905
            ),
3✔
906
        );
3✔
907
    }
908

909
    /**
910
     * @see https://core.telegram.org/bots/api#editmessagereplymarkup
911
     */
912
    public function editMessageReplyMarkup(
3✔
913
        ?string $businessConnectionId = null,
914
        int|string|null $chatId = null,
915
        ?int $messageId = null,
916
        ?string $inlineMessageId = null,
917
        ?InlineKeyboardMarkup $replyMarkup = null,
918
    ): FailResult|Message|true {
919
        return $this->call(
3✔
920
            new EditMessageReplyMarkup(
3✔
921
                $businessConnectionId,
3✔
922
                $chatId,
3✔
923
                $messageId,
3✔
924
                $inlineMessageId,
3✔
925
                $replyMarkup,
3✔
926
            ),
3✔
927
        );
3✔
928
    }
929

930
    /**
931
     * @see https://core.telegram.org/bots/api#editmessagetext
932
     *
933
     * @param MessageEntity[]|null $entities
934
     */
935
    public function editMessageText(
3✔
936
        string $text,
937
        ?string $businessConnectionId = null,
938
        int|string|null $chatId = null,
939
        ?int $messageId = null,
940
        ?string $inlineMessageId = null,
941
        ?string $parseMode = null,
942
        ?array $entities = null,
943
        ?LinkPreviewOptions $linkPreviewOptions = null,
944
        ?InlineKeyboardMarkup $replyMarkup = null,
945
    ): FailResult|Message|true {
946
        return $this->call(
3✔
947
            new EditMessageText(
3✔
948
                $text,
3✔
949
                $businessConnectionId,
3✔
950
                $chatId,
3✔
951
                $messageId,
3✔
952
                $inlineMessageId,
3✔
953
                $parseMode,
3✔
954
                $entities,
3✔
955
                $linkPreviewOptions,
3✔
956
                $replyMarkup,
3✔
957
            ),
3✔
958
        );
3✔
959
    }
960

961
    /**
962
     * @see https://core.telegram.org/bots/api#editstory
963
     *
964
     * @param MessageEntity[]|null $captionEntities
965
     * @param StoryArea[]|null $areas
966
     */
967
    public function editStory(
3✔
968
        string $businessConnectionId,
969
        int $storyId,
970
        InputStoryContent $content,
971
        ?string $caption = null,
972
        ?string $parseMode = null,
973
        ?array $captionEntities = null,
974
        ?array $areas = null,
975
    ): FailResult|Story {
976
        return $this->call(
3✔
977
            new EditStory(
3✔
978
                $businessConnectionId,
3✔
979
                $storyId,
3✔
980
                $content,
3✔
981
                $caption,
3✔
982
                $parseMode,
3✔
983
                $captionEntities,
3✔
984
                $areas,
3✔
985
            ),
3✔
986
        );
3✔
987
    }
988

989
    /**
990
     * @see https://core.telegram.org/bots/api#edituserstarsubscription
991
     */
992
    public function editUserStarSubscription(
3✔
993
        int $userId,
994
        string $telegramPaymentChargeId,
995
        bool $isCanceled,
996
    ): FailResult|true {
997
        return $this->call(
3✔
998
            new EditUserStarSubscription(
3✔
999
                $userId,
3✔
1000
                $telegramPaymentChargeId,
3✔
1001
                $isCanceled,
3✔
1002
            ),
3✔
1003
        );
3✔
1004
    }
1005

1006
    /**
1007
     * @see https://core.telegram.org/bots/api#exportchatinvitelink
1008
     */
1009
    public function exportChatInviteLink(int|string $chatId): FailResult|string
3✔
1010
    {
1011
        return $this->call(
3✔
1012
            new ExportChatInviteLink($chatId),
3✔
1013
        );
3✔
1014
    }
1015

1016
    /**
1017
     * @see https://core.telegram.org/bots/api#forwardmessage
1018
     */
1019
    public function forwardMessage(
3✔
1020
        int|string $chatId,
1021
        int|string $fromChatId,
1022
        int $messageId,
1023
        ?int $messageThreadId = null,
1024
        ?bool $disableNotification = null,
1025
        ?bool $protectContent = null,
1026
        ?int $videoStartTimestamp = null,
1027
    ): FailResult|Message {
1028
        return $this->call(
3✔
1029
            new ForwardMessage(
3✔
1030
                $chatId,
3✔
1031
                $fromChatId,
3✔
1032
                $messageId,
3✔
1033
                $messageThreadId,
3✔
1034
                $disableNotification,
3✔
1035
                $protectContent,
3✔
1036
                $videoStartTimestamp,
3✔
1037
            ),
3✔
1038
        );
3✔
1039
    }
1040

1041
    /**
1042
     * @param int[] $messageIds
1043
     * @return FailResult|MessageId[]
1044
     *
1045
     * @see https://core.telegram.org/bots/api#forwardmessages
1046
     */
1047
    public function forwardMessages(
3✔
1048
        int|string $chatId,
1049
        int|string $fromChatId,
1050
        array $messageIds,
1051
        ?int $messageThreadId = null,
1052
        ?bool $disableNotification = null,
1053
        ?bool $protectContent = null,
1054
    ): FailResult|array {
1055
        return $this->call(
3✔
1056
            new ForwardMessages(
3✔
1057
                $chatId,
3✔
1058
                $fromChatId,
3✔
1059
                $messageIds,
3✔
1060
                $messageThreadId,
3✔
1061
                $disableNotification,
3✔
1062
                $protectContent,
3✔
1063
            ),
3✔
1064
        );
3✔
1065
    }
1066

1067
    /**
1068
     * @see https://core.telegram.org/bots/api#deletestory
1069
     */
1070
    public function deleteStory(string $businessConnectionId, int $storyId): FailResult|true
3✔
1071
    {
1072
        return $this->call(
3✔
1073
            new DeleteStory($businessConnectionId, $storyId),
3✔
1074
        );
3✔
1075
    }
1076

1077
    /**
1078
     * @see https://core.telegram.org/bots/api#deletewebhook
1079
     */
1080
    public function deleteWebhook(?bool $dropPendingUpdates = null): FailResult|true
3✔
1081
    {
1082
        return $this->call(new DeleteWebhook($dropPendingUpdates));
3✔
1083
    }
1084

1085
    /**
1086
     * @see https://core.telegram.org/bots/api#getavailablegifts
1087
     */
1088
    public function getAvailableGifts(): FailResult|Gifts
3✔
1089
    {
1090
        return $this->call(new GetAvailableGifts());
3✔
1091
    }
1092

1093
    /**
1094
     * @see https://core.telegram.org/bots/api#getbusinessaccountgifts
1095
     */
1096
    public function getBusinessAccountGifts(
3✔
1097
        string $businessConnectionId,
1098
        ?bool $excludeUnsaved = null,
1099
        ?bool $excludeSaved = null,
1100
        ?bool $excludeUnlimited = null,
1101
        ?bool $excludeLimited = null,
1102
        ?bool $excludeUnique = null,
1103
        ?bool $sortByPrice = null,
1104
        ?string $offset = null,
1105
        ?int $limit = null,
1106
    ): FailResult|OwnedGifts {
1107
        return $this->call(
3✔
1108
            new GetBusinessAccountGifts(
3✔
1109
                $businessConnectionId,
3✔
1110
                $excludeUnsaved,
3✔
1111
                $excludeSaved,
3✔
1112
                $excludeUnlimited,
3✔
1113
                $excludeLimited,
3✔
1114
                $excludeUnique,
3✔
1115
                $sortByPrice,
3✔
1116
                $offset,
3✔
1117
                $limit,
3✔
1118
            ),
3✔
1119
        );
3✔
1120
    }
1121

1122
    /**
1123
     * @see https://core.telegram.org/bots/api#getbusinessaccountstarbalance
1124
     */
1125
    public function getBusinessAccountStarBalance(string $businessConnectionId): FailResult|StarAmount
3✔
1126
    {
1127
        return $this->call(
3✔
1128
            new GetBusinessAccountStarBalance($businessConnectionId),
3✔
1129
        );
3✔
1130
    }
1131

1132
    /**
1133
     * @see https://core.telegram.org/bots/api#getbusinessconnection
1134
     */
1135
    public function getBusinessConnection(string $businessConnectionId): FailResult|BusinessConnection
3✔
1136
    {
1137
        return $this->call(new GetBusinessConnection($businessConnectionId));
3✔
1138
    }
1139

1140
    /**
1141
     * @see https://core.telegram.org/bots/api#getchat
1142
     */
1143
    public function getChat(int|string $chatId): FailResult|ChatFullInfo
3✔
1144
    {
1145
        return $this->call(new GetChat($chatId));
3✔
1146
    }
1147

1148
    /**
1149
     * @see https://core.telegram.org/bots/api#getchatadministrators
1150
     *
1151
     * @return FailResult|ChatMember[]
1152
     */
1153
    public function getChatAdministrators(int|string $chatId): FailResult|array
3✔
1154
    {
1155
        return $this->call(new GetChatAdministrators($chatId));
3✔
1156
    }
1157

1158
    /**
1159
     * @see https://core.telegram.org/bots/api#getchatmembercount
1160
     */
1161
    public function getChatMemberCount(int|string $chatId): FailResult|int
3✔
1162
    {
1163
        return $this->call(new GetChatMemberCount($chatId));
3✔
1164
    }
1165

1166
    /**
1167
     * @see https://core.telegram.org/bots/api#getchatmember
1168
     */
1169
    public function getChatMember(int|string $chatId, int $userId): FailResult|ChatMember
3✔
1170
    {
1171
        return $this->call(new GetChatMember($chatId, $userId));
3✔
1172
    }
1173

1174
    /**
1175
     * @see https://core.telegram.org/bots/api#getchatmenubutton
1176
     */
1177
    public function getChatMenuButton(?int $chatId = null): FailResult|MenuButton
3✔
1178
    {
1179
        return $this->call(new GetChatMenuButton($chatId));
3✔
1180
    }
1181

1182
    /**
1183
     * @see https://core.telegram.org/bots/api#getcustomemojistickers
1184
     *
1185
     * @param string[] $customEmojiIds
1186
     * @return FailResult|Sticker[]
1187
     */
1188
    public function getCustomEmojiStickers(array $customEmojiIds): FailResult|array
3✔
1189
    {
1190
        return $this->call(new GetCustomEmojiStickers($customEmojiIds));
3✔
1191
    }
1192

1193
    /**
1194
     * @see https://core.telegram.org/bots/api#getfile
1195
     */
1196
    public function getFile(string $fileId): FailResult|File
3✔
1197
    {
1198
        return $this->call(new GetFile($fileId));
3✔
1199
    }
1200

1201
    /**
1202
     * @see https://core.telegram.org/bots/api#getforumtopiciconstickers
1203
     *
1204
     * @return FailResult|Sticker[]
1205
     */
1206
    public function getForumTopicIconStickers(): FailResult|array
3✔
1207
    {
1208
        return $this->call(new GetForumTopicIconStickers());
3✔
1209
    }
1210

1211
    /**
1212
     * @see https://core.telegram.org/bots/api#getgamehighscores
1213
     *
1214
     * @return FailResult|GameHighScore[]
1215
     */
1216
    public function getGameHighScores(
3✔
1217
        int $userId,
1218
        ?int $chatId = null,
1219
        ?int $messageId = null,
1220
        ?string $inlineMessageId = null,
1221
    ): FailResult|array {
1222
        return $this->call(
3✔
1223
            new GetGameHighScores($userId, $chatId, $messageId, $inlineMessageId),
3✔
1224
        );
3✔
1225
    }
1226

1227
    /**
1228
     * @see https://core.telegram.org/bots/api#getchat
1229
     */
1230
    public function getMe(): FailResult|User
3✔
1231
    {
1232
        return $this->call(new GetMe());
3✔
1233
    }
1234

1235
    /**
1236
     * @see https://core.telegram.org/bots/api#getmycommands
1237
     */
1238
    public function getMyCommands(?BotCommandScope $scope = null, ?string $languageCode = null): FailResult|array
3✔
1239
    {
1240
        return $this->call(new GetMyCommands($scope, $languageCode));
3✔
1241
    }
1242

1243
    /**
1244
     * @see https://core.telegram.org/bots/api#getmydefaultadministratorrights
1245
     */
1246
    public function getMyDefaultAdministratorRights(?bool $forChannels = null): FailResult|ChatAdministratorRights
3✔
1247
    {
1248
        return $this->call(new GetMyDefaultAdministratorRights($forChannels));
3✔
1249
    }
1250

1251
    /**
1252
     * @see https://core.telegram.org/bots/api#getmydescription
1253
     */
1254
    public function getMyDescription(?string $languageCode = null): FailResult|BotDescription
3✔
1255
    {
1256
        return $this->call(new GetMyDescription($languageCode));
3✔
1257
    }
1258

1259
    /**
1260
     * @see https://core.telegram.org/bots/api#getmyname
1261
     */
1262
    public function getMyName(?string $languageCode = null): FailResult|BotName
3✔
1263
    {
1264
        return $this->call(new GetMyName($languageCode));
3✔
1265
    }
1266

1267
    /**
1268
     * @see https://core.telegram.org/bots/api#getmyshortdescription
1269
     */
1270
    public function getMyShortDescription(?string $languageCode = null): FailResult|BotShortDescription
3✔
1271
    {
1272
        return $this->call(new GetMyShortDescription($languageCode));
3✔
1273
    }
1274

1275
    /**
1276
     * @see https://core.telegram.org/bots/api#getstartransactions
1277
     */
1278
    public function getStarTransactions(?int $offset = null, ?int $limit = null): FailResult|StarTransactions
3✔
1279
    {
1280
        return $this->call(
3✔
1281
            new GetStarTransactions($offset, $limit),
3✔
1282
        );
3✔
1283
    }
1284

1285
    /**
1286
     * @see https://core.telegram.org/bots/api#getstickerset
1287
     */
1288
    public function getStickerSet(string $name): FailResult|StickerSet
3✔
1289
    {
1290
        return $this->call(
3✔
1291
            new GetStickerSet($name),
3✔
1292
        );
3✔
1293
    }
1294

1295
    /**
1296
     * @see https://core.telegram.org/bots/api#getupdates
1297
     *
1298
     * @param string[]|null $allowedUpdates
1299
     * @return FailResult|Update[]
1300
     */
1301
    public function getUpdates(
3✔
1302
        ?int $offset = null,
1303
        ?int $limit = null,
1304
        ?int $timeout = null,
1305
        ?array $allowedUpdates = null,
1306
    ): FailResult|array {
1307
        return $this->call(new GetUpdates($offset, $limit, $timeout, $allowedUpdates));
3✔
1308
    }
1309

1310
    /**
1311
     * @see https://core.telegram.org/bots/api#getuserchatboosts
1312
     */
1313
    public function getUserChatBoosts(int|string $chatId, int $userId): FailResult|UserChatBoosts
3✔
1314
    {
1315
        return $this->call(
3✔
1316
            new GetUserChatBoosts($chatId, $userId),
3✔
1317
        );
3✔
1318
    }
1319

1320
    /**
1321
     * @see https://core.telegram.org/bots/api#getuserprofilephotos
1322
     */
1323
    public function getUserProfilePhotos(
3✔
1324
        int $userId,
1325
        ?int $offset = null,
1326
        ?int $limit = null,
1327
    ): FailResult|UserProfilePhotos {
1328
        return $this->call(
3✔
1329
            new GetUserProfilePhotos($userId, $offset, $limit),
3✔
1330
        );
3✔
1331
    }
1332

1333
    /**
1334
     * @see https://core.telegram.org/bots/api#getwebhookinfo
1335
     */
1336
    public function getWebhookInfo(): FailResult|WebhookInfo
3✔
1337
    {
1338
        return $this->call(new GetWebhookInfo());
3✔
1339
    }
1340

1341
    /**
1342
     * @see https://core.telegram.org/bots/api#giftpremiumsubscription
1343
     *
1344
     * @param MessageEntity[]|null $textEntities
1345
     */
1346
    public function giftPremiumSubscription(
3✔
1347
        int $userId,
1348
        int $monthCount,
1349
        int $starCount,
1350
        ?string $text = null,
1351
        ?string $textParseMode = null,
1352
        ?array $textEntities = null,
1353
    ): FailResult|true {
1354
        return $this->call(
3✔
1355
            new GiftPremiumSubscription(
3✔
1356
                $userId,
3✔
1357
                $monthCount,
3✔
1358
                $starCount,
3✔
1359
                $text,
3✔
1360
                $textParseMode,
3✔
1361
                $textEntities,
3✔
1362
            ),
3✔
1363
        );
3✔
1364
    }
1365

1366
    /**
1367
     * @see https://core.telegram.org/bots/api#hidegeneralforumtopic
1368
     */
1369
    public function hideGeneralForumTopic(int|string $chatId): FailResult|true
3✔
1370
    {
1371
        return $this->call(
3✔
1372
            new HideGeneralForumTopic($chatId),
3✔
1373
        );
3✔
1374
    }
1375

1376
    /**
1377
     * @see https://core.telegram.org/bots/api#leavechat
1378
     */
1379
    public function leaveChat(int|string $chatId): FailResult|true
3✔
1380
    {
1381
        return $this->call(
3✔
1382
            new LeaveChat($chatId),
3✔
1383
        );
3✔
1384
    }
1385

1386
    /**
1387
     * @see https://core.telegram.org/bots/api#logout
1388
     */
1389
    public function logOut(): FailResult|true
6✔
1390
    {
1391
        return $this->call(new LogOut());
6✔
1392
    }
1393

1394
    /**
1395
     * @see https://core.telegram.org/bots/api#pinchatmessage
1396
     */
1397
    public function pinChatMessage(
3✔
1398
        int|string $chatId,
1399
        int $messageId,
1400
        ?bool $disableNotification = null,
1401
    ): FailResult|true {
1402
        return $this->call(
3✔
1403
            new PinChatMessage($chatId, $messageId, $disableNotification),
3✔
1404
        );
3✔
1405
    }
1406

1407
    /**
1408
     * @see https://core.telegram.org/bots/api#poststory
1409
     *
1410
     * @param MessageEntity[]|null $captionEntities
1411
     * @param StoryArea[]|null $areas
1412
     */
1413
    public function postStory(
3✔
1414
        string $businessConnectionId,
1415
        InputStoryContent $content,
1416
        int $activePeriod,
1417
        ?string $caption = null,
1418
        ?string $parseMode = null,
1419
        ?array $captionEntities = null,
1420
        ?array $areas = null,
1421
        ?bool $postToChatPage = null,
1422
        ?bool $protectContent = null,
1423
    ): FailResult|Story {
1424
        return $this->call(
3✔
1425
            new PostStory(
3✔
1426
                $businessConnectionId,
3✔
1427
                $content,
3✔
1428
                $activePeriod,
3✔
1429
                $caption,
3✔
1430
                $parseMode,
3✔
1431
                $captionEntities,
3✔
1432
                $areas,
3✔
1433
                $postToChatPage,
3✔
1434
                $protectContent,
3✔
1435
            ),
3✔
1436
        );
3✔
1437
    }
1438

1439
    /**
1440
     * @see https://core.telegram.org/bots/api#promotechatmember
1441
     */
1442
    public function promoteChatMember(
3✔
1443
        int|string $chatId,
1444
        int $userId,
1445
        ?bool $isAnonymous = null,
1446
        ?bool $canManageChat = null,
1447
        ?bool $canDeleteMessages = null,
1448
        ?bool $canManageVideoChats = null,
1449
        ?bool $canRestrictMembers = null,
1450
        ?bool $canPromoteMembers = null,
1451
        ?bool $canChangeInfo = null,
1452
        ?bool $canInviteUsers = null,
1453
        ?bool $canPostStories = null,
1454
        ?bool $canEditStories = null,
1455
        ?bool $canDeleteStories = null,
1456
        ?bool $canPostMessages = null,
1457
        ?bool $canEditMessages = null,
1458
        ?bool $canPinMessages = null,
1459
        ?bool $canManageTopics = null,
1460
    ): FailResult|true {
1461
        return $this->call(
3✔
1462
            new PromoteChatMember(
3✔
1463
                $chatId,
3✔
1464
                $userId,
3✔
1465
                $isAnonymous,
3✔
1466
                $canManageChat,
3✔
1467
                $canDeleteMessages,
3✔
1468
                $canManageVideoChats,
3✔
1469
                $canRestrictMembers,
3✔
1470
                $canPromoteMembers,
3✔
1471
                $canChangeInfo,
3✔
1472
                $canInviteUsers,
3✔
1473
                $canPostStories,
3✔
1474
                $canEditStories,
3✔
1475
                $canDeleteStories,
3✔
1476
                $canPostMessages,
3✔
1477
                $canEditMessages,
3✔
1478
                $canPinMessages,
3✔
1479
                $canManageTopics,
3✔
1480
            ),
3✔
1481
        );
3✔
1482
    }
1483

1484
    /**
1485
     * @see https://core.telegram.org/bots/api#readbusinessmessage
1486
     */
1487
    public function readBusinessMessage(
3✔
1488
        string $businessConnectionId,
1489
        int $chatId,
1490
        int $messageId,
1491
    ): FailResult|true {
1492
        return $this->call(
3✔
1493
            new ReadBusinessMessage($businessConnectionId, $chatId, $messageId),
3✔
1494
        );
3✔
1495
    }
1496

1497
    /**
1498
     * @see https://core.telegram.org/bots/api#refundstarpayment
1499
     */
1500
    public function refundStarPayment(int $userId, string $telegramPaymentChargeId): FailResult|true
3✔
1501
    {
1502
        return $this->call(
3✔
1503
            new RefundStarPayment($userId, $telegramPaymentChargeId),
3✔
1504
        );
3✔
1505
    }
1506

1507
    /**
1508
     * @see https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
1509
     */
1510
    public function removeBusinessAccountProfilePhoto(
3✔
1511
        string $businessConnectionId,
1512
        ?bool $isPublic = null,
1513
    ): FailResult|true {
1514
        return $this->call(
3✔
1515
            new RemoveBusinessAccountProfilePhoto($businessConnectionId, $isPublic),
3✔
1516
        );
3✔
1517
    }
1518

1519
    /**
1520
     * @see https://core.telegram.org/bots/api#removechatverification
1521
     */
1522
    public function removeChatVerification(int|string $chatId): FailResult|true
3✔
1523
    {
1524
        return $this->call(
3✔
1525
            new RemoveChatVerification($chatId),
3✔
1526
        );
3✔
1527
    }
1528

1529
    /**
1530
     * @see https://core.telegram.org/bots/api#removeuserverification
1531
     */
1532
    public function removeUserVerification(int $userId): FailResult|true
3✔
1533
    {
1534
        return $this->call(
3✔
1535
            new RemoveUserVerification($userId),
3✔
1536
        );
3✔
1537
    }
1538

1539
    /**
1540
     * @see https://core.telegram.org/bots/api#reopenforumtopic
1541
     */
1542
    public function reopenForumTopic(int|string $chatId, int $messageThreadId): FailResult|true
3✔
1543
    {
1544
        return $this->call(
3✔
1545
            new ReopenForumTopic($chatId, $messageThreadId),
3✔
1546
        );
3✔
1547
    }
1548

1549
    /**
1550
     * @see https://core.telegram.org/bots/api#reopengeneralforumtopic
1551
     */
1552
    public function reopenGeneralForumTopic(int|string $chatId): FailResult|true
3✔
1553
    {
1554
        return $this->call(
3✔
1555
            new ReopenGeneralForumTopic($chatId),
3✔
1556
        );
3✔
1557
    }
1558

1559
    /**
1560
     * @see https://core.telegram.org/bots/api#replacestickerinset
1561
     */
1562
    public function replaceStickerInSet(
3✔
1563
        int $userId,
1564
        string $name,
1565
        string $oldSticker,
1566
        InputSticker $sticker,
1567
    ): FailResult|true {
1568
        return $this->call(
3✔
1569
            new ReplaceStickerInSet($userId, $name, $oldSticker, $sticker),
3✔
1570
        );
3✔
1571
    }
1572

1573
    /**
1574
     * @see https://core.telegram.org/bots/api#restrictchatmember
1575
     */
1576
    public function restrictChatMember(
3✔
1577
        int|string $chatId,
1578
        int $userId,
1579
        ChatPermissions $permissions,
1580
        ?bool $useIndependentChatPermissions = null,
1581
        ?DateTimeImmutable $untilDate = null,
1582
    ): FailResult|true {
1583
        return $this->call(
3✔
1584
            new RestrictChatMember($chatId, $userId, $permissions, $useIndependentChatPermissions, $untilDate),
3✔
1585
        );
3✔
1586
    }
1587

1588
    /**
1589
     * @see https://core.telegram.org/bots/api#revokechatinvitelink
1590
     */
1591
    public function revokeChatInviteLink(int|string $chatId, string $inviteLink): FailResult|ChatInviteLink
3✔
1592
    {
1593
        return $this->call(
3✔
1594
            new RevokeChatInviteLink($chatId, $inviteLink),
3✔
1595
        );
3✔
1596
    }
1597

1598
    /**
1599
     * @see https://core.telegram.org/bots/api#savepreparedinlinemessage
1600
     */
1601
    public function savePreparedInlineMessage(
3✔
1602
        int $userId,
1603
        InlineQueryResult $result,
1604
        ?bool $allowUserChats = null,
1605
        ?bool $allowBotChats = null,
1606
        ?bool $allowGroupChats = null,
1607
        ?bool $allowChannelChats = null,
1608
    ): FailResult|PreparedInlineMessage {
1609
        return $this->call(
3✔
1610
            new SavePreparedInlineMessage(
3✔
1611
                $userId,
3✔
1612
                $result,
3✔
1613
                $allowUserChats,
3✔
1614
                $allowBotChats,
3✔
1615
                $allowGroupChats,
3✔
1616
                $allowChannelChats,
3✔
1617
            ),
3✔
1618
        );
3✔
1619
    }
1620

1621
    /**
1622
     * @param MessageEntity[]|null $captionEntities
1623
     *
1624
     * @see https://core.telegram.org/bots/api#sendanimation
1625
     */
1626
    public function sendAnimation(
3✔
1627
        int|string $chatId,
1628
        InputFile|string $animation,
1629
        ?string $businessConnectionId = null,
1630
        ?int $messageThreadId = null,
1631
        ?int $duration = null,
1632
        ?int $width = null,
1633
        ?int $height = null,
1634
        InputFile|string|null $thumbnail = null,
1635
        ?string $caption = null,
1636
        ?string $parseMode = null,
1637
        ?array $captionEntities = null,
1638
        ?bool $showCaptionAboveMedia = null,
1639
        ?bool $hasSpoiler = null,
1640
        ?bool $disableNotification = null,
1641
        ?bool $protectContent = null,
1642
        ?string $messageEffectId = null,
1643
        ?ReplyParameters $replyParameters = null,
1644
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1645
        ?bool $allowPaidBroadcast = null,
1646
    ): FailResult|Message {
1647
        return $this->call(
3✔
1648
            new SendAnimation(
3✔
1649
                $chatId,
3✔
1650
                $animation,
3✔
1651
                $businessConnectionId,
3✔
1652
                $messageThreadId,
3✔
1653
                $duration,
3✔
1654
                $width,
3✔
1655
                $height,
3✔
1656
                $thumbnail,
3✔
1657
                $caption,
3✔
1658
                $parseMode,
3✔
1659
                $captionEntities,
3✔
1660
                $showCaptionAboveMedia,
3✔
1661
                $hasSpoiler,
3✔
1662
                $disableNotification,
3✔
1663
                $protectContent,
3✔
1664
                $messageEffectId,
3✔
1665
                $replyParameters,
3✔
1666
                $replyMarkup,
3✔
1667
                $allowPaidBroadcast,
3✔
1668
            ),
3✔
1669
        );
3✔
1670
    }
1671

1672
    /**
1673
     * @param MessageEntity[]|null $captionEntities
1674
     *
1675
     * @see https://core.telegram.org/bots/api#sendaudio
1676
     */
1677
    public function sendAudio(
3✔
1678
        int|string $chatId,
1679
        string|InputFile $audio,
1680
        ?string $businessConnectionId = null,
1681
        ?int $messageThreadId = null,
1682
        ?string $caption = null,
1683
        ?string $parseMode = null,
1684
        ?array $captionEntities = null,
1685
        ?int $duration = null,
1686
        ?string $performer = null,
1687
        ?string $title = null,
1688
        string|InputFile|null $thumbnail = null,
1689
        ?bool $disableNotification = null,
1690
        ?bool $protectContent = null,
1691
        ?string $messageEffectId = null,
1692
        ?ReplyParameters $replyParameters = null,
1693
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1694
        ?bool $allowPaidBroadcast = null,
1695
    ): FailResult|Message {
1696
        return $this->call(
3✔
1697
            new SendAudio(
3✔
1698
                $chatId,
3✔
1699
                $audio,
3✔
1700
                $businessConnectionId,
3✔
1701
                $messageThreadId,
3✔
1702
                $caption,
3✔
1703
                $parseMode,
3✔
1704
                $captionEntities,
3✔
1705
                $duration,
3✔
1706
                $performer,
3✔
1707
                $title,
3✔
1708
                $thumbnail,
3✔
1709
                $disableNotification,
3✔
1710
                $protectContent,
3✔
1711
                $messageEffectId,
3✔
1712
                $replyParameters,
3✔
1713
                $replyMarkup,
3✔
1714
                $allowPaidBroadcast,
3✔
1715
            ),
3✔
1716
        );
3✔
1717
    }
1718

1719
    /**
1720
     * @see https://core.telegram.org/bots/api#sendchataction
1721
     */
1722
    public function sendChatAction(
3✔
1723
        int|string $chatId,
1724
        string $action,
1725
        ?string $businessConnectionId = null,
1726
        ?int $messageThreadId = null,
1727
    ): FailResult|true {
1728
        return $this->call(
3✔
1729
            new SendChatAction(
3✔
1730
                $chatId,
3✔
1731
                $action,
3✔
1732
                $businessConnectionId,
3✔
1733
                $messageThreadId,
3✔
1734
            ),
3✔
1735
        );
3✔
1736
    }
1737

1738
    /**
1739
     * @see https://core.telegram.org/bots/api#sendcontact
1740
     */
1741
    public function sendContact(
3✔
1742
        int|string $chatId,
1743
        string $phoneNumber,
1744
        string $firstName,
1745
        ?string $businessConnectionId = null,
1746
        ?int $messageThreadId = null,
1747
        ?string $lastName = null,
1748
        ?string $vcard = null,
1749
        ?bool $disableNotification = null,
1750
        ?bool $protectContent = null,
1751
        ?string $messageEffectId = null,
1752
        ?ReplyParameters $replyParameters = null,
1753
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1754
        ?bool $allowPaidBroadcast = null,
1755
    ): FailResult|Message {
1756
        return $this->call(
3✔
1757
            new SendContact(
3✔
1758
                $chatId,
3✔
1759
                $phoneNumber,
3✔
1760
                $firstName,
3✔
1761
                $businessConnectionId,
3✔
1762
                $messageThreadId,
3✔
1763
                $lastName,
3✔
1764
                $vcard,
3✔
1765
                $disableNotification,
3✔
1766
                $protectContent,
3✔
1767
                $messageEffectId,
3✔
1768
                $replyParameters,
3✔
1769
                $replyMarkup,
3✔
1770
                $allowPaidBroadcast,
3✔
1771
            ),
3✔
1772
        );
3✔
1773
    }
1774

1775
    /**
1776
     * @see https://core.telegram.org/bots/api#senddice
1777
     */
1778
    public function sendDice(
3✔
1779
        int|string $chatId,
1780
        ?string $businessConnectionId = null,
1781
        ?int $messageThreadId = null,
1782
        ?string $emoji = null,
1783
        ?bool $disableNotification = null,
1784
        ?bool $protectContent = null,
1785
        ?string $messageEffectId = null,
1786
        ?ReplyParameters $replyParameters = null,
1787
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1788
        ?bool $allowPaidBroadcast = null,
1789
    ): FailResult|Message {
1790
        return $this->call(
3✔
1791
            new SendDice(
3✔
1792
                $chatId,
3✔
1793
                $businessConnectionId,
3✔
1794
                $messageThreadId,
3✔
1795
                $emoji,
3✔
1796
                $disableNotification,
3✔
1797
                $protectContent,
3✔
1798
                $messageEffectId,
3✔
1799
                $replyParameters,
3✔
1800
                $replyMarkup,
3✔
1801
                $allowPaidBroadcast,
3✔
1802
            ),
3✔
1803
        );
3✔
1804
    }
1805

1806
    /**
1807
     * @param MessageEntity[]|null $captionEntities
1808
     *
1809
     * @see https://core.telegram.org/bots/api#senddocument
1810
     */
1811
    public function sendDocument(
3✔
1812
        int|string $chatId,
1813
        string|InputFile $document,
1814
        ?string $businessConnectionId = null,
1815
        ?int $messageThreadId = null,
1816
        string|InputFile|null $thumbnail = null,
1817
        ?string $caption = null,
1818
        ?string $parseMode = null,
1819
        ?array $captionEntities = null,
1820
        ?bool $disableContentTypeDetection = null,
1821
        ?bool $disableNotification = null,
1822
        ?bool $protectContent = null,
1823
        ?string $messageEffectId = null,
1824
        ?ReplyParameters $replyParameters = null,
1825
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1826
        ?bool $allowPaidBroadcast = null,
1827
    ): FailResult|Message {
1828
        return $this->call(
3✔
1829
            new SendDocument(
3✔
1830
                $chatId,
3✔
1831
                $document,
3✔
1832
                $businessConnectionId,
3✔
1833
                $messageThreadId,
3✔
1834
                $thumbnail,
3✔
1835
                $caption,
3✔
1836
                $parseMode,
3✔
1837
                $captionEntities,
3✔
1838
                $disableContentTypeDetection,
3✔
1839
                $disableNotification,
3✔
1840
                $protectContent,
3✔
1841
                $messageEffectId,
3✔
1842
                $replyParameters,
3✔
1843
                $replyMarkup,
3✔
1844
                $allowPaidBroadcast,
3✔
1845
            ),
3✔
1846
        );
3✔
1847
    }
1848

1849
    /**
1850
     * @see https://core.telegram.org/bots/api#sendgame
1851
     */
1852
    public function sendGame(
3✔
1853
        int $chatId,
1854
        string $gameShortName,
1855
        ?string $businessConnectionId = null,
1856
        ?int $messageThreadId = null,
1857
        ?bool $disableNotification = null,
1858
        ?bool $protectContent = null,
1859
        ?string $messageEffectId = null,
1860
        ?ReplyParameters $replyParameters = null,
1861
        ?InlineKeyboardMarkup $replyMarkup = null,
1862
        ?bool $allowPaidBroadcast = null,
1863
    ): FailResult|Message {
1864
        return $this->call(
3✔
1865
            new SendGame(
3✔
1866
                $chatId,
3✔
1867
                $gameShortName,
3✔
1868
                $businessConnectionId,
3✔
1869
                $messageThreadId,
3✔
1870
                $disableNotification,
3✔
1871
                $protectContent,
3✔
1872
                $messageEffectId,
3✔
1873
                $replyParameters,
3✔
1874
                $replyMarkup,
3✔
1875
                $allowPaidBroadcast,
3✔
1876
            ),
3✔
1877
        );
3✔
1878
    }
1879

1880
    /**
1881
     * @see https://core.telegram.org/bots/api#sendgift
1882
     *
1883
     * @param MessageEntity[]|null $textEntities
1884
     */
1885
    public function sendGift(
3✔
1886
        int $userId,
1887
        string $giftId,
1888
        ?string $text = null,
1889
        ?string $textParseMode = null,
1890
        ?array $textEntities = null,
1891
        ?bool $payForUpgrade = null,
1892
        int|string|null $chatId = null,
1893
    ): FailResult|true {
1894
        return $this->call(
3✔
1895
            new SendGift(
3✔
1896
                $userId,
3✔
1897
                $giftId,
3✔
1898
                $text,
3✔
1899
                $textParseMode,
3✔
1900
                $textEntities,
3✔
1901
                $payForUpgrade,
3✔
1902
                $chatId,
3✔
1903
            ),
3✔
1904
        );
3✔
1905
    }
1906

1907
    /**
1908
     * @see https://core.telegram.org/bots/api#sendinvoice
1909
     *
1910
     * @param LabeledPrice[] $prices
1911
     * @param int[]|null $suggestedTipAmounts
1912
     */
1913
    public function sendInvoice(
3✔
1914
        int|string $chatId,
1915
        string $title,
1916
        string $description,
1917
        string $payload,
1918
        string $currency,
1919
        array $prices,
1920
        ?int $messageThreadId = null,
1921
        #[SensitiveParameter]
1922
        ?string $providerToken = null,
1923
        ?int $maxTipAmount = null,
1924
        ?array $suggestedTipAmounts = null,
1925
        ?string $startParameter = null,
1926
        ?string $providerData = null,
1927
        ?string $photoUrl = null,
1928
        ?int $photoSize = null,
1929
        ?int $photoWidth = null,
1930
        ?int $photoHeight = null,
1931
        ?bool $needName = null,
1932
        ?bool $needPhoneNumber = null,
1933
        ?bool $needEmail = null,
1934
        ?bool $needShippingAddress = null,
1935
        ?bool $sendPhoneNumberToProvider = null,
1936
        ?bool $sendEmailToProvider = null,
1937
        ?bool $isFlexible = null,
1938
        ?bool $disableNotification = null,
1939
        ?bool $protectContent = null,
1940
        ?string $messageEffectId = null,
1941
        ?ReplyParameters $replyParameters = null,
1942
        ?InlineKeyboardMarkup $replyMarkup = null,
1943
        ?bool $allowPaidBroadcast = null,
1944
    ): FailResult|Message {
1945
        return $this->call(
3✔
1946
            new SendInvoice(
3✔
1947
                $chatId,
3✔
1948
                $title,
3✔
1949
                $description,
3✔
1950
                $payload,
3✔
1951
                $currency,
3✔
1952
                $prices,
3✔
1953
                $messageThreadId,
3✔
1954
                $providerToken,
3✔
1955
                $maxTipAmount,
3✔
1956
                $suggestedTipAmounts,
3✔
1957
                $startParameter,
3✔
1958
                $providerData,
3✔
1959
                $photoUrl,
3✔
1960
                $photoSize,
3✔
1961
                $photoWidth,
3✔
1962
                $photoHeight,
3✔
1963
                $needName,
3✔
1964
                $needPhoneNumber,
3✔
1965
                $needEmail,
3✔
1966
                $needShippingAddress,
3✔
1967
                $sendPhoneNumberToProvider,
3✔
1968
                $sendEmailToProvider,
3✔
1969
                $isFlexible,
3✔
1970
                $disableNotification,
3✔
1971
                $protectContent,
3✔
1972
                $messageEffectId,
3✔
1973
                $replyParameters,
3✔
1974
                $replyMarkup,
3✔
1975
                $allowPaidBroadcast,
3✔
1976
            ),
3✔
1977
        );
3✔
1978
    }
1979

1980
    /**
1981
     * @see https://core.telegram.org/bots/api#sendlocation
1982
     */
1983
    public function sendLocation(
3✔
1984
        int|string $chatId,
1985
        float $latitude,
1986
        float $longitude,
1987
        ?string $businessConnectionId = null,
1988
        ?int $messageThreadId = null,
1989
        ?float $horizontalAccuracy = null,
1990
        ?int $livePeriod = null,
1991
        ?int $heading = null,
1992
        ?int $proximityAlertRadius = null,
1993
        ?bool $disableNotification = null,
1994
        ?bool $protectContent = null,
1995
        ?string $messageEffectId = null,
1996
        ?ReplyParameters $replyParameters = null,
1997
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1998
        ?bool $allowPaidBroadcast = null,
1999
    ): FailResult|Message {
2000
        return $this->call(
3✔
2001
            new SendLocation(
3✔
2002
                $chatId,
3✔
2003
                $latitude,
3✔
2004
                $longitude,
3✔
2005
                $businessConnectionId,
3✔
2006
                $messageThreadId,
3✔
2007
                $horizontalAccuracy,
3✔
2008
                $livePeriod,
3✔
2009
                $heading,
3✔
2010
                $proximityAlertRadius,
3✔
2011
                $disableNotification,
3✔
2012
                $protectContent,
3✔
2013
                $messageEffectId,
3✔
2014
                $replyParameters,
3✔
2015
                $replyMarkup,
3✔
2016
                $allowPaidBroadcast,
3✔
2017
            ),
3✔
2018
        );
3✔
2019
    }
2020

2021
    /**
2022
     * @see https://core.telegram.org/bots/api#sendmediagroup
2023
     *
2024
     * @param InputMediaAudio[]|InputMediaDocument[]|InputMediaPhoto[]|InputMediaVideo[] $media
2025
     * @return FailResult|Message[]
2026
     */
2027
    public function sendMediaGroup(
3✔
2028
        int|string $chatId,
2029
        array $media,
2030
        ?string $businessConnectionId = null,
2031
        ?int $messageThreadId = null,
2032
        ?bool $disableNotification = null,
2033
        ?bool $protectContent = null,
2034
        ?string $messageEffectId = null,
2035
        ?ReplyParameters $replyParameters = null,
2036
        ?bool $allowPaidBroadcast = null,
2037
    ): FailResult|array {
2038
        return $this->call(
3✔
2039
            new SendMediaGroup(
3✔
2040
                $chatId,
3✔
2041
                $media,
3✔
2042
                $businessConnectionId,
3✔
2043
                $messageThreadId,
3✔
2044
                $disableNotification,
3✔
2045
                $protectContent,
3✔
2046
                $messageEffectId,
3✔
2047
                $replyParameters,
3✔
2048
                $allowPaidBroadcast,
3✔
2049
            ),
3✔
2050
        );
3✔
2051
    }
2052

2053
    /**
2054
     * @param MessageEntity[]|null $entities
2055
     *
2056
     * @see https://core.telegram.org/bots/api#sendmessage
2057
     */
2058
    public function sendMessage(
3✔
2059
        int|string $chatId,
2060
        string $text,
2061
        ?string $businessConnectionId = null,
2062
        ?int $messageThreadId = null,
2063
        ?string $parseMode = null,
2064
        ?array $entities = null,
2065
        ?LinkPreviewOptions $linkPreviewOptions = null,
2066
        ?bool $disableNotification = null,
2067
        ?bool $protectContent = null,
2068
        ?string $messageEffectId = null,
2069
        ?ReplyParameters $replyParameters = null,
2070
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2071
        ?bool $allowPaidBroadcast = null,
2072
    ): FailResult|Message {
2073
        return $this->call(
3✔
2074
            new SendMessage(
3✔
2075
                $chatId,
3✔
2076
                $text,
3✔
2077
                $businessConnectionId,
3✔
2078
                $messageThreadId,
3✔
2079
                $parseMode,
3✔
2080
                $entities,
3✔
2081
                $linkPreviewOptions,
3✔
2082
                $disableNotification,
3✔
2083
                $protectContent,
3✔
2084
                $messageEffectId,
3✔
2085
                $replyParameters,
3✔
2086
                $replyMarkup,
3✔
2087
                $allowPaidBroadcast,
3✔
2088
            ),
3✔
2089
        );
3✔
2090
    }
2091

2092
    /**
2093
     * @see https://core.telegram.org/bots/api#sendpaidmedia
2094
     *
2095
     * @param InputPaidMedia[] $media
2096
     * @param MessageEntity[]|null $captionEntities
2097
     */
2098
    public function sendPaidMedia(
3✔
2099
        int|string $chatId,
2100
        int $starCount,
2101
        array $media,
2102
        ?string $caption = null,
2103
        ?string $parseMode = null,
2104
        ?array $captionEntities = null,
2105
        ?bool $showCaptionAboveMedia = null,
2106
        ?bool $disableNotification = null,
2107
        ?bool $protectContent = null,
2108
        ?ReplyParameters $replyParameters = null,
2109
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2110
        ?string $businessConnectionId = null,
2111
        ?string $payload = null,
2112
        ?bool $allowPaidBroadcast = null,
2113
    ): FailResult|Message {
2114
        return $this->call(
3✔
2115
            new SendPaidMedia(
3✔
2116
                $chatId,
3✔
2117
                $starCount,
3✔
2118
                $media,
3✔
2119
                $caption,
3✔
2120
                $parseMode,
3✔
2121
                $captionEntities,
3✔
2122
                $showCaptionAboveMedia,
3✔
2123
                $disableNotification,
3✔
2124
                $protectContent,
3✔
2125
                $replyParameters,
3✔
2126
                $replyMarkup,
3✔
2127
                $businessConnectionId,
3✔
2128
                $payload,
3✔
2129
                $allowPaidBroadcast,
3✔
2130
            ),
3✔
2131
        );
3✔
2132
    }
2133

2134
    /**
2135
     * @param MessageEntity[]|null $captionEntities
2136
     *
2137
     * @see https://core.telegram.org/bots/api#sendphoto
2138
     */
2139
    public function sendPhoto(
3✔
2140
        int|string $chatId,
2141
        string|InputFile $photo,
2142
        ?string $businessConnectionId = null,
2143
        ?int $messageThreadId = null,
2144
        ?string $caption = null,
2145
        ?string $parseMode = null,
2146
        ?array $captionEntities = null,
2147
        ?bool $showCaptionAboveMedia = null,
2148
        ?bool $hasSpoiler = null,
2149
        ?bool $disableNotification = null,
2150
        ?bool $protectContent = null,
2151
        ?string $messageEffectId = null,
2152
        ?ReplyParameters $replyParameters = null,
2153
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2154
        ?bool $allowPaidBroadcast = null,
2155
    ): FailResult|Message {
2156
        return $this->call(
3✔
2157
            new SendPhoto(
3✔
2158
                $chatId,
3✔
2159
                $photo,
3✔
2160
                $businessConnectionId,
3✔
2161
                $messageThreadId,
3✔
2162
                $caption,
3✔
2163
                $parseMode,
3✔
2164
                $captionEntities,
3✔
2165
                $showCaptionAboveMedia,
3✔
2166
                $hasSpoiler,
3✔
2167
                $disableNotification,
3✔
2168
                $protectContent,
3✔
2169
                $messageEffectId,
3✔
2170
                $replyParameters,
3✔
2171
                $replyMarkup,
3✔
2172
                $allowPaidBroadcast,
3✔
2173
            ),
3✔
2174
        );
3✔
2175
    }
2176

2177
    /**
2178
     * @param InputPollOption[] $options
2179
     * @param MessageEntity[]|null $questionEntities
2180
     * @param MessageEntity[]|null $explanationEntities
2181
     *
2182
     * @see https://core.telegram.org/bots/api#sendpoll
2183
     */
2184
    public function sendPoll(
3✔
2185
        int|string $chatId,
2186
        string $question,
2187
        array $options,
2188
        ?string $businessConnectionId = null,
2189
        ?int $messageThreadId = null,
2190
        ?string $questionParseMode = null,
2191
        ?array $questionEntities = null,
2192
        ?bool $isAnonymous = null,
2193
        ?string $type = null,
2194
        ?bool $allowsMultipleAnswers = null,
2195
        ?int $correctOptionId = null,
2196
        ?string $explanation = null,
2197
        ?string $explanationParseMode = null,
2198
        ?array $explanationEntities = null,
2199
        ?int $openPeriod = null,
2200
        ?DateTimeImmutable $closeDate = null,
2201
        ?bool $isClosed = null,
2202
        ?bool $disableNotification = null,
2203
        ?bool $protectContent = null,
2204
        ?string $messageEffectId = null,
2205
        ?ReplyParameters $replyParameters = null,
2206
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2207
        ?bool $allowPaidBroadcast = null,
2208
    ): FailResult|Message {
2209
        return $this->call(
3✔
2210
            new SendPoll(
3✔
2211
                $chatId,
3✔
2212
                $question,
3✔
2213
                $options,
3✔
2214
                $businessConnectionId,
3✔
2215
                $messageThreadId,
3✔
2216
                $questionParseMode,
3✔
2217
                $questionEntities,
3✔
2218
                $isAnonymous,
3✔
2219
                $type,
3✔
2220
                $allowsMultipleAnswers,
3✔
2221
                $correctOptionId,
3✔
2222
                $explanation,
3✔
2223
                $explanationParseMode,
3✔
2224
                $explanationEntities,
3✔
2225
                $openPeriod,
3✔
2226
                $closeDate,
3✔
2227
                $isClosed,
3✔
2228
                $disableNotification,
3✔
2229
                $protectContent,
3✔
2230
                $messageEffectId,
3✔
2231
                $replyParameters,
3✔
2232
                $replyMarkup,
3✔
2233
                $allowPaidBroadcast,
3✔
2234
            ),
3✔
2235
        );
3✔
2236
    }
2237

2238
    /**
2239
     * @see https://core.telegram.org/bots/api#sendsticker
2240
     */
2241
    public function sendSticker(
3✔
2242
        int|string $chatId,
2243
        InputFile|string $sticker,
2244
        ?string $businessConnectionId = null,
2245
        ?int $messageThreadId = null,
2246
        ?string $emoji = null,
2247
        ?bool $disableNotification = null,
2248
        ?bool $protectContent = null,
2249
        ?string $messageEffectId = null,
2250
        ?ReplyParameters $replyParameters = null,
2251
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2252
        ?bool $allowPaidBroadcast = null,
2253
    ): FailResult|Message {
2254
        return $this->call(
3✔
2255
            new SendSticker(
3✔
2256
                $chatId,
3✔
2257
                $sticker,
3✔
2258
                $businessConnectionId,
3✔
2259
                $messageThreadId,
3✔
2260
                $emoji,
3✔
2261
                $disableNotification,
3✔
2262
                $protectContent,
3✔
2263
                $messageEffectId,
3✔
2264
                $replyParameters,
3✔
2265
                $replyMarkup,
3✔
2266
                $allowPaidBroadcast,
3✔
2267
            ),
3✔
2268
        );
3✔
2269
    }
2270

2271
    /**
2272
     * @see https://core.telegram.org/bots/api#sendvenue
2273
     */
2274
    public function sendVenue(
3✔
2275
        int|string $chatId,
2276
        float $latitude,
2277
        float $longitude,
2278
        string $title,
2279
        string $address,
2280
        ?string $businessConnectionId = null,
2281
        ?int $messageThreadId = null,
2282
        ?string $foursquareId = null,
2283
        ?string $foursquareType = null,
2284
        ?string $googlePlaceId = null,
2285
        ?string $googlePlaceType = null,
2286
        ?bool $disableNotification = null,
2287
        ?bool $protectContent = null,
2288
        ?string $messageEffectId = null,
2289
        ?ReplyParameters $replyParameters = null,
2290
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2291
        ?bool $allowPaidBroadcast = null,
2292
    ): FailResult|Message {
2293
        return $this->call(
3✔
2294
            new SendVenue(
3✔
2295
                $chatId,
3✔
2296
                $latitude,
3✔
2297
                $longitude,
3✔
2298
                $title,
3✔
2299
                $address,
3✔
2300
                $businessConnectionId,
3✔
2301
                $messageThreadId,
3✔
2302
                $foursquareId,
3✔
2303
                $foursquareType,
3✔
2304
                $googlePlaceId,
3✔
2305
                $googlePlaceType,
3✔
2306
                $disableNotification,
3✔
2307
                $protectContent,
3✔
2308
                $messageEffectId,
3✔
2309
                $replyParameters,
3✔
2310
                $replyMarkup,
3✔
2311
                $allowPaidBroadcast,
3✔
2312
            ),
3✔
2313
        );
3✔
2314
    }
2315

2316
    /**
2317
     * @param MessageEntity[]|null $captionEntities
2318
     *
2319
     * @see https://core.telegram.org/bots/api#sendvideo
2320
     */
2321
    public function sendVideo(
3✔
2322
        int|string $chatId,
2323
        string|InputFile $video,
2324
        ?string $businessConnectionId = null,
2325
        ?int $messageThreadId = null,
2326
        ?int $duration = null,
2327
        ?int $width = null,
2328
        ?int $height = null,
2329
        string|InputFile|null $thumbnail = null,
2330
        ?string $caption = null,
2331
        ?string $parseMode = null,
2332
        ?array $captionEntities = null,
2333
        ?bool $showCaptionAboveMedia = null,
2334
        ?bool $hasSpoiler = null,
2335
        ?bool $supportsStreaming = null,
2336
        ?bool $disableNotification = null,
2337
        ?bool $protectContent = null,
2338
        ?string $messageEffectId = null,
2339
        ?ReplyParameters $replyParameters = null,
2340
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2341
        ?bool $allowPaidBroadcast = null,
2342
        string|InputFile|null $cover = null,
2343
        ?int $startTimestamp = null,
2344
    ): FailResult|Message {
2345
        return $this->call(
3✔
2346
            new SendVideo(
3✔
2347
                $chatId,
3✔
2348
                $video,
3✔
2349
                $businessConnectionId,
3✔
2350
                $messageThreadId,
3✔
2351
                $duration,
3✔
2352
                $width,
3✔
2353
                $height,
3✔
2354
                $thumbnail,
3✔
2355
                $caption,
3✔
2356
                $parseMode,
3✔
2357
                $captionEntities,
3✔
2358
                $showCaptionAboveMedia,
3✔
2359
                $hasSpoiler,
3✔
2360
                $supportsStreaming,
3✔
2361
                $disableNotification,
3✔
2362
                $protectContent,
3✔
2363
                $messageEffectId,
3✔
2364
                $replyParameters,
3✔
2365
                $replyMarkup,
3✔
2366
                $allowPaidBroadcast,
3✔
2367
                $cover,
3✔
2368
                $startTimestamp,
3✔
2369
            ),
3✔
2370
        );
3✔
2371
    }
2372

2373
    /**
2374
     * @see https://core.telegram.org/bots/api#sendvideonote
2375
     */
2376
    public function sendVideoNote(
3✔
2377
        int|string $chatId,
2378
        string|InputFile $videoNote,
2379
        ?string $businessConnectionId = null,
2380
        ?int $messageThreadId = null,
2381
        ?int $duration = null,
2382
        ?int $length = null,
2383
        string|InputFile|null $thumbnail = null,
2384
        ?bool $disableNotification = null,
2385
        ?bool $protectContent = null,
2386
        ?string $messageEffectId = null,
2387
        ?ReplyParameters $replyParameters = null,
2388
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2389
        ?bool $allowPaidBroadcast = null,
2390
    ): FailResult|Message {
2391
        return $this->call(
3✔
2392
            new SendVideoNote(
3✔
2393
                $chatId,
3✔
2394
                $videoNote,
3✔
2395
                $businessConnectionId,
3✔
2396
                $messageThreadId,
3✔
2397
                $duration,
3✔
2398
                $length,
3✔
2399
                $thumbnail,
3✔
2400
                $disableNotification,
3✔
2401
                $protectContent,
3✔
2402
                $messageEffectId,
3✔
2403
                $replyParameters,
3✔
2404
                $replyMarkup,
3✔
2405
                $allowPaidBroadcast,
3✔
2406
            ),
3✔
2407
        );
3✔
2408
    }
2409

2410
    /**
2411
     * @param MessageEntity[]|null $captionEntities
2412
     *
2413
     * @see https://core.telegram.org/bots/api#sendvoice
2414
     */
2415
    public function sendVoice(
3✔
2416
        int|string $chatId,
2417
        string|InputFile $voice,
2418
        ?string $businessConnectionId = null,
2419
        ?int $messageThreadId = null,
2420
        ?string $caption = null,
2421
        ?string $parseMode = null,
2422
        ?array $captionEntities = null,
2423
        ?int $duration = null,
2424
        ?bool $disableNotification = null,
2425
        ?bool $protectContent = null,
2426
        ?string $messageEffectId = null,
2427
        ?ReplyParameters $replyParameters = null,
2428
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2429
        ?bool $allowPaidBroadcast = null,
2430
    ): FailResult|Message {
2431
        return $this->call(
3✔
2432
            new SendVoice(
3✔
2433
                $chatId,
3✔
2434
                $voice,
3✔
2435
                $businessConnectionId,
3✔
2436
                $messageThreadId,
3✔
2437
                $caption,
3✔
2438
                $parseMode,
3✔
2439
                $captionEntities,
3✔
2440
                $duration,
3✔
2441
                $disableNotification,
3✔
2442
                $protectContent,
3✔
2443
                $messageEffectId,
3✔
2444
                $replyParameters,
3✔
2445
                $replyMarkup,
3✔
2446
                $allowPaidBroadcast,
3✔
2447
            ),
3✔
2448
        );
3✔
2449
    }
2450

2451
    /**
2452
     * @see https://core.telegram.org/bots/api#setbusinessaccountbio
2453
     */
2454
    public function setBusinessAccountBio(string $businessConnectionId, ?string $bio = null): FailResult|true
3✔
2455
    {
2456
        return $this->call(
3✔
2457
            new SetBusinessAccountBio($businessConnectionId, $bio),
3✔
2458
        );
3✔
2459
    }
2460

2461
    /**
2462
     * @see https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
2463
     */
2464
    public function setBusinessAccountGiftSettings(
3✔
2465
        string $businessConnectionId,
2466
        bool $showGiftButton,
2467
        AcceptedGiftTypes $acceptedGiftTypes,
2468
    ): FailResult|true {
2469
        return $this->call(
3✔
2470
            new SetBusinessAccountGiftSettings(
3✔
2471
                $businessConnectionId,
3✔
2472
                $showGiftButton,
3✔
2473
                $acceptedGiftTypes,
3✔
2474
            ),
3✔
2475
        );
3✔
2476
    }
2477

2478
    /**
2479
     * @see https://core.telegram.org/bots/api#setbusinessaccountname
2480
     */
2481
    public function setBusinessAccountName(
3✔
2482
        string $businessConnectionId,
2483
        string $firstName,
2484
        ?string $lastName = null,
2485
    ): FailResult|true {
2486
        return $this->call(
3✔
2487
            new SetBusinessAccountName($businessConnectionId, $firstName, $lastName),
3✔
2488
        );
3✔
2489
    }
2490

2491
    /**
2492
     * @see https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
2493
     */
2494
    public function setBusinessAccountProfilePhoto(
3✔
2495
        string $businessConnectionId,
2496
        InputProfilePhoto $photo,
2497
        ?bool $isPublic = null,
2498
    ): FailResult|true {
2499
        return $this->call(
3✔
2500
            new SetBusinessAccountProfilePhoto($businessConnectionId, $photo, $isPublic),
3✔
2501
        );
3✔
2502
    }
2503

2504
    /**
2505
     * @see https://core.telegram.org/bots/api#setbusinessaccountusername
2506
     */
2507
    public function setBusinessAccountUsername(string $businessConnectionId, ?string $username = null): FailResult|true
3✔
2508
    {
2509
        return $this->call(
3✔
2510
            new SetBusinessAccountUsername($businessConnectionId, $username),
3✔
2511
        );
3✔
2512
    }
2513

2514
    /**
2515
     * @see https://core.telegram.org/bots/api#setchatadministratorcustomtitle
2516
     */
2517
    public function setChatAdministratorCustomTitle(
3✔
2518
        int|string $chatId,
2519
        int $userId,
2520
        string $customTitle,
2521
    ): FailResult|true {
2522
        return $this->call(
3✔
2523
            new SetChatAdministratorCustomTitle($chatId, $userId, $customTitle),
3✔
2524
        );
3✔
2525
    }
2526

2527
    /**
2528
     * @see https://core.telegram.org/bots/api#setchatdescription
2529
     */
2530
    public function setChatDescription(int|string $chatId, ?string $description = null): FailResult|true
3✔
2531
    {
2532
        return $this->call(
3✔
2533
            new SetChatDescription($chatId, $description),
3✔
2534
        );
3✔
2535
    }
2536

2537
    /**
2538
     * @see https://core.telegram.org/bots/api#setchatmenubutton
2539
     */
2540
    public function setChatMenuButton(?int $chatId = null, ?MenuButton $menuButton = null): FailResult|true
3✔
2541
    {
2542
        return $this->call(new SetChatMenuButton($chatId, $menuButton));
3✔
2543
    }
2544

2545
    /**
2546
     * @see https://core.telegram.org/bots/api#setchatpermissions
2547
     */
2548
    public function setChatPermissions(
3✔
2549
        int|string $chatId,
2550
        ChatPermissions $permissions,
2551
        ?bool $useIndependentChatPermissions = null,
2552
    ): FailResult|true {
2553
        return $this->call(
3✔
2554
            new SetChatPermissions($chatId, $permissions, $useIndependentChatPermissions),
3✔
2555
        );
3✔
2556
    }
2557

2558
    /**
2559
     * @see https://core.telegram.org/bots/api#setchatphoto
2560
     */
2561
    public function setChatPhoto(int|string $chatId, InputFile $photo): FailResult|true
3✔
2562
    {
2563
        return $this->call(
3✔
2564
            new SetChatPhoto($chatId, $photo),
3✔
2565
        );
3✔
2566
    }
2567

2568
    /**
2569
     * @see https://core.telegram.org/bots/api#setchatstickerset
2570
     */
2571
    public function setChatStickerSet(int|string $chatId, string $stickerSetName): FailResult|true
3✔
2572
    {
2573
        return $this->call(
3✔
2574
            new SetChatStickerSet($chatId, $stickerSetName),
3✔
2575
        );
3✔
2576
    }
2577

2578
    /**
2579
     * @see https://core.telegram.org/bots/api#setchattitle
2580
     */
2581
    public function setChatTitle(int|string $chatId, string $title): FailResult|true
3✔
2582
    {
2583
        return $this->call(
3✔
2584
            new SetChatTitle($chatId, $title),
3✔
2585
        );
3✔
2586
    }
2587

2588
    /**
2589
     * @see https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
2590
     */
2591
    public function setCustomEmojiStickerSetThumbnail(string $name, ?string $customEmojiId = null): FailResult|true
3✔
2592
    {
2593
        return $this->call(new SetCustomEmojiStickerSetThumbnail($name, $customEmojiId));
3✔
2594
    }
2595

2596
    /**
2597
     * @see https://core.telegram.org/bots/api#setgamescore
2598
     */
2599
    public function setGameScore(
3✔
2600
        int $userId,
2601
        int $score,
2602
        ?bool $force = null,
2603
        ?bool $disableEditMessage = null,
2604
        ?int $chatId = null,
2605
        ?int $messageId = null,
2606
        ?string $inlineMessageId = null,
2607
    ): FailResult|Message|true {
2608
        return $this->call(
3✔
2609
            new SetGameScore(
3✔
2610
                $userId,
3✔
2611
                $score,
3✔
2612
                $force,
3✔
2613
                $disableEditMessage,
3✔
2614
                $chatId,
3✔
2615
                $messageId,
3✔
2616
                $inlineMessageId,
3✔
2617
            ),
3✔
2618
        );
3✔
2619
    }
2620

2621
    /**
2622
     * @see https://core.telegram.org/bots/api#setmessagereaction
2623
     *
2624
     * @param ReactionType[]|null $reaction
2625
     */
2626
    public function setMessageReaction(
3✔
2627
        int|string $chatId,
2628
        int $messageId,
2629
        ?array $reaction = null,
2630
        ?bool $isBig = null,
2631
    ): FailResult|true {
2632
        return $this->call(
3✔
2633
            new SetMessageReaction($chatId, $messageId, $reaction, $isBig),
3✔
2634
        );
3✔
2635
    }
2636

2637
    /**
2638
     * @param BotCommand[] $commands
2639
     *
2640
     * @see https://core.telegram.org/bots/api#setmycommands
2641
     */
2642
    public function setMyCommands(
3✔
2643
        array $commands,
2644
        ?BotCommandScope $scope = null,
2645
        ?string $languageCode = null,
2646
    ): FailResult|true {
2647
        return $this->call(new SetMyCommands($commands, $scope, $languageCode));
3✔
2648
    }
2649

2650
    /**
2651
     * @see https://core.telegram.org/bots/api#setmydefaultadministratorrights
2652
     */
2653
    public function setMyDefaultAdministratorRights(
3✔
2654
        ?ChatAdministratorRights $rights = null,
2655
        ?bool $forChannels = null,
2656
    ): FailResult|true {
2657
        return $this->call(new SetMyDefaultAdministratorRights($rights, $forChannels));
3✔
2658
    }
2659

2660
    /**
2661
     * @see https://core.telegram.org/bots/api#setmydescription
2662
     */
2663
    public function setMyDescription(?string $description = null, ?string $languageCode = null): FailResult|true
3✔
2664
    {
2665
        return $this->call(new SetMyDescription($description, $languageCode));
3✔
2666
    }
2667

2668
    /**
2669
     * @see https://core.telegram.org/bots/api#setmyname
2670
     */
2671
    public function setMyName(?string $name = null, ?string $languageCode = null): FailResult|true
3✔
2672
    {
2673
        return $this->call(new SetMyName($name, $languageCode));
3✔
2674
    }
2675

2676
    /**
2677
     * @see https://core.telegram.org/bots/api#setmyshortdescription
2678
     */
2679
    public function setMyShortDescription(
3✔
2680
        ?string $shortDescription = null,
2681
        ?string $languageCode = null,
2682
    ): FailResult|true {
2683
        return $this->call(new SetMyShortDescription($shortDescription, $languageCode));
3✔
2684
    }
2685

2686
    /**
2687
     * @see https://core.telegram.org/bots/api#setpassportdataerrors
2688
     *
2689
     * @param PassportElementError[] $errors
2690
     */
2691
    public function setPassportDataErrors(int $userId, array $errors): FailResult|true
3✔
2692
    {
2693
        return $this->call(new SetPassportDataErrors($userId, $errors));
3✔
2694
    }
2695

2696
    /**
2697
     * @see https://core.telegram.org/bots/api#setstickeremojilist
2698
     *
2699
     * @param string[] $emojiList
2700
     */
2701
    public function setStickerEmojiList(string $sticker, array $emojiList): FailResult|true
3✔
2702
    {
2703
        return $this->call(new SetStickerEmojiList($sticker, $emojiList));
3✔
2704
    }
2705

2706
    /**
2707
     * @see https://core.telegram.org/bots/api#setstickerkeywords
2708
     *
2709
     * @param string[]|null $keywords
2710
     */
2711
    public function setStickerKeywords(string $sticker, ?array $keywords = null): FailResult|true
3✔
2712
    {
2713
        return $this->call(new SetStickerKeywords($sticker, $keywords));
3✔
2714
    }
2715

2716
    /**
2717
     * @see https://core.telegram.org/bots/api#setstickermaskposition
2718
     */
2719
    public function setStickerMaskPosition(string $sticker, ?MaskPosition $maskPosition = null): FailResult|true
3✔
2720
    {
2721
        return $this->call(new SetStickerMaskPosition($sticker, $maskPosition));
3✔
2722
    }
2723

2724
    /**
2725
     * @see https://core.telegram.org/bots/api#setstickerpositioninset
2726
     */
2727
    public function setStickerPositionInSet(string $sticker, int $position): FailResult|true
3✔
2728
    {
2729
        return $this->call(new SetStickerPositionInSet($sticker, $position));
3✔
2730
    }
2731

2732
    /**
2733
     * @see https://core.telegram.org/bots/api#setstickersetthumbnail
2734
     */
2735
    public function setStickerSetThumbnail(
3✔
2736
        string $name,
2737
        int $userId,
2738
        string $format,
2739
        InputFile|string|null $thumbnail = null,
2740
    ): FailResult|true {
2741
        return $this->call(
3✔
2742
            new SetStickerSetThumbnail(
3✔
2743
                $name,
3✔
2744
                $userId,
3✔
2745
                $format,
3✔
2746
                $thumbnail,
3✔
2747
            ),
3✔
2748
        );
3✔
2749
    }
2750

2751
    /**
2752
     * @see https://core.telegram.org/bots/api#setstickersettitle
2753
     */
2754
    public function setStickerSetTitle(string $name, string $title): FailResult|true
3✔
2755
    {
2756
        return $this->call(new SetStickerSetTitle($name, $title));
3✔
2757
    }
2758

2759
    /**
2760
     * @see https://core.telegram.org/bots/api#setuseremojistatus
2761
     */
2762
    public function setUserEmojiStatus(
3✔
2763
        int $userId,
2764
        ?string $emojiStatusCustomEmojiId = null,
2765
        ?DateTimeImmutable $emojiStatusExpirationDate = null,
2766
    ): FailResult|true {
2767
        return $this->call(
3✔
2768
            new SetUserEmojiStatus(
3✔
2769
                $userId,
3✔
2770
                $emojiStatusCustomEmojiId,
3✔
2771
                $emojiStatusExpirationDate,
3✔
2772
            ),
3✔
2773
        );
3✔
2774
    }
2775

2776
    /**
2777
     * @see https://core.telegram.org/bots/api#setwebhook
2778
     */
2779
    public function setWebhook(
3✔
2780
        string $url,
2781
        ?string $ipAddress = null,
2782
        ?int $maxConnections = null,
2783
        ?array $allowUpdates = null,
2784
        ?bool $dropPendingUpdates = null,
2785
        #[SensitiveParameter]
2786
        ?string $secretToken = null,
2787
    ): FailResult|true {
2788
        return $this->call(
3✔
2789
            new SetWebhook($url, $ipAddress, $maxConnections, $allowUpdates, $dropPendingUpdates, $secretToken),
3✔
2790
        );
3✔
2791
    }
2792

2793
    /**
2794
     * @see https://core.telegram.org/bots/api#stopmessagelivelocation
2795
     */
2796
    public function stopMessageLiveLocation(
3✔
2797
        ?string $businessConnectionId = null,
2798
        int|string|null $chatId = null,
2799
        ?int $messageId = null,
2800
        ?string $inlineMessageId = null,
2801
        ?InlineKeyboardMarkup $replyMarkup = null,
2802
    ): FailResult|Message|true {
2803
        return $this->call(
3✔
2804
            new StopMessageLiveLocation(
3✔
2805
                $businessConnectionId,
3✔
2806
                $chatId,
3✔
2807
                $messageId,
3✔
2808
                $inlineMessageId,
3✔
2809
                $replyMarkup,
3✔
2810
            ),
3✔
2811
        );
3✔
2812
    }
2813

2814
    /**
2815
     * @see https://core.telegram.org/bots/api#stoppoll
2816
     */
2817
    public function stopPoll(
3✔
2818
        int|string $chatId,
2819
        int $messageId,
2820
        ?string $businessConnectionId = null,
2821
        ?InlineKeyboardMarkup $replyMarkup = null,
2822
    ): FailResult|Poll {
2823
        return $this->call(
3✔
2824
            new StopPoll(
3✔
2825
                $chatId,
3✔
2826
                $messageId,
3✔
2827
                $businessConnectionId,
3✔
2828
                $replyMarkup,
3✔
2829
            ),
3✔
2830
        );
3✔
2831
    }
2832

2833
    /**
2834
     * @see https://core.telegram.org/bots/api#transferbusinessaccountstars
2835
     */
2836
    public function transferBusinessAccountStars(string $businessConnectionId, int $starCount): FailResult|true
3✔
2837
    {
2838
        return $this->call(
3✔
2839
            new TransferBusinessAccountStars($businessConnectionId, $starCount),
3✔
2840
        );
3✔
2841
    }
2842

2843
    /**
2844
     * @see https://core.telegram.org/bots/api#transfergift
2845
     */
2846
    public function transferGift(
3✔
2847
        string $businessConnectionId,
2848
        string $ownedGiftId,
2849
        int $newOwnerChatId,
2850
        ?int $starCount = null,
2851
    ): FailResult|true {
2852
        return $this->call(
3✔
2853
            new TransferGift(
3✔
2854
                $businessConnectionId,
3✔
2855
                $ownedGiftId,
3✔
2856
                $newOwnerChatId,
3✔
2857
                $starCount,
3✔
2858
            ),
3✔
2859
        );
3✔
2860
    }
2861

2862
    /**
2863
     * @see https://core.telegram.org/bots/api#unbanchatmember
2864
     */
2865
    public function unbanChatMember(
3✔
2866
        int|string $chatId,
2867
        int $userId,
2868
        ?bool $onlyIfBanned = null,
2869
    ): FailResult|true {
2870
        return $this->call(
3✔
2871
            new UnbanChatMember($chatId, $userId, $onlyIfBanned),
3✔
2872
        );
3✔
2873
    }
2874

2875
    /**
2876
     * @see https://core.telegram.org/bots/api#unbanchatsenderchat
2877
     */
2878
    public function unbanChatSenderChat(int|string $chatId, int $senderChatId): FailResult|true
3✔
2879
    {
2880
        return $this->call(
3✔
2881
            new UnbanChatSenderChat($chatId, $senderChatId),
3✔
2882
        );
3✔
2883
    }
2884

2885
    /**
2886
     * @see https://core.telegram.org/bots/api#unhidegeneralforumtopic
2887
     */
2888
    public function unhideGeneralForumTopic(int|string $chatId): FailResult|true
3✔
2889
    {
2890
        return $this->call(
3✔
2891
            new UnhideGeneralForumTopic($chatId),
3✔
2892
        );
3✔
2893
    }
2894

2895
    /**
2896
     * @see https://core.telegram.org/bots/api#unpinchatmessage
2897
     */
2898
    public function unpinChatMessage(int|string $chatId, ?int $messageId = null): FailResult|true
3✔
2899
    {
2900
        return $this->call(
3✔
2901
            new UnpinChatMessage($chatId, $messageId),
3✔
2902
        );
3✔
2903
    }
2904

2905
    /**
2906
     * @see https://core.telegram.org/bots/api#unpinallchatmessages
2907
     */
2908
    public function unpinAllChatMessages(int|string $chatId): FailResult|true
3✔
2909
    {
2910
        return $this->call(
3✔
2911
            new UnpinAllChatMessages($chatId),
3✔
2912
        );
3✔
2913
    }
2914

2915
    /**
2916
     * @see https://core.telegram.org/bots/api#unpinallforumtopicmessages
2917
     */
2918
    public function unpinAllForumTopicMessages(int|string $chatId, int $messageThreadId): FailResult|true
3✔
2919
    {
2920
        return $this->call(
3✔
2921
            new UnpinAllForumTopicMessages($chatId, $messageThreadId),
3✔
2922
        );
3✔
2923
    }
2924

2925
    /**
2926
     * @see https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
2927
     */
2928
    public function unpinAllGeneralForumTopicMessages(int|string $chatId): FailResult|true
3✔
2929
    {
2930
        return $this->call(
3✔
2931
            new UnpinAllGeneralForumTopicMessages($chatId),
3✔
2932
        );
3✔
2933
    }
2934

2935
    /**
2936
     * @see https://core.telegram.org/bots/api#upgradegift
2937
     */
2938
    public function upgradeGift(
3✔
2939
        string $businessConnectionId,
2940
        string $ownedGiftId,
2941
        ?bool $keepOriginalDetails = null,
2942
        ?int $starCount = null,
2943
    ): FailResult|true {
2944
        return $this->call(
3✔
2945
            new UpgradeGift(
3✔
2946
                $businessConnectionId,
3✔
2947
                $ownedGiftId,
3✔
2948
                $keepOriginalDetails,
3✔
2949
                $starCount,
3✔
2950
            ),
3✔
2951
        );
3✔
2952
    }
2953

2954
    /**
2955
     * @see https://core.telegram.org/bots/api#uploadstickerfile
2956
     */
2957
    public function uploadStickerFile(int $userId, InputFile $sticker, string $stickerFormat): FailResult|File
3✔
2958
    {
2959
        return $this->call(
3✔
2960
            new UploadStickerFile($userId, $sticker, $stickerFormat),
3✔
2961
        );
3✔
2962
    }
2963

2964
    /**
2965
     * @see https://core.telegram.org/bots/api#verifychat
2966
     */
2967
    public function verifyChat(int|string $chatId, ?string $customDescription = null): FailResult|true
3✔
2968
    {
2969
        return $this->call(
3✔
2970
            new VerifyChat($chatId, $customDescription),
3✔
2971
        );
3✔
2972
    }
2973

2974
    /**
2975
     * @see https://core.telegram.org/bots/api#verifyuser
2976
     */
2977
    public function verifyUser(int $userId, ?string $customDescription = null): FailResult|true
3✔
2978
    {
2979
        return $this->call(
3✔
2980
            new VerifyUser($userId, $customDescription),
3✔
2981
        );
3✔
2982
    }
2983

2984
    /**
2985
     * @infection-ignore-all
2986
     */
2987
    private function defaultTransport(): TransportInterface
9✔
2988
    {
2989
        if (extension_loaded('curl')) {
9✔
2990
            return new CurlTransport();
9✔
2991
        }
2992

NEW
2993
        $availableNativeTransport = (bool) ini_get('allow_url_fopen');
×
NEW
2994
        if ($availableNativeTransport) {
×
NEW
2995
            return new NativeTransport();
×
2996
        }
2997

NEW
2998
        throw new LogicException(
×
NEW
2999
            'Failed to initialize the default transport. Enable cURL PHP extension or provide a transport manually.',
×
NEW
3000
        );
×
3001
    }
3002
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc