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

vjik / telegram-bot-api / 14008455627

22 Mar 2025 12:17PM UTC coverage: 98.926% (-1.1%) from 100.0%
14008455627

Pull #152

github

web-flow
Merge b90ee3d49 into c07324921
Pull Request #152: Add download file methods

1 of 62 new or added lines in 3 files covered. (1.61%)

2 existing lines in 1 file now uncovered.

5617 of 5678 relevant lines covered (98.93%)

27.93 hits per line

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

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

204
use function extension_loaded;
205

206
/**
207
 * @api
208
 */
209
final class TelegramBotApi
210
{
211
    private readonly Api $api;
212
    private readonly TransportInterface $transport;
213

214
    public function __construct(
867✔
215
        #[SensitiveParameter]
216
        private readonly string $token,
217
        private readonly string $baseUrl = 'https://api.telegram.org',
218
        ?TransportInterface $transport = null,
219
        private ?LoggerInterface $logger = null,
220
    ) {
221
        if ($transport === null) {
867✔
222
            // @codeCoverageIgnoreStart
223
            $transport = extension_loaded('curl')
224
                ? new CurlTransport()
225
                : throw new LogicException(
226
                    'Failed to initialize the default transport (cURL required). Provide a transport manually.',
227
                );
228
            // @codeCoverageIgnoreEnd
229
        }
230

231
        $this->transport = $transport;
867✔
232
        $this->api = new Api($token, $baseUrl, $transport);
867✔
233
    }
234

235
    public function withLogger(?LoggerInterface $logger): self
3✔
236
    {
237
        $new = clone $this;
3✔
238
        $new->logger = $logger;
3✔
239
        return $new;
3✔
240
    }
241

242
    /**
243
     * @see https://core.telegram.org/bots/api#making-requests
244
     *
245
     * @psalm-template TValue
246
     * @psalm-param MethodInterface<TValue> $method
247
     * @psalm-return TValue|FailResult
248
     */
249
    public function call(MethodInterface $method): mixed
858✔
250
    {
251
        return $this->api->call($method, $this->logger);
858✔
252
    }
253

254
    /**
255
     * @see https://core.telegram.org/bots/api#file
256
     * @see https://core.telegram.org/bots/api#getfile
257
     *
258
     * @throws LogicException If the file path is not specified in `File` object.
259
     */
260
    public function makeFileUrl(string|File $file): string
9✔
261
    {
262
        if ($file instanceof File) {
9✔
263
            $path = $file->filePath;
6✔
264
            if ($path === null) {
6✔
265
                throw new LogicException('The file path is not specified.');
3✔
266
            }
267
        } else {
268
            $path = $file;
3✔
269
        }
270

271
        return $this->baseUrl . '/file/bot' . $this->token . '/' . $path;
6✔
272
    }
273

274
    /**
275
     * @throws DownloadFileException
276
     */
NEW
UNCOV
277
    public function downloadFile(string|File $file): string
×
278
    {
NEW
UNCOV
279
        return $this->transport->downloadFile(
×
NEW
280
            $this->makeFileUrl($file),
×
NEW
281
        );
×
282
    }
283

284
    /**
285
     * @throws DownloadFileException
286
     * @throws SaveFileException
287
     */
NEW
288
    public function downloadFileTo(string|File $file, string $savePath): void
×
289
    {
NEW
290
        $this->transport->downloadFileTo(
×
NEW
291
            $this->makeFileUrl($file),
×
NEW
292
            $savePath,
×
NEW
293
        );
×
294
    }
295

296
    /**
297
     * @see https://core.telegram.org/bots/api#addstickertoset
298
     */
299
    public function addStickerToSet(int $userId, string $name, InputSticker $sticker): FailResult|true
3✔
300
    {
301
        return $this->call(
3✔
302
            new AddStickerToSet($userId, $name, $sticker),
3✔
303
        );
3✔
304
    }
305

306
    /**
307
     * @see https://core.telegram.org/bots/api#answercallbackquery
308
     */
309
    public function answerCallbackQuery(
3✔
310
        string $callbackQueryId,
311
        ?string $text = null,
312
        ?bool $showAlert = null,
313
        ?string $url = null,
314
        ?int $cacheTime = null,
315
    ): FailResult|true {
316
        return $this->call(
3✔
317
            new AnswerCallbackQuery($callbackQueryId, $text, $showAlert, $url, $cacheTime),
3✔
318
        );
3✔
319
    }
320

321
    /**
322
     * @see https://core.telegram.org/bots/api#answerinlinequery
323
     *
324
     * @param InlineQueryResult[] $results
325
     */
326
    public function answerInlineQuery(
3✔
327
        string $inlineQueryId,
328
        array $results,
329
        ?int $cacheTime = null,
330
        ?bool $isPersonal = null,
331
        ?string $nextOffset = null,
332
        ?InlineQueryResultsButton $button = null,
333
    ): FailResult|true {
334
        return $this->call(
3✔
335
            new AnswerInlineQuery($inlineQueryId, $results, $cacheTime, $isPersonal, $nextOffset, $button),
3✔
336
        );
3✔
337
    }
338

339
    /**
340
     * @see https://core.telegram.org/bots/api#answerprecheckoutquery
341
     */
342
    public function answerPreCheckoutQuery(
3✔
343
        string $preCheckoutQueryId,
344
        bool $ok,
345
        ?string $errorMessage = null,
346
    ): FailResult|true {
347
        return $this->call(
3✔
348
            new AnswerPreCheckoutQuery($preCheckoutQueryId, $ok, $errorMessage),
3✔
349
        );
3✔
350
    }
351

352
    /**
353
     * @see https://core.telegram.org/bots/api#answershippingquery
354
     *
355
     * @param ShippingOption[]|null $shippingOptions
356
     */
357
    public function answerShippingQuery(
3✔
358
        string $shippingQueryId,
359
        bool $ok,
360
        ?array $shippingOptions = null,
361
        ?string $errorMessage = null,
362
    ): FailResult|true {
363
        return $this->call(
3✔
364
            new AnswerShippingQuery($shippingQueryId, $ok, $shippingOptions, $errorMessage),
3✔
365
        );
3✔
366
    }
367

368
    /**
369
     * @see https://core.telegram.org/bots/api#answerwebappquery
370
     */
371
    public function answerWebAppQuery(string $webAppQueryId, InlineQueryResult $result): FailResult|SentWebAppMessage
3✔
372
    {
373
        return $this->call(
3✔
374
            new AnswerWebAppQuery($webAppQueryId, $result),
3✔
375
        );
3✔
376
    }
377

378
    /**
379
     * @see https://core.telegram.org/bots/api#approvechatjoinrequest
380
     */
381
    public function approveChatJoinRequest(int|string $chatId, int $userId): FailResult|true
3✔
382
    {
383
        return $this->call(
3✔
384
            new ApproveChatJoinRequest($chatId, $userId),
3✔
385
        );
3✔
386
    }
387

388
    /**
389
     * @see https://core.telegram.org/bots/api#banchatmember
390
     */
391
    public function banChatMember(
3✔
392
        int|string $chatId,
393
        int $userId,
394
        ?DateTimeInterface $untilDate = null,
395
        ?bool $revokeMessages = null,
396
    ): FailResult|true {
397
        return $this->call(
3✔
398
            new BanChatMember($chatId, $userId, $untilDate, $revokeMessages),
3✔
399
        );
3✔
400
    }
401

402
    /**
403
     * @see https://core.telegram.org/bots/api#banchatsenderchat
404
     */
405
    public function banChatSenderChat(int|string $chatId, int $senderChatId): FailResult|true
3✔
406
    {
407
        return $this->call(
3✔
408
            new BanChatSenderChat($chatId, $senderChatId),
3✔
409
        );
3✔
410
    }
411

412
    /**
413
     * @see https://core.telegram.org/bots/api#close
414
     */
415
    public function close(): FailResult|true
3✔
416
    {
417
        return $this->call(new Close());
3✔
418
    }
419

420
    /**
421
     * @see https://core.telegram.org/bots/api#closeforumtopic
422
     */
423
    public function closeForumTopic(int|string $chatId, int $messageThreadId): FailResult|true
3✔
424
    {
425
        return $this->call(new CloseForumTopic($chatId, $messageThreadId));
3✔
426
    }
427

428
    /**
429
     * @see https://core.telegram.org/bots/api#closegeneralforumtopic
430
     */
431
    public function closeGeneralForumTopic(int|string $chatId): FailResult|true
3✔
432
    {
433
        return $this->call(new CloseGeneralForumTopic($chatId));
3✔
434
    }
435

436
    /**
437
     * @see https://core.telegram.org/bots/api#copymessage
438
     *
439
     * @param MessageEntity[]|null $captionEntities
440
     */
441
    public function copyMessage(
3✔
442
        int|string $chatId,
443
        int|string $fromChatId,
444
        int $messageId,
445
        ?int $messageThreadId = null,
446
        ?string $caption = null,
447
        ?string $parseMode = null,
448
        ?array $captionEntities = null,
449
        ?bool $showCaptionAboveMedia = null,
450
        ?bool $disableNotification = null,
451
        ?bool $protectContent = null,
452
        ?ReplyParameters $replyParameters = null,
453
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
454
        ?bool $allowPaidBroadcast = null,
455
        ?int $videoStartTimestamp = null,
456
    ): FailResult|MessageId {
457
        return $this->call(
3✔
458
            new CopyMessage(
3✔
459
                $chatId,
3✔
460
                $fromChatId,
3✔
461
                $messageId,
3✔
462
                $messageThreadId,
3✔
463
                $caption,
3✔
464
                $parseMode,
3✔
465
                $captionEntities,
3✔
466
                $showCaptionAboveMedia,
3✔
467
                $disableNotification,
3✔
468
                $protectContent,
3✔
469
                $replyParameters,
3✔
470
                $replyMarkup,
3✔
471
                $allowPaidBroadcast,
3✔
472
                $videoStartTimestamp,
3✔
473
            ),
3✔
474
        );
3✔
475
    }
476

477
    /**
478
     * @see https://core.telegram.org/bots/api#copymessages
479
     *
480
     * @param int[] $messageIds
481
     * @return FailResult|MessageId[]
482
     */
483
    public function copyMessages(
3✔
484
        int|string $chatId,
485
        int|string $fromChatId,
486
        array $messageIds,
487
        ?int $messageThreadId = null,
488
        ?bool $disableNotification = null,
489
        ?bool $protectContent = null,
490
        ?bool $removeCaption = null,
491
    ): FailResult|array {
492
        return $this->call(
3✔
493
            new CopyMessages(
3✔
494
                $chatId,
3✔
495
                $fromChatId,
3✔
496
                $messageIds,
3✔
497
                $messageThreadId,
3✔
498
                $disableNotification,
3✔
499
                $protectContent,
3✔
500
                $removeCaption,
3✔
501
            ),
3✔
502
        );
3✔
503
    }
504

505
    /**
506
     * @see https://core.telegram.org/bots/api#createchatinvitelink
507
     */
508
    public function createChatInviteLink(
3✔
509
        int|string $chatId,
510
        ?string $name = null,
511
        ?DateTimeImmutable $expireDate = null,
512
        ?int $memberLimit = null,
513
        ?bool $createsJoinRequest = null,
514
    ): FailResult|ChatInviteLink {
515
        return $this->call(
3✔
516
            new CreateChatInviteLink($chatId, $name, $expireDate, $memberLimit, $createsJoinRequest),
3✔
517
        );
3✔
518
    }
519

520
    /**
521
     * @see https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
522
     */
523
    public function createChatSubscriptionInviteLink(
3✔
524
        int|string $chatId,
525
        int $subscriptionPeriod,
526
        int $subscriptionPrice,
527
        ?string $name = null,
528
    ): FailResult|ChatInviteLink {
529
        return $this->call(
3✔
530
            new CreateChatSubscriptionInviteLink($chatId, $subscriptionPeriod, $subscriptionPrice, $name),
3✔
531
        );
3✔
532
    }
533

534
    /**
535
     * @see https://core.telegram.org/bots/api#createforumtopic
536
     */
537
    public function createForumTopic(
3✔
538
        int|string $chatId,
539
        string $name,
540
        ?int $iconColor = null,
541
        ?string $iconCustomEmojiId = null,
542
    ): FailResult|ForumTopic {
543
        return $this->call(
3✔
544
            new CreateForumTopic($chatId, $name, $iconColor, $iconCustomEmojiId),
3✔
545
        );
3✔
546
    }
547

548
    /**
549
     * @see https://core.telegram.org/bots/api#createinvoicelink
550
     *
551
     * @param LabeledPrice[] $prices
552
     * @param int[]|null $suggestedTipAmounts
553
     */
554
    public function createInvoiceLink(
3✔
555
        string $title,
556
        string $description,
557
        string $payload,
558
        string $currency,
559
        array $prices,
560
        #[SensitiveParameter]
561
        ?string $providerToken = null,
562
        ?int $maxTipAmount = null,
563
        ?array $suggestedTipAmounts = null,
564
        ?string $providerData = null,
565
        ?string $photoUrl = null,
566
        ?int $photoSize = null,
567
        ?int $photoWidth = null,
568
        ?int $photoHeight = null,
569
        ?bool $needName = null,
570
        ?bool $needPhoneNumber = null,
571
        ?bool $needEmail = null,
572
        ?bool $needShippingAddress = null,
573
        ?bool $sendPhoneNumberToProvider = null,
574
        ?bool $sendEmailToProvider = null,
575
        ?bool $isFlexible = null,
576
        ?int $subscriptionPeriod = null,
577
        ?string $businessConnectionId = null,
578
    ): FailResult|string {
579
        return $this->call(
3✔
580
            new CreateInvoiceLink(
3✔
581
                $title,
3✔
582
                $description,
3✔
583
                $payload,
3✔
584
                $currency,
3✔
585
                $prices,
3✔
586
                $providerToken,
3✔
587
                $maxTipAmount,
3✔
588
                $suggestedTipAmounts,
3✔
589
                $providerData,
3✔
590
                $photoUrl,
3✔
591
                $photoSize,
3✔
592
                $photoWidth,
3✔
593
                $photoHeight,
3✔
594
                $needName,
3✔
595
                $needPhoneNumber,
3✔
596
                $needEmail,
3✔
597
                $needShippingAddress,
3✔
598
                $sendPhoneNumberToProvider,
3✔
599
                $sendEmailToProvider,
3✔
600
                $isFlexible,
3✔
601
                $subscriptionPeriod,
3✔
602
                $businessConnectionId,
3✔
603
            ),
3✔
604
        );
3✔
605
    }
606

607
    /**
608
     * @see https://core.telegram.org/bots/api#createnewstickerset
609
     *
610
     * @param InputSticker[] $stickers
611
     */
612
    public function createNewStickerSet(
3✔
613
        int $userId,
614
        string $name,
615
        string $title,
616
        array $stickers,
617
        ?string $stickerType = null,
618
        ?bool $needsRepainting = null,
619
    ): FailResult|true {
620
        return $this->call(
3✔
621
            new CreateNewStickerSet($userId, $name, $title, $stickers, $stickerType, $needsRepainting),
3✔
622
        );
3✔
623
    }
624

625
    /**
626
     * @see https://core.telegram.org/bots/api#declinechatjoinrequest
627
     */
628
    public function declineChatJoinRequest(int|string $chatId, int $userId): FailResult|true
3✔
629
    {
630
        return $this->call(
3✔
631
            new DeclineChatJoinRequest($chatId, $userId),
3✔
632
        );
3✔
633
    }
634

635
    /**
636
     * @see https://core.telegram.org/bots/api#deletechatphoto
637
     */
638
    public function deleteChatPhoto(int|string $chatId): FailResult|true
3✔
639
    {
640
        return $this->call(
3✔
641
            new DeleteChatPhoto($chatId),
3✔
642
        );
3✔
643
    }
644

645
    /**
646
     * @see https://core.telegram.org/bots/api#deletechatstickerset
647
     */
648
    public function deleteChatStickerSet(int|string $chatId): FailResult|true
3✔
649
    {
650
        return $this->call(
3✔
651
            new DeleteChatStickerSet($chatId),
3✔
652
        );
3✔
653
    }
654

655
    /**
656
     * @see https://core.telegram.org/bots/api#deleteforumtopic
657
     */
658
    public function deleteForumTopic(int|string $chatId, int $messageThreadId): FailResult|true
3✔
659
    {
660
        return $this->call(new DeleteForumTopic($chatId, $messageThreadId));
3✔
661
    }
662

663
    /**
664
     * @see https://core.telegram.org/bots/api#deletemessage
665
     */
666
    public function deleteMessage(int|string $chatId, int $messageId): FailResult|true
3✔
667
    {
668
        return $this->call(new DeleteMessage($chatId, $messageId));
3✔
669
    }
670

671
    /**
672
     * @see https://core.telegram.org/bots/api#deletemessages
673
     *
674
     * @param int[] $messageIds
675
     */
676
    public function deleteMessages(int|string $chatId, array $messageIds): FailResult|true
3✔
677
    {
678
        return $this->call(new DeleteMessages($chatId, $messageIds));
3✔
679
    }
680

681
    /**
682
     * @see https://core.telegram.org/bots/api#deletemycommands
683
     */
684
    public function deleteMyCommands(?BotCommandScope $scope = null, ?string $languageCode = null): FailResult|true
3✔
685
    {
686
        return $this->call(new DeleteMyCommands($scope, $languageCode));
3✔
687
    }
688

689
    /**
690
     * @see https://core.telegram.org/bots/api#deletestickerfromset
691
     */
692
    public function deleteStickerFromSet(string $sticker): FailResult|true
3✔
693
    {
694
        return $this->call(
3✔
695
            new DeleteStickerFromSet($sticker),
3✔
696
        );
3✔
697
    }
698

699
    /**
700
     * @see https://core.telegram.org/bots/api#deletestickerset
701
     */
702
    public function deleteStickerSet(string $name): FailResult|true
3✔
703
    {
704
        return $this->call(new DeleteStickerSet($name));
3✔
705
    }
706

707
    /**
708
     * @see https://core.telegram.org/bots/api#editchatinvitelink
709
     */
710
    public function editChatInviteLink(
3✔
711
        int|string $chatId,
712
        string $inviteLink,
713
        ?string $name = null,
714
        ?DateTimeImmutable $expireDate = null,
715
        ?int $memberLimit = null,
716
        ?bool $createsJoinRequest = null,
717
    ): FailResult|ChatInviteLink {
718
        return $this->call(
3✔
719
            new EditChatInviteLink($chatId, $inviteLink, $name, $expireDate, $memberLimit, $createsJoinRequest),
3✔
720
        );
3✔
721
    }
722

723
    /**
724
     * @see https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
725
     */
726
    public function editChatSubscriptionInviteLink(
3✔
727
        int|string $chatId,
728
        string $inviteLink,
729
        ?string $name = null,
730
    ): FailResult|ChatInviteLink {
731
        return $this->call(
3✔
732
            new EditChatSubscriptionInviteLink($chatId, $inviteLink, $name),
3✔
733
        );
3✔
734
    }
735

736
    /**
737
     * @see https://core.telegram.org/bots/api#editforumtopic
738
     */
739
    public function editForumTopic(
3✔
740
        int|string $chatId,
741
        int $messageThreadId,
742
        ?string $name = null,
743
        ?string $iconCustomEmojiId = null,
744
    ): FailResult|true {
745
        return $this->call(
3✔
746
            new EditForumTopic($chatId, $messageThreadId, $name, $iconCustomEmojiId),
3✔
747
        );
3✔
748
    }
749

750
    /**
751
     * @see https://core.telegram.org/bots/api#editgeneralforumtopic
752
     */
753
    public function editGeneralForumTopic(int|string $chatId, string $name): FailResult|true
3✔
754
    {
755
        return $this->call(
3✔
756
            new EditGeneralForumTopic($chatId, $name),
3✔
757
        );
3✔
758
    }
759

760
    /**
761
     * @see https://core.telegram.org/bots/api#editmessagecaption
762
     *
763
     * @param MessageEntity[]|null $captionEntities
764
     */
765
    public function editMessageCaption(
3✔
766
        ?string $businessConnectionId = null,
767
        int|string|null $chatId = null,
768
        ?int $messageId = null,
769
        ?string $inlineMessageId = null,
770
        ?string $caption = null,
771
        ?string $parseMode = null,
772
        ?array $captionEntities = null,
773
        ?bool $showCaptionAboveMedia = null,
774
        ?InlineKeyboardMarkup $replyMarkup = null,
775
    ): FailResult|Message|true {
776
        return $this->call(
3✔
777
            new EditMessageCaption(
3✔
778
                $businessConnectionId,
3✔
779
                $chatId,
3✔
780
                $messageId,
3✔
781
                $inlineMessageId,
3✔
782
                $caption,
3✔
783
                $parseMode,
3✔
784
                $captionEntities,
3✔
785
                $showCaptionAboveMedia,
3✔
786
                $replyMarkup,
3✔
787
            ),
3✔
788
        );
3✔
789
    }
790

791
    /**
792
     * @see https://core.telegram.org/bots/api#editmessagelivelocation
793
     */
794
    public function editMessageLiveLocation(
3✔
795
        float $latitude,
796
        float $longitude,
797
        ?string $businessConnectionId = null,
798
        int|string|null $chatId = null,
799
        ?int $messageId = null,
800
        ?string $inlineMessageId = null,
801
        ?int $livePeriod = null,
802
        ?float $horizontalAccuracy = null,
803
        ?int $heading = null,
804
        ?int $proximityAlertRadius = null,
805
        ?InlineKeyboardMarkup $replyMarkup = null,
806
    ): FailResult|Message|true {
807
        return $this->call(
3✔
808
            new EditMessageLiveLocation(
3✔
809
                $latitude,
3✔
810
                $longitude,
3✔
811
                $businessConnectionId,
3✔
812
                $chatId,
3✔
813
                $messageId,
3✔
814
                $inlineMessageId,
3✔
815
                $livePeriod,
3✔
816
                $horizontalAccuracy,
3✔
817
                $heading,
3✔
818
                $proximityAlertRadius,
3✔
819
                $replyMarkup,
3✔
820
            ),
3✔
821
        );
3✔
822
    }
823

824
    /**
825
     * @see https://core.telegram.org/bots/api#editmessagemedia
826
     */
827
    public function editMessageMedia(
3✔
828
        InputMedia $media,
829
        ?string $businessConnectionId = null,
830
        int|string|null $chatId = null,
831
        ?int $messageId = null,
832
        ?string $inlineMessageId = null,
833
        ?InlineKeyboardMarkup $replyMarkup = null,
834
    ): FailResult|Message|true {
835
        return $this->call(
3✔
836
            new EditMessageMedia(
3✔
837
                $media,
3✔
838
                $businessConnectionId,
3✔
839
                $chatId,
3✔
840
                $messageId,
3✔
841
                $inlineMessageId,
3✔
842
                $replyMarkup,
3✔
843
            ),
3✔
844
        );
3✔
845
    }
846

847
    /**
848
     * @see https://core.telegram.org/bots/api#editmessagereplymarkup
849
     */
850
    public function editMessageReplyMarkup(
3✔
851
        ?string $businessConnectionId = null,
852
        int|string|null $chatId = null,
853
        ?int $messageId = null,
854
        ?string $inlineMessageId = null,
855
        ?InlineKeyboardMarkup $replyMarkup = null,
856
    ): FailResult|Message|true {
857
        return $this->call(
3✔
858
            new EditMessageReplyMarkup(
3✔
859
                $businessConnectionId,
3✔
860
                $chatId,
3✔
861
                $messageId,
3✔
862
                $inlineMessageId,
3✔
863
                $replyMarkup,
3✔
864
            ),
3✔
865
        );
3✔
866
    }
867

868
    /**
869
     * @see https://core.telegram.org/bots/api#editmessagetext
870
     *
871
     * @param MessageEntity[]|null $entities
872
     */
873
    public function editMessageText(
3✔
874
        string $text,
875
        ?string $businessConnectionId = null,
876
        int|string|null $chatId = null,
877
        ?int $messageId = null,
878
        ?string $inlineMessageId = null,
879
        ?string $parseMode = null,
880
        ?array $entities = null,
881
        ?LinkPreviewOptions $linkPreviewOptions = null,
882
        ?InlineKeyboardMarkup $replyMarkup = null,
883
    ): FailResult|Message|true {
884
        return $this->call(
3✔
885
            new EditMessageText(
3✔
886
                $text,
3✔
887
                $businessConnectionId,
3✔
888
                $chatId,
3✔
889
                $messageId,
3✔
890
                $inlineMessageId,
3✔
891
                $parseMode,
3✔
892
                $entities,
3✔
893
                $linkPreviewOptions,
3✔
894
                $replyMarkup,
3✔
895
            ),
3✔
896
        );
3✔
897
    }
898

899
    /**
900
     * @see https://core.telegram.org/bots/api#edituserstarsubscription
901
     */
902
    public function editUserStarSubscription(
3✔
903
        int $userId,
904
        string $telegramPaymentChargeId,
905
        bool $isCanceled,
906
    ): FailResult|true {
907
        return $this->call(
3✔
908
            new EditUserStarSubscription(
3✔
909
                $userId,
3✔
910
                $telegramPaymentChargeId,
3✔
911
                $isCanceled,
3✔
912
            ),
3✔
913
        );
3✔
914
    }
915

916
    /**
917
     * @see https://core.telegram.org/bots/api#exportchatinvitelink
918
     */
919
    public function exportChatInviteLink(int|string $chatId): FailResult|string
3✔
920
    {
921
        return $this->call(
3✔
922
            new ExportChatInviteLink($chatId),
3✔
923
        );
3✔
924
    }
925

926
    /**
927
     * @see https://core.telegram.org/bots/api#forwardmessage
928
     */
929
    public function forwardMessage(
3✔
930
        int|string $chatId,
931
        int|string $fromChatId,
932
        int $messageId,
933
        ?int $messageThreadId = null,
934
        ?bool $disableNotification = null,
935
        ?bool $protectContent = null,
936
        ?int $videoStartTimestamp = null,
937
    ): FailResult|Message {
938
        return $this->call(
3✔
939
            new ForwardMessage(
3✔
940
                $chatId,
3✔
941
                $fromChatId,
3✔
942
                $messageId,
3✔
943
                $messageThreadId,
3✔
944
                $disableNotification,
3✔
945
                $protectContent,
3✔
946
                $videoStartTimestamp,
3✔
947
            ),
3✔
948
        );
3✔
949
    }
950

951
    /**
952
     * @param int[] $messageIds
953
     * @return FailResult|MessageId[]
954
     *
955
     * @see https://core.telegram.org/bots/api#forwardmessages
956
     */
957
    public function forwardMessages(
3✔
958
        int|string $chatId,
959
        int|string $fromChatId,
960
        array $messageIds,
961
        ?int $messageThreadId = null,
962
        ?bool $disableNotification = null,
963
        ?bool $protectContent = null,
964
    ): FailResult|array {
965
        return $this->call(
3✔
966
            new ForwardMessages(
3✔
967
                $chatId,
3✔
968
                $fromChatId,
3✔
969
                $messageIds,
3✔
970
                $messageThreadId,
3✔
971
                $disableNotification,
3✔
972
                $protectContent,
3✔
973
            ),
3✔
974
        );
3✔
975
    }
976

977
    /**
978
     * @see https://core.telegram.org/bots/api#deletewebhook
979
     */
980
    public function deleteWebhook(?bool $dropPendingUpdates = null): FailResult|true
3✔
981
    {
982
        return $this->call(new DeleteWebhook($dropPendingUpdates));
3✔
983
    }
984

985
    /**
986
     * @see https://core.telegram.org/bots/api#getavailablegifts
987
     */
988
    public function getAvailableGifts(): FailResult|Gifts
3✔
989
    {
990
        return $this->call(new GetAvailableGifts());
3✔
991
    }
992

993
    /**
994
     * @see https://core.telegram.org/bots/api#getbusinessconnection
995
     */
996
    public function getBusinessConnection(string $businessConnectionId): FailResult|BusinessConnection
3✔
997
    {
998
        return $this->call(new GetBusinessConnection($businessConnectionId));
3✔
999
    }
1000

1001
    /**
1002
     * @see https://core.telegram.org/bots/api#getchat
1003
     */
1004
    public function getChat(int|string $chatId): FailResult|ChatFullInfo
3✔
1005
    {
1006
        return $this->call(new GetChat($chatId));
3✔
1007
    }
1008

1009
    /**
1010
     * @see https://core.telegram.org/bots/api#getchatadministrators
1011
     *
1012
     * @return FailResult|ChatMember[]
1013
     */
1014
    public function getChatAdministrators(int|string $chatId): FailResult|array
3✔
1015
    {
1016
        return $this->call(new GetChatAdministrators($chatId));
3✔
1017
    }
1018

1019
    /**
1020
     * @see https://core.telegram.org/bots/api#getchatmembercount
1021
     */
1022
    public function getChatMemberCount(int|string $chatId): FailResult|int
3✔
1023
    {
1024
        return $this->call(new GetChatMemberCount($chatId));
3✔
1025
    }
1026

1027
    /**
1028
     * @see https://core.telegram.org/bots/api#getchatmember
1029
     */
1030
    public function getChatMember(int|string $chatId, int $userId): FailResult|ChatMember
3✔
1031
    {
1032
        return $this->call(new GetChatMember($chatId, $userId));
3✔
1033
    }
1034

1035
    /**
1036
     * @see https://core.telegram.org/bots/api#getchatmenubutton
1037
     */
1038
    public function getChatMenuButton(?int $chatId = null): FailResult|MenuButton
3✔
1039
    {
1040
        return $this->call(new GetChatMenuButton($chatId));
3✔
1041
    }
1042

1043
    /**
1044
     * @see https://core.telegram.org/bots/api#getcustomemojistickers
1045
     *
1046
     * @param string[] $customEmojiIds
1047
     * @return FailResult|Sticker[]
1048
     */
1049
    public function getCustomEmojiStickers(array $customEmojiIds): FailResult|array
3✔
1050
    {
1051
        return $this->call(new GetCustomEmojiStickers($customEmojiIds));
3✔
1052
    }
1053

1054
    /**
1055
     * @see https://core.telegram.org/bots/api#getfile
1056
     */
1057
    public function getFile(string $fileId): FailResult|File
3✔
1058
    {
1059
        return $this->call(new GetFile($fileId));
3✔
1060
    }
1061

1062
    /**
1063
     * @see https://core.telegram.org/bots/api#getforumtopiciconstickers
1064
     *
1065
     * @return FailResult|Sticker[]
1066
     */
1067
    public function getForumTopicIconStickers(): FailResult|array
3✔
1068
    {
1069
        return $this->call(new GetForumTopicIconStickers());
3✔
1070
    }
1071

1072
    /**
1073
     * @see https://core.telegram.org/bots/api#getgamehighscores
1074
     *
1075
     * @return FailResult|GameHighScore[]
1076
     */
1077
    public function getGameHighScores(
3✔
1078
        int $userId,
1079
        ?int $chatId = null,
1080
        ?int $messageId = null,
1081
        ?string $inlineMessageId = null,
1082
    ): FailResult|array {
1083
        return $this->call(
3✔
1084
            new GetGameHighScores($userId, $chatId, $messageId, $inlineMessageId),
3✔
1085
        );
3✔
1086
    }
1087

1088
    /**
1089
     * @see https://core.telegram.org/bots/api#getchat
1090
     */
1091
    public function getMe(): FailResult|User
3✔
1092
    {
1093
        return $this->call(new GetMe());
3✔
1094
    }
1095

1096
    /**
1097
     * @see https://core.telegram.org/bots/api#getmycommands
1098
     */
1099
    public function getMyCommands(?BotCommandScope $scope = null, ?string $languageCode = null): FailResult|array
3✔
1100
    {
1101
        return $this->call(new GetMyCommands($scope, $languageCode));
3✔
1102
    }
1103

1104
    /**
1105
     * @see https://core.telegram.org/bots/api#getmydefaultadministratorrights
1106
     */
1107
    public function getMyDefaultAdministratorRights(?bool $forChannels = null): FailResult|ChatAdministratorRights
3✔
1108
    {
1109
        return $this->call(new GetMyDefaultAdministratorRights($forChannels));
3✔
1110
    }
1111

1112
    /**
1113
     * @see https://core.telegram.org/bots/api#getmydescription
1114
     */
1115
    public function getMyDescription(?string $languageCode = null): FailResult|BotDescription
3✔
1116
    {
1117
        return $this->call(new GetMyDescription($languageCode));
3✔
1118
    }
1119

1120
    /**
1121
     * @see https://core.telegram.org/bots/api#getmyname
1122
     */
1123
    public function getMyName(?string $languageCode = null): FailResult|BotName
3✔
1124
    {
1125
        return $this->call(new GetMyName($languageCode));
3✔
1126
    }
1127

1128
    /**
1129
     * @see https://core.telegram.org/bots/api#getmyshortdescription
1130
     */
1131
    public function getMyShortDescription(?string $languageCode = null): FailResult|BotShortDescription
3✔
1132
    {
1133
        return $this->call(new GetMyShortDescription($languageCode));
3✔
1134
    }
1135

1136
    /**
1137
     * @see https://core.telegram.org/bots/api#getstartransactions
1138
     */
1139
    public function getStarTransactions(?int $offset = null, ?int $limit = null): FailResult|StarTransactions
3✔
1140
    {
1141
        return $this->call(
3✔
1142
            new GetStarTransactions($offset, $limit),
3✔
1143
        );
3✔
1144
    }
1145

1146
    /**
1147
     * @see https://core.telegram.org/bots/api#getstickerset
1148
     */
1149
    public function getStickerSet(string $name): FailResult|StickerSet
3✔
1150
    {
1151
        return $this->call(
3✔
1152
            new GetStickerSet($name),
3✔
1153
        );
3✔
1154
    }
1155

1156
    /**
1157
     * @see https://core.telegram.org/bots/api#getupdates
1158
     *
1159
     * @param string[]|null $allowedUpdates
1160
     * @return FailResult|Update[]
1161
     */
1162
    public function getUpdates(
3✔
1163
        ?int $offset = null,
1164
        ?int $limit = null,
1165
        ?int $timeout = null,
1166
        ?array $allowedUpdates = null,
1167
    ): FailResult|array {
1168
        return $this->call(new GetUpdates($offset, $limit, $timeout, $allowedUpdates));
3✔
1169
    }
1170

1171
    /**
1172
     * @see https://core.telegram.org/bots/api#getuserchatboosts
1173
     */
1174
    public function getUserChatBoosts(int|string $chatId, int $userId): FailResult|UserChatBoosts
3✔
1175
    {
1176
        return $this->call(
3✔
1177
            new GetUserChatBoosts($chatId, $userId),
3✔
1178
        );
3✔
1179
    }
1180

1181
    /**
1182
     * @see https://core.telegram.org/bots/api#getuserprofilephotos
1183
     */
1184
    public function getUserProfilePhotos(
3✔
1185
        int $userId,
1186
        ?int $offset = null,
1187
        ?int $limit = null,
1188
    ): FailResult|UserProfilePhotos {
1189
        return $this->call(
3✔
1190
            new GetUserProfilePhotos($userId, $offset, $limit),
3✔
1191
        );
3✔
1192
    }
1193

1194
    /**
1195
     * @see https://core.telegram.org/bots/api#getwebhookinfo
1196
     */
1197
    public function getWebhookInfo(): FailResult|WebhookInfo
3✔
1198
    {
1199
        return $this->call(new GetWebhookInfo());
3✔
1200
    }
1201

1202
    /**
1203
     * @see https://core.telegram.org/bots/api#hidegeneralforumtopic
1204
     */
1205
    public function hideGeneralForumTopic(int|string $chatId): FailResult|true
3✔
1206
    {
1207
        return $this->call(
3✔
1208
            new HideGeneralForumTopic($chatId),
3✔
1209
        );
3✔
1210
    }
1211

1212
    /**
1213
     * @see https://core.telegram.org/bots/api#leavechat
1214
     */
1215
    public function leaveChat(int|string $chatId): FailResult|true
3✔
1216
    {
1217
        return $this->call(
3✔
1218
            new LeaveChat($chatId),
3✔
1219
        );
3✔
1220
    }
1221

1222
    /**
1223
     * @see https://core.telegram.org/bots/api#logout
1224
     */
1225
    public function logOut(): FailResult|true
6✔
1226
    {
1227
        return $this->call(new LogOut());
6✔
1228
    }
1229

1230
    /**
1231
     * @see https://core.telegram.org/bots/api#pinchatmessage
1232
     */
1233
    public function pinChatMessage(
3✔
1234
        int|string $chatId,
1235
        int $messageId,
1236
        ?bool $disableNotification = null,
1237
    ): FailResult|true {
1238
        return $this->call(
3✔
1239
            new PinChatMessage($chatId, $messageId, $disableNotification),
3✔
1240
        );
3✔
1241
    }
1242

1243
    /**
1244
     * @see https://core.telegram.org/bots/api#promotechatmember
1245
     */
1246
    public function promoteChatMember(
3✔
1247
        int|string $chatId,
1248
        int $userId,
1249
        ?bool $isAnonymous = null,
1250
        ?bool $canManageChat = null,
1251
        ?bool $canDeleteMessages = null,
1252
        ?bool $canManageVideoChats = null,
1253
        ?bool $canRestrictMembers = null,
1254
        ?bool $canPromoteMembers = null,
1255
        ?bool $canChangeInfo = null,
1256
        ?bool $canInviteUsers = null,
1257
        ?bool $canPostStories = null,
1258
        ?bool $canEditStories = null,
1259
        ?bool $canDeleteStories = null,
1260
        ?bool $canPostMessages = null,
1261
        ?bool $canEditMessages = null,
1262
        ?bool $canPinMessages = null,
1263
        ?bool $canManageTopics = null,
1264
    ): FailResult|true {
1265
        return $this->call(
3✔
1266
            new PromoteChatMember(
3✔
1267
                $chatId,
3✔
1268
                $userId,
3✔
1269
                $isAnonymous,
3✔
1270
                $canManageChat,
3✔
1271
                $canDeleteMessages,
3✔
1272
                $canManageVideoChats,
3✔
1273
                $canRestrictMembers,
3✔
1274
                $canPromoteMembers,
3✔
1275
                $canChangeInfo,
3✔
1276
                $canInviteUsers,
3✔
1277
                $canPostStories,
3✔
1278
                $canEditStories,
3✔
1279
                $canDeleteStories,
3✔
1280
                $canPostMessages,
3✔
1281
                $canEditMessages,
3✔
1282
                $canPinMessages,
3✔
1283
                $canManageTopics,
3✔
1284
            ),
3✔
1285
        );
3✔
1286
    }
1287

1288
    /**
1289
     * @see https://core.telegram.org/bots/api#refundstarpayment
1290
     */
1291
    public function refundStarPayment(int $userId, string $telegramPaymentChargeId): FailResult|true
3✔
1292
    {
1293
        return $this->call(
3✔
1294
            new RefundStarPayment($userId, $telegramPaymentChargeId),
3✔
1295
        );
3✔
1296
    }
1297

1298
    /**
1299
     * @see https://core.telegram.org/bots/api#removechatverification
1300
     */
1301
    public function removeChatVerification(int|string $chatId): FailResult|true
3✔
1302
    {
1303
        return $this->call(
3✔
1304
            new RemoveChatVerification($chatId),
3✔
1305
        );
3✔
1306
    }
1307

1308
    /**
1309
     * @see https://core.telegram.org/bots/api#removeuserverification
1310
     */
1311
    public function removeUserVerification(int $userId): FailResult|true
3✔
1312
    {
1313
        return $this->call(
3✔
1314
            new RemoveUserVerification($userId),
3✔
1315
        );
3✔
1316
    }
1317

1318
    /**
1319
     * @see https://core.telegram.org/bots/api#reopenforumtopic
1320
     */
1321
    public function reopenForumTopic(int|string $chatId, int $messageThreadId): FailResult|true
3✔
1322
    {
1323
        return $this->call(
3✔
1324
            new ReopenForumTopic($chatId, $messageThreadId),
3✔
1325
        );
3✔
1326
    }
1327

1328
    /**
1329
     * @see https://core.telegram.org/bots/api#reopengeneralforumtopic
1330
     */
1331
    public function reopenGeneralForumTopic(int|string $chatId): FailResult|true
3✔
1332
    {
1333
        return $this->call(
3✔
1334
            new ReopenGeneralForumTopic($chatId),
3✔
1335
        );
3✔
1336
    }
1337

1338
    /**
1339
     * @see https://core.telegram.org/bots/api#replacestickerinset
1340
     */
1341
    public function replaceStickerInSet(
3✔
1342
        int $userId,
1343
        string $name,
1344
        string $oldSticker,
1345
        InputSticker $sticker,
1346
    ): FailResult|true {
1347
        return $this->call(
3✔
1348
            new ReplaceStickerInSet($userId, $name, $oldSticker, $sticker),
3✔
1349
        );
3✔
1350
    }
1351

1352
    /**
1353
     * @see https://core.telegram.org/bots/api#restrictchatmember
1354
     */
1355
    public function restrictChatMember(
3✔
1356
        int|string $chatId,
1357
        int $userId,
1358
        ChatPermissions $permissions,
1359
        ?bool $useIndependentChatPermissions = null,
1360
        ?DateTimeImmutable $untilDate = null,
1361
    ): FailResult|true {
1362
        return $this->call(
3✔
1363
            new RestrictChatMember($chatId, $userId, $permissions, $useIndependentChatPermissions, $untilDate),
3✔
1364
        );
3✔
1365
    }
1366

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

1377
    /**
1378
     * @see https://core.telegram.org/bots/api#savepreparedinlinemessage
1379
     */
1380
    public function savePreparedInlineMessage(
3✔
1381
        int $userId,
1382
        InlineQueryResult $result,
1383
        ?bool $allowUserChats = null,
1384
        ?bool $allowBotChats = null,
1385
        ?bool $allowGroupChats = null,
1386
        ?bool $allowChannelChats = null,
1387
    ): FailResult|PreparedInlineMessage {
1388
        return $this->call(
3✔
1389
            new SavePreparedInlineMessage(
3✔
1390
                $userId,
3✔
1391
                $result,
3✔
1392
                $allowUserChats,
3✔
1393
                $allowBotChats,
3✔
1394
                $allowGroupChats,
3✔
1395
                $allowChannelChats,
3✔
1396
            ),
3✔
1397
        );
3✔
1398
    }
1399

1400
    /**
1401
     * @param MessageEntity[]|null $captionEntities
1402
     *
1403
     * @see https://core.telegram.org/bots/api#sendanimation
1404
     */
1405
    public function sendAnimation(
3✔
1406
        int|string $chatId,
1407
        InputFile|string $animation,
1408
        ?string $businessConnectionId = null,
1409
        ?int $messageThreadId = null,
1410
        ?int $duration = null,
1411
        ?int $width = null,
1412
        ?int $height = null,
1413
        InputFile|string|null $thumbnail = null,
1414
        ?string $caption = null,
1415
        ?string $parseMode = null,
1416
        ?array $captionEntities = null,
1417
        ?bool $showCaptionAboveMedia = null,
1418
        ?bool $hasSpoiler = null,
1419
        ?bool $disableNotification = null,
1420
        ?bool $protectContent = null,
1421
        ?string $messageEffectId = null,
1422
        ?ReplyParameters $replyParameters = null,
1423
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1424
        ?bool $allowPaidBroadcast = null,
1425
    ): FailResult|Message {
1426
        return $this->call(
3✔
1427
            new SendAnimation(
3✔
1428
                $chatId,
3✔
1429
                $animation,
3✔
1430
                $businessConnectionId,
3✔
1431
                $messageThreadId,
3✔
1432
                $duration,
3✔
1433
                $width,
3✔
1434
                $height,
3✔
1435
                $thumbnail,
3✔
1436
                $caption,
3✔
1437
                $parseMode,
3✔
1438
                $captionEntities,
3✔
1439
                $showCaptionAboveMedia,
3✔
1440
                $hasSpoiler,
3✔
1441
                $disableNotification,
3✔
1442
                $protectContent,
3✔
1443
                $messageEffectId,
3✔
1444
                $replyParameters,
3✔
1445
                $replyMarkup,
3✔
1446
                $allowPaidBroadcast,
3✔
1447
            ),
3✔
1448
        );
3✔
1449
    }
1450

1451
    /**
1452
     * @param MessageEntity[]|null $captionEntities
1453
     *
1454
     * @see https://core.telegram.org/bots/api#sendaudio
1455
     */
1456
    public function sendAudio(
3✔
1457
        int|string $chatId,
1458
        string|InputFile $audio,
1459
        ?string $businessConnectionId = null,
1460
        ?int $messageThreadId = null,
1461
        ?string $caption = null,
1462
        ?string $parseMode = null,
1463
        ?array $captionEntities = null,
1464
        ?int $duration = null,
1465
        ?string $performer = null,
1466
        ?string $title = null,
1467
        string|InputFile|null $thumbnail = null,
1468
        ?bool $disableNotification = null,
1469
        ?bool $protectContent = null,
1470
        ?string $messageEffectId = null,
1471
        ?ReplyParameters $replyParameters = null,
1472
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1473
        ?bool $allowPaidBroadcast = null,
1474
    ): FailResult|Message {
1475
        return $this->call(
3✔
1476
            new SendAudio(
3✔
1477
                $chatId,
3✔
1478
                $audio,
3✔
1479
                $businessConnectionId,
3✔
1480
                $messageThreadId,
3✔
1481
                $caption,
3✔
1482
                $parseMode,
3✔
1483
                $captionEntities,
3✔
1484
                $duration,
3✔
1485
                $performer,
3✔
1486
                $title,
3✔
1487
                $thumbnail,
3✔
1488
                $disableNotification,
3✔
1489
                $protectContent,
3✔
1490
                $messageEffectId,
3✔
1491
                $replyParameters,
3✔
1492
                $replyMarkup,
3✔
1493
                $allowPaidBroadcast,
3✔
1494
            ),
3✔
1495
        );
3✔
1496
    }
1497

1498
    /**
1499
     * @see https://core.telegram.org/bots/api#sendchataction
1500
     */
1501
    public function sendChatAction(
3✔
1502
        int|string $chatId,
1503
        string $action,
1504
        ?string $businessConnectionId = null,
1505
        ?int $messageThreadId = null,
1506
    ): FailResult|true {
1507
        return $this->call(
3✔
1508
            new SendChatAction(
3✔
1509
                $chatId,
3✔
1510
                $action,
3✔
1511
                $businessConnectionId,
3✔
1512
                $messageThreadId,
3✔
1513
            ),
3✔
1514
        );
3✔
1515
    }
1516

1517
    /**
1518
     * @see https://core.telegram.org/bots/api#sendcontact
1519
     */
1520
    public function sendContact(
3✔
1521
        int|string $chatId,
1522
        string $phoneNumber,
1523
        string $firstName,
1524
        ?string $businessConnectionId = null,
1525
        ?int $messageThreadId = null,
1526
        ?string $lastName = null,
1527
        ?string $vcard = null,
1528
        ?bool $disableNotification = null,
1529
        ?bool $protectContent = null,
1530
        ?string $messageEffectId = null,
1531
        ?ReplyParameters $replyParameters = null,
1532
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1533
        ?bool $allowPaidBroadcast = null,
1534
    ): FailResult|Message {
1535
        return $this->call(
3✔
1536
            new SendContact(
3✔
1537
                $chatId,
3✔
1538
                $phoneNumber,
3✔
1539
                $firstName,
3✔
1540
                $businessConnectionId,
3✔
1541
                $messageThreadId,
3✔
1542
                $lastName,
3✔
1543
                $vcard,
3✔
1544
                $disableNotification,
3✔
1545
                $protectContent,
3✔
1546
                $messageEffectId,
3✔
1547
                $replyParameters,
3✔
1548
                $replyMarkup,
3✔
1549
                $allowPaidBroadcast,
3✔
1550
            ),
3✔
1551
        );
3✔
1552
    }
1553

1554
    /**
1555
     * @see https://core.telegram.org/bots/api#senddice
1556
     */
1557
    public function sendDice(
3✔
1558
        int|string $chatId,
1559
        ?string $businessConnectionId = null,
1560
        ?int $messageThreadId = null,
1561
        ?string $emoji = null,
1562
        ?bool $disableNotification = null,
1563
        ?bool $protectContent = null,
1564
        ?string $messageEffectId = null,
1565
        ?ReplyParameters $replyParameters = null,
1566
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1567
        ?bool $allowPaidBroadcast = null,
1568
    ): FailResult|Message {
1569
        return $this->call(
3✔
1570
            new SendDice(
3✔
1571
                $chatId,
3✔
1572
                $businessConnectionId,
3✔
1573
                $messageThreadId,
3✔
1574
                $emoji,
3✔
1575
                $disableNotification,
3✔
1576
                $protectContent,
3✔
1577
                $messageEffectId,
3✔
1578
                $replyParameters,
3✔
1579
                $replyMarkup,
3✔
1580
                $allowPaidBroadcast,
3✔
1581
            ),
3✔
1582
        );
3✔
1583
    }
1584

1585
    /**
1586
     * @param MessageEntity[]|null $captionEntities
1587
     *
1588
     * @see https://core.telegram.org/bots/api#senddocument
1589
     */
1590
    public function sendDocument(
3✔
1591
        int|string $chatId,
1592
        string|InputFile $document,
1593
        ?string $businessConnectionId = null,
1594
        ?int $messageThreadId = null,
1595
        string|InputFile|null $thumbnail = null,
1596
        ?string $caption = null,
1597
        ?string $parseMode = null,
1598
        ?array $captionEntities = null,
1599
        ?bool $disableContentTypeDetection = null,
1600
        ?bool $disableNotification = null,
1601
        ?bool $protectContent = null,
1602
        ?string $messageEffectId = null,
1603
        ?ReplyParameters $replyParameters = null,
1604
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1605
        ?bool $allowPaidBroadcast = null,
1606
    ): FailResult|Message {
1607
        return $this->call(
3✔
1608
            new SendDocument(
3✔
1609
                $chatId,
3✔
1610
                $document,
3✔
1611
                $businessConnectionId,
3✔
1612
                $messageThreadId,
3✔
1613
                $thumbnail,
3✔
1614
                $caption,
3✔
1615
                $parseMode,
3✔
1616
                $captionEntities,
3✔
1617
                $disableContentTypeDetection,
3✔
1618
                $disableNotification,
3✔
1619
                $protectContent,
3✔
1620
                $messageEffectId,
3✔
1621
                $replyParameters,
3✔
1622
                $replyMarkup,
3✔
1623
                $allowPaidBroadcast,
3✔
1624
            ),
3✔
1625
        );
3✔
1626
    }
1627

1628
    /**
1629
     * @see https://core.telegram.org/bots/api#sendgame
1630
     */
1631
    public function sendGame(
3✔
1632
        int $chatId,
1633
        string $gameShortName,
1634
        ?string $businessConnectionId = null,
1635
        ?int $messageThreadId = null,
1636
        ?bool $disableNotification = null,
1637
        ?bool $protectContent = null,
1638
        ?string $messageEffectId = null,
1639
        ?ReplyParameters $replyParameters = null,
1640
        ?InlineKeyboardMarkup $replyMarkup = null,
1641
        ?bool $allowPaidBroadcast = null,
1642
    ): FailResult|Message {
1643
        return $this->call(
3✔
1644
            new SendGame(
3✔
1645
                $chatId,
3✔
1646
                $gameShortName,
3✔
1647
                $businessConnectionId,
3✔
1648
                $messageThreadId,
3✔
1649
                $disableNotification,
3✔
1650
                $protectContent,
3✔
1651
                $messageEffectId,
3✔
1652
                $replyParameters,
3✔
1653
                $replyMarkup,
3✔
1654
                $allowPaidBroadcast,
3✔
1655
            ),
3✔
1656
        );
3✔
1657
    }
1658

1659
    /**
1660
     * @see https://core.telegram.org/bots/api#sendgift
1661
     *
1662
     * @param MessageEntity[]|null $textEntities
1663
     */
1664
    public function sendGift(
3✔
1665
        int $userId,
1666
        string $giftId,
1667
        ?string $text = null,
1668
        ?string $textParseMode = null,
1669
        ?array $textEntities = null,
1670
        ?bool $payForUpgrade = null,
1671
        int|string|null $chatId = null,
1672
    ): FailResult|true {
1673
        return $this->call(
3✔
1674
            new SendGift(
3✔
1675
                $userId,
3✔
1676
                $giftId,
3✔
1677
                $text,
3✔
1678
                $textParseMode,
3✔
1679
                $textEntities,
3✔
1680
                $payForUpgrade,
3✔
1681
                $chatId,
3✔
1682
            ),
3✔
1683
        );
3✔
1684
    }
1685

1686
    /**
1687
     * @see https://core.telegram.org/bots/api#sendinvoice
1688
     *
1689
     * @param LabeledPrice[] $prices
1690
     * @param int[]|null $suggestedTipAmounts
1691
     */
1692
    public function sendInvoice(
3✔
1693
        int|string $chatId,
1694
        string $title,
1695
        string $description,
1696
        string $payload,
1697
        string $currency,
1698
        array $prices,
1699
        ?int $messageThreadId = null,
1700
        #[SensitiveParameter]
1701
        ?string $providerToken = null,
1702
        ?int $maxTipAmount = null,
1703
        ?array $suggestedTipAmounts = null,
1704
        ?string $startParameter = null,
1705
        ?string $providerData = null,
1706
        ?string $photoUrl = null,
1707
        ?int $photoSize = null,
1708
        ?int $photoWidth = null,
1709
        ?int $photoHeight = null,
1710
        ?bool $needName = null,
1711
        ?bool $needPhoneNumber = null,
1712
        ?bool $needEmail = null,
1713
        ?bool $needShippingAddress = null,
1714
        ?bool $sendPhoneNumberToProvider = null,
1715
        ?bool $sendEmailToProvider = null,
1716
        ?bool $isFlexible = null,
1717
        ?bool $disableNotification = null,
1718
        ?bool $protectContent = null,
1719
        ?string $messageEffectId = null,
1720
        ?ReplyParameters $replyParameters = null,
1721
        ?InlineKeyboardMarkup $replyMarkup = null,
1722
        ?bool $allowPaidBroadcast = null,
1723
    ): FailResult|Message {
1724
        return $this->call(
3✔
1725
            new SendInvoice(
3✔
1726
                $chatId,
3✔
1727
                $title,
3✔
1728
                $description,
3✔
1729
                $payload,
3✔
1730
                $currency,
3✔
1731
                $prices,
3✔
1732
                $messageThreadId,
3✔
1733
                $providerToken,
3✔
1734
                $maxTipAmount,
3✔
1735
                $suggestedTipAmounts,
3✔
1736
                $startParameter,
3✔
1737
                $providerData,
3✔
1738
                $photoUrl,
3✔
1739
                $photoSize,
3✔
1740
                $photoWidth,
3✔
1741
                $photoHeight,
3✔
1742
                $needName,
3✔
1743
                $needPhoneNumber,
3✔
1744
                $needEmail,
3✔
1745
                $needShippingAddress,
3✔
1746
                $sendPhoneNumberToProvider,
3✔
1747
                $sendEmailToProvider,
3✔
1748
                $isFlexible,
3✔
1749
                $disableNotification,
3✔
1750
                $protectContent,
3✔
1751
                $messageEffectId,
3✔
1752
                $replyParameters,
3✔
1753
                $replyMarkup,
3✔
1754
                $allowPaidBroadcast,
3✔
1755
            ),
3✔
1756
        );
3✔
1757
    }
1758

1759
    /**
1760
     * @see https://core.telegram.org/bots/api#sendlocation
1761
     */
1762
    public function sendLocation(
3✔
1763
        int|string $chatId,
1764
        float $latitude,
1765
        float $longitude,
1766
        ?string $businessConnectionId = null,
1767
        ?int $messageThreadId = null,
1768
        ?float $horizontalAccuracy = null,
1769
        ?int $livePeriod = null,
1770
        ?int $heading = null,
1771
        ?int $proximityAlertRadius = null,
1772
        ?bool $disableNotification = null,
1773
        ?bool $protectContent = null,
1774
        ?string $messageEffectId = null,
1775
        ?ReplyParameters $replyParameters = null,
1776
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1777
        ?bool $allowPaidBroadcast = null,
1778
    ): FailResult|Message {
1779
        return $this->call(
3✔
1780
            new SendLocation(
3✔
1781
                $chatId,
3✔
1782
                $latitude,
3✔
1783
                $longitude,
3✔
1784
                $businessConnectionId,
3✔
1785
                $messageThreadId,
3✔
1786
                $horizontalAccuracy,
3✔
1787
                $livePeriod,
3✔
1788
                $heading,
3✔
1789
                $proximityAlertRadius,
3✔
1790
                $disableNotification,
3✔
1791
                $protectContent,
3✔
1792
                $messageEffectId,
3✔
1793
                $replyParameters,
3✔
1794
                $replyMarkup,
3✔
1795
                $allowPaidBroadcast,
3✔
1796
            ),
3✔
1797
        );
3✔
1798
    }
1799

1800
    /**
1801
     * @see https://core.telegram.org/bots/api#sendmediagroup
1802
     *
1803
     * @param InputMediaAudio[]|InputMediaDocument[]|InputMediaPhoto[]|InputMediaVideo[] $media
1804
     * @return FailResult|Message[]
1805
     */
1806
    public function sendMediaGroup(
3✔
1807
        int|string $chatId,
1808
        array $media,
1809
        ?string $businessConnectionId = null,
1810
        ?int $messageThreadId = null,
1811
        ?bool $disableNotification = null,
1812
        ?bool $protectContent = null,
1813
        ?string $messageEffectId = null,
1814
        ?ReplyParameters $replyParameters = null,
1815
        ?bool $allowPaidBroadcast = null,
1816
    ): FailResult|array {
1817
        return $this->call(
3✔
1818
            new SendMediaGroup(
3✔
1819
                $chatId,
3✔
1820
                $media,
3✔
1821
                $businessConnectionId,
3✔
1822
                $messageThreadId,
3✔
1823
                $disableNotification,
3✔
1824
                $protectContent,
3✔
1825
                $messageEffectId,
3✔
1826
                $replyParameters,
3✔
1827
                $allowPaidBroadcast,
3✔
1828
            ),
3✔
1829
        );
3✔
1830
    }
1831

1832
    /**
1833
     * @param MessageEntity[]|null $entities
1834
     *
1835
     * @see https://core.telegram.org/bots/api#sendmessage
1836
     */
1837
    public function sendMessage(
3✔
1838
        int|string $chatId,
1839
        string $text,
1840
        ?string $businessConnectionId = null,
1841
        ?int $messageThreadId = null,
1842
        ?string $parseMode = null,
1843
        ?array $entities = null,
1844
        ?LinkPreviewOptions $linkPreviewOptions = null,
1845
        ?bool $disableNotification = null,
1846
        ?bool $protectContent = null,
1847
        ?string $messageEffectId = null,
1848
        ?ReplyParameters $replyParameters = null,
1849
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1850
        ?bool $allowPaidBroadcast = null,
1851
    ): FailResult|Message {
1852
        return $this->call(
3✔
1853
            new SendMessage(
3✔
1854
                $chatId,
3✔
1855
                $text,
3✔
1856
                $businessConnectionId,
3✔
1857
                $messageThreadId,
3✔
1858
                $parseMode,
3✔
1859
                $entities,
3✔
1860
                $linkPreviewOptions,
3✔
1861
                $disableNotification,
3✔
1862
                $protectContent,
3✔
1863
                $messageEffectId,
3✔
1864
                $replyParameters,
3✔
1865
                $replyMarkup,
3✔
1866
                $allowPaidBroadcast,
3✔
1867
            ),
3✔
1868
        );
3✔
1869
    }
1870

1871
    /**
1872
     * @see https://core.telegram.org/bots/api#sendpaidmedia
1873
     *
1874
     * @param InputPaidMedia[] $media
1875
     * @param MessageEntity[]|null $captionEntities
1876
     */
1877
    public function sendPaidMedia(
3✔
1878
        int|string $chatId,
1879
        int $starCount,
1880
        array $media,
1881
        ?string $caption = null,
1882
        ?string $parseMode = null,
1883
        ?array $captionEntities = null,
1884
        ?bool $showCaptionAboveMedia = null,
1885
        ?bool $disableNotification = null,
1886
        ?bool $protectContent = null,
1887
        ?ReplyParameters $replyParameters = null,
1888
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1889
        ?string $businessConnectionId = null,
1890
        ?string $payload = null,
1891
        ?bool $allowPaidBroadcast = null,
1892
    ): FailResult|Message {
1893
        return $this->call(
3✔
1894
            new SendPaidMedia(
3✔
1895
                $chatId,
3✔
1896
                $starCount,
3✔
1897
                $media,
3✔
1898
                $caption,
3✔
1899
                $parseMode,
3✔
1900
                $captionEntities,
3✔
1901
                $showCaptionAboveMedia,
3✔
1902
                $disableNotification,
3✔
1903
                $protectContent,
3✔
1904
                $replyParameters,
3✔
1905
                $replyMarkup,
3✔
1906
                $businessConnectionId,
3✔
1907
                $payload,
3✔
1908
                $allowPaidBroadcast,
3✔
1909
            ),
3✔
1910
        );
3✔
1911
    }
1912

1913
    /**
1914
     * @param MessageEntity[]|null $captionEntities
1915
     *
1916
     * @see https://core.telegram.org/bots/api#sendphoto
1917
     */
1918
    public function sendPhoto(
3✔
1919
        int|string $chatId,
1920
        string|InputFile $photo,
1921
        ?string $businessConnectionId = null,
1922
        ?int $messageThreadId = null,
1923
        ?string $caption = null,
1924
        ?string $parseMode = null,
1925
        ?array $captionEntities = null,
1926
        ?bool $showCaptionAboveMedia = null,
1927
        ?bool $hasSpoiler = null,
1928
        ?bool $disableNotification = null,
1929
        ?bool $protectContent = null,
1930
        ?string $messageEffectId = null,
1931
        ?ReplyParameters $replyParameters = null,
1932
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1933
        ?bool $allowPaidBroadcast = null,
1934
    ): FailResult|Message {
1935
        return $this->call(
3✔
1936
            new SendPhoto(
3✔
1937
                $chatId,
3✔
1938
                $photo,
3✔
1939
                $businessConnectionId,
3✔
1940
                $messageThreadId,
3✔
1941
                $caption,
3✔
1942
                $parseMode,
3✔
1943
                $captionEntities,
3✔
1944
                $showCaptionAboveMedia,
3✔
1945
                $hasSpoiler,
3✔
1946
                $disableNotification,
3✔
1947
                $protectContent,
3✔
1948
                $messageEffectId,
3✔
1949
                $replyParameters,
3✔
1950
                $replyMarkup,
3✔
1951
                $allowPaidBroadcast,
3✔
1952
            ),
3✔
1953
        );
3✔
1954
    }
1955

1956
    /**
1957
     * @param InputPollOption[] $options
1958
     * @param MessageEntity[]|null $questionEntities
1959
     * @param MessageEntity[]|null $explanationEntities
1960
     *
1961
     * @see https://core.telegram.org/bots/api#sendpoll
1962
     */
1963
    public function sendPoll(
3✔
1964
        int|string $chatId,
1965
        string $question,
1966
        array $options,
1967
        ?string $businessConnectionId = null,
1968
        ?int $messageThreadId = null,
1969
        ?string $questionParseMode = null,
1970
        ?array $questionEntities = null,
1971
        ?bool $isAnonymous = null,
1972
        ?string $type = null,
1973
        ?bool $allowsMultipleAnswers = null,
1974
        ?int $correctOptionId = null,
1975
        ?string $explanation = null,
1976
        ?string $explanationParseMode = null,
1977
        ?array $explanationEntities = null,
1978
        ?int $openPeriod = null,
1979
        ?DateTimeImmutable $closeDate = null,
1980
        ?bool $isClosed = null,
1981
        ?bool $disableNotification = null,
1982
        ?bool $protectContent = null,
1983
        ?string $messageEffectId = null,
1984
        ?ReplyParameters $replyParameters = null,
1985
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
1986
        ?bool $allowPaidBroadcast = null,
1987
    ): FailResult|Message {
1988
        return $this->call(
3✔
1989
            new SendPoll(
3✔
1990
                $chatId,
3✔
1991
                $question,
3✔
1992
                $options,
3✔
1993
                $businessConnectionId,
3✔
1994
                $messageThreadId,
3✔
1995
                $questionParseMode,
3✔
1996
                $questionEntities,
3✔
1997
                $isAnonymous,
3✔
1998
                $type,
3✔
1999
                $allowsMultipleAnswers,
3✔
2000
                $correctOptionId,
3✔
2001
                $explanation,
3✔
2002
                $explanationParseMode,
3✔
2003
                $explanationEntities,
3✔
2004
                $openPeriod,
3✔
2005
                $closeDate,
3✔
2006
                $isClosed,
3✔
2007
                $disableNotification,
3✔
2008
                $protectContent,
3✔
2009
                $messageEffectId,
3✔
2010
                $replyParameters,
3✔
2011
                $replyMarkup,
3✔
2012
                $allowPaidBroadcast,
3✔
2013
            ),
3✔
2014
        );
3✔
2015
    }
2016

2017
    /**
2018
     * @see https://core.telegram.org/bots/api#sendsticker
2019
     */
2020
    public function sendSticker(
3✔
2021
        int|string $chatId,
2022
        InputFile|string $sticker,
2023
        ?string $businessConnectionId = null,
2024
        ?int $messageThreadId = null,
2025
        ?string $emoji = null,
2026
        ?bool $disableNotification = null,
2027
        ?bool $protectContent = null,
2028
        ?string $messageEffectId = null,
2029
        ?ReplyParameters $replyParameters = null,
2030
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2031
        ?bool $allowPaidBroadcast = null,
2032
    ): FailResult|Message {
2033
        return $this->call(
3✔
2034
            new SendSticker(
3✔
2035
                $chatId,
3✔
2036
                $sticker,
3✔
2037
                $businessConnectionId,
3✔
2038
                $messageThreadId,
3✔
2039
                $emoji,
3✔
2040
                $disableNotification,
3✔
2041
                $protectContent,
3✔
2042
                $messageEffectId,
3✔
2043
                $replyParameters,
3✔
2044
                $replyMarkup,
3✔
2045
                $allowPaidBroadcast,
3✔
2046
            ),
3✔
2047
        );
3✔
2048
    }
2049

2050
    /**
2051
     * @see https://core.telegram.org/bots/api#sendvenue
2052
     */
2053
    public function sendVenue(
3✔
2054
        int|string $chatId,
2055
        float $latitude,
2056
        float $longitude,
2057
        string $title,
2058
        string $address,
2059
        ?string $businessConnectionId = null,
2060
        ?int $messageThreadId = null,
2061
        ?string $foursquareId = null,
2062
        ?string $foursquareType = null,
2063
        ?string $googlePlaceId = null,
2064
        ?string $googlePlaceType = null,
2065
        ?bool $disableNotification = null,
2066
        ?bool $protectContent = null,
2067
        ?string $messageEffectId = null,
2068
        ?ReplyParameters $replyParameters = null,
2069
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2070
        ?bool $allowPaidBroadcast = null,
2071
    ): FailResult|Message {
2072
        return $this->call(
3✔
2073
            new SendVenue(
3✔
2074
                $chatId,
3✔
2075
                $latitude,
3✔
2076
                $longitude,
3✔
2077
                $title,
3✔
2078
                $address,
3✔
2079
                $businessConnectionId,
3✔
2080
                $messageThreadId,
3✔
2081
                $foursquareId,
3✔
2082
                $foursquareType,
3✔
2083
                $googlePlaceId,
3✔
2084
                $googlePlaceType,
3✔
2085
                $disableNotification,
3✔
2086
                $protectContent,
3✔
2087
                $messageEffectId,
3✔
2088
                $replyParameters,
3✔
2089
                $replyMarkup,
3✔
2090
                $allowPaidBroadcast,
3✔
2091
            ),
3✔
2092
        );
3✔
2093
    }
2094

2095
    /**
2096
     * @param MessageEntity[]|null $captionEntities
2097
     *
2098
     * @see https://core.telegram.org/bots/api#sendvideo
2099
     */
2100
    public function sendVideo(
3✔
2101
        int|string $chatId,
2102
        string|InputFile $video,
2103
        ?string $businessConnectionId = null,
2104
        ?int $messageThreadId = null,
2105
        ?int $duration = null,
2106
        ?int $width = null,
2107
        ?int $height = null,
2108
        string|InputFile|null $thumbnail = null,
2109
        ?string $caption = null,
2110
        ?string $parseMode = null,
2111
        ?array $captionEntities = null,
2112
        ?bool $showCaptionAboveMedia = null,
2113
        ?bool $hasSpoiler = null,
2114
        ?bool $supportsStreaming = null,
2115
        ?bool $disableNotification = null,
2116
        ?bool $protectContent = null,
2117
        ?string $messageEffectId = null,
2118
        ?ReplyParameters $replyParameters = null,
2119
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2120
        ?bool $allowPaidBroadcast = null,
2121
        string|InputFile|null $cover = null,
2122
        ?int $startTimestamp = null,
2123
    ): FailResult|Message {
2124
        return $this->call(
3✔
2125
            new SendVideo(
3✔
2126
                $chatId,
3✔
2127
                $video,
3✔
2128
                $businessConnectionId,
3✔
2129
                $messageThreadId,
3✔
2130
                $duration,
3✔
2131
                $width,
3✔
2132
                $height,
3✔
2133
                $thumbnail,
3✔
2134
                $caption,
3✔
2135
                $parseMode,
3✔
2136
                $captionEntities,
3✔
2137
                $showCaptionAboveMedia,
3✔
2138
                $hasSpoiler,
3✔
2139
                $supportsStreaming,
3✔
2140
                $disableNotification,
3✔
2141
                $protectContent,
3✔
2142
                $messageEffectId,
3✔
2143
                $replyParameters,
3✔
2144
                $replyMarkup,
3✔
2145
                $allowPaidBroadcast,
3✔
2146
                $cover,
3✔
2147
                $startTimestamp,
3✔
2148
            ),
3✔
2149
        );
3✔
2150
    }
2151

2152
    /**
2153
     * @see https://core.telegram.org/bots/api#sendvideonote
2154
     */
2155
    public function sendVideoNote(
3✔
2156
        int|string $chatId,
2157
        string|InputFile $videoNote,
2158
        ?string $businessConnectionId = null,
2159
        ?int $messageThreadId = null,
2160
        ?int $duration = null,
2161
        ?int $length = null,
2162
        string|InputFile|null $thumbnail = null,
2163
        ?bool $disableNotification = null,
2164
        ?bool $protectContent = null,
2165
        ?string $messageEffectId = null,
2166
        ?ReplyParameters $replyParameters = null,
2167
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2168
        ?bool $allowPaidBroadcast = null,
2169
    ): FailResult|Message {
2170
        return $this->call(
3✔
2171
            new SendVideoNote(
3✔
2172
                $chatId,
3✔
2173
                $videoNote,
3✔
2174
                $businessConnectionId,
3✔
2175
                $messageThreadId,
3✔
2176
                $duration,
3✔
2177
                $length,
3✔
2178
                $thumbnail,
3✔
2179
                $disableNotification,
3✔
2180
                $protectContent,
3✔
2181
                $messageEffectId,
3✔
2182
                $replyParameters,
3✔
2183
                $replyMarkup,
3✔
2184
                $allowPaidBroadcast,
3✔
2185
            ),
3✔
2186
        );
3✔
2187
    }
2188

2189
    /**
2190
     * @param MessageEntity[]|null $captionEntities
2191
     *
2192
     * @see https://core.telegram.org/bots/api#sendvoice
2193
     */
2194
    public function sendVoice(
3✔
2195
        int|string $chatId,
2196
        string|InputFile $voice,
2197
        ?string $businessConnectionId = null,
2198
        ?int $messageThreadId = null,
2199
        ?string $caption = null,
2200
        ?string $parseMode = null,
2201
        ?array $captionEntities = null,
2202
        ?int $duration = null,
2203
        ?bool $disableNotification = null,
2204
        ?bool $protectContent = null,
2205
        ?string $messageEffectId = null,
2206
        ?ReplyParameters $replyParameters = null,
2207
        InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
2208
        ?bool $allowPaidBroadcast = null,
2209
    ): FailResult|Message {
2210
        return $this->call(
3✔
2211
            new SendVoice(
3✔
2212
                $chatId,
3✔
2213
                $voice,
3✔
2214
                $businessConnectionId,
3✔
2215
                $messageThreadId,
3✔
2216
                $caption,
3✔
2217
                $parseMode,
3✔
2218
                $captionEntities,
3✔
2219
                $duration,
3✔
2220
                $disableNotification,
3✔
2221
                $protectContent,
3✔
2222
                $messageEffectId,
3✔
2223
                $replyParameters,
3✔
2224
                $replyMarkup,
3✔
2225
                $allowPaidBroadcast,
3✔
2226
            ),
3✔
2227
        );
3✔
2228
    }
2229

2230
    /**
2231
     * @see https://core.telegram.org/bots/api#setchatadministratorcustomtitle
2232
     */
2233
    public function setChatAdministratorCustomTitle(
3✔
2234
        int|string $chatId,
2235
        int $userId,
2236
        string $customTitle,
2237
    ): FailResult|true {
2238
        return $this->call(
3✔
2239
            new SetChatAdministratorCustomTitle($chatId, $userId, $customTitle),
3✔
2240
        );
3✔
2241
    }
2242

2243
    /**
2244
     * @see https://core.telegram.org/bots/api#setchatdescription
2245
     */
2246
    public function setChatDescription(int|string $chatId, ?string $description = null): FailResult|true
3✔
2247
    {
2248
        return $this->call(
3✔
2249
            new SetChatDescription($chatId, $description),
3✔
2250
        );
3✔
2251
    }
2252

2253
    /**
2254
     * @see https://core.telegram.org/bots/api#setchatmenubutton
2255
     */
2256
    public function setChatMenuButton(?int $chatId = null, ?MenuButton $menuButton = null): FailResult|true
3✔
2257
    {
2258
        return $this->call(new SetChatMenuButton($chatId, $menuButton));
3✔
2259
    }
2260

2261
    /**
2262
     * @see https://core.telegram.org/bots/api#setchatpermissions
2263
     */
2264
    public function setChatPermissions(
3✔
2265
        int|string $chatId,
2266
        ChatPermissions $permissions,
2267
        ?bool $useIndependentChatPermissions = null,
2268
    ): FailResult|true {
2269
        return $this->call(
3✔
2270
            new SetChatPermissions($chatId, $permissions, $useIndependentChatPermissions),
3✔
2271
        );
3✔
2272
    }
2273

2274
    /**
2275
     * @see https://core.telegram.org/bots/api#setchatphoto
2276
     */
2277
    public function setChatPhoto(int|string $chatId, InputFile $photo): FailResult|true
3✔
2278
    {
2279
        return $this->call(
3✔
2280
            new SetChatPhoto($chatId, $photo),
3✔
2281
        );
3✔
2282
    }
2283

2284
    /**
2285
     * @see https://core.telegram.org/bots/api#setchatstickerset
2286
     */
2287
    public function setChatStickerSet(int|string $chatId, string $stickerSetName): FailResult|true
3✔
2288
    {
2289
        return $this->call(
3✔
2290
            new SetChatStickerSet($chatId, $stickerSetName),
3✔
2291
        );
3✔
2292
    }
2293

2294
    /**
2295
     * @see https://core.telegram.org/bots/api#setchattitle
2296
     */
2297
    public function setChatTitle(int|string $chatId, string $title): FailResult|true
3✔
2298
    {
2299
        return $this->call(
3✔
2300
            new SetChatTitle($chatId, $title),
3✔
2301
        );
3✔
2302
    }
2303

2304
    /**
2305
     * @see https://core.telegram.org/bots/api#setcustomemojistickersetthumbnail
2306
     */
2307
    public function setCustomEmojiStickerSetThumbnail(string $name, ?string $customEmojiId = null): FailResult|true
3✔
2308
    {
2309
        return $this->call(new SetCustomEmojiStickerSetThumbnail($name, $customEmojiId));
3✔
2310
    }
2311

2312
    /**
2313
     * @see https://core.telegram.org/bots/api#setgamescore
2314
     */
2315
    public function setGameScore(
3✔
2316
        int $userId,
2317
        int $score,
2318
        ?bool $force = null,
2319
        ?bool $disableEditMessage = null,
2320
        ?int $chatId = null,
2321
        ?int $messageId = null,
2322
        ?string $inlineMessageId = null,
2323
    ): FailResult|Message|true {
2324
        return $this->call(
3✔
2325
            new SetGameScore(
3✔
2326
                $userId,
3✔
2327
                $score,
3✔
2328
                $force,
3✔
2329
                $disableEditMessage,
3✔
2330
                $chatId,
3✔
2331
                $messageId,
3✔
2332
                $inlineMessageId,
3✔
2333
            ),
3✔
2334
        );
3✔
2335
    }
2336

2337
    /**
2338
     * @see https://core.telegram.org/bots/api#setmessagereaction
2339
     *
2340
     * @param ReactionType[]|null $reaction
2341
     */
2342
    public function setMessageReaction(
3✔
2343
        int|string $chatId,
2344
        int $messageId,
2345
        ?array $reaction = null,
2346
        ?bool $isBig = null,
2347
    ): FailResult|true {
2348
        return $this->call(
3✔
2349
            new SetMessageReaction($chatId, $messageId, $reaction, $isBig),
3✔
2350
        );
3✔
2351
    }
2352

2353
    /**
2354
     * @param BotCommand[] $commands
2355
     *
2356
     * @see https://core.telegram.org/bots/api#setmycommands
2357
     */
2358
    public function setMyCommands(
3✔
2359
        array $commands,
2360
        ?BotCommandScope $scope = null,
2361
        ?string $languageCode = null,
2362
    ): FailResult|true {
2363
        return $this->call(new SetMyCommands($commands, $scope, $languageCode));
3✔
2364
    }
2365

2366
    /**
2367
     * @see https://core.telegram.org/bots/api#setmydefaultadministratorrights
2368
     */
2369
    public function setMyDefaultAdministratorRights(
3✔
2370
        ?ChatAdministratorRights $rights = null,
2371
        ?bool $forChannels = null,
2372
    ): FailResult|true {
2373
        return $this->call(new SetMyDefaultAdministratorRights($rights, $forChannels));
3✔
2374
    }
2375

2376
    /**
2377
     * @see https://core.telegram.org/bots/api#setmydescription
2378
     */
2379
    public function setMyDescription(?string $description = null, ?string $languageCode = null): FailResult|true
3✔
2380
    {
2381
        return $this->call(new SetMyDescription($description, $languageCode));
3✔
2382
    }
2383

2384
    /**
2385
     * @see https://core.telegram.org/bots/api#setmyname
2386
     */
2387
    public function setMyName(?string $name = null, ?string $languageCode = null): FailResult|true
3✔
2388
    {
2389
        return $this->call(new SetMyName($name, $languageCode));
3✔
2390
    }
2391

2392
    /**
2393
     * @see https://core.telegram.org/bots/api#setmyshortdescription
2394
     */
2395
    public function setMyShortDescription(
3✔
2396
        ?string $shortDescription = null,
2397
        ?string $languageCode = null,
2398
    ): FailResult|true {
2399
        return $this->call(new SetMyShortDescription($shortDescription, $languageCode));
3✔
2400
    }
2401

2402
    /**
2403
     * @see https://core.telegram.org/bots/api#setpassportdataerrors
2404
     *
2405
     * @param PassportElementError[] $errors
2406
     */
2407
    public function setPassportDataErrors(int $userId, array $errors): FailResult|true
3✔
2408
    {
2409
        return $this->call(new SetPassportDataErrors($userId, $errors));
3✔
2410
    }
2411

2412
    /**
2413
     * @see https://core.telegram.org/bots/api#setstickeremojilist
2414
     *
2415
     * @param string[] $emojiList
2416
     */
2417
    public function setStickerEmojiList(string $sticker, array $emojiList): FailResult|true
3✔
2418
    {
2419
        return $this->call(new SetStickerEmojiList($sticker, $emojiList));
3✔
2420
    }
2421

2422
    /**
2423
     * @see https://core.telegram.org/bots/api#setstickerkeywords
2424
     *
2425
     * @param string[]|null $keywords
2426
     */
2427
    public function setStickerKeywords(string $sticker, ?array $keywords = null): FailResult|true
3✔
2428
    {
2429
        return $this->call(new SetStickerKeywords($sticker, $keywords));
3✔
2430
    }
2431

2432
    /**
2433
     * @see https://core.telegram.org/bots/api#setstickermaskposition
2434
     */
2435
    public function setStickerMaskPosition(string $sticker, ?MaskPosition $maskPosition = null): FailResult|true
3✔
2436
    {
2437
        return $this->call(new SetStickerMaskPosition($sticker, $maskPosition));
3✔
2438
    }
2439

2440
    /**
2441
     * @see https://core.telegram.org/bots/api#setstickerpositioninset
2442
     */
2443
    public function setStickerPositionInSet(string $sticker, int $position): FailResult|true
3✔
2444
    {
2445
        return $this->call(new SetStickerPositionInSet($sticker, $position));
3✔
2446
    }
2447

2448
    /**
2449
     * @see https://core.telegram.org/bots/api#setstickersetthumbnail
2450
     */
2451
    public function setStickerSetThumbnail(
3✔
2452
        string $name,
2453
        int $userId,
2454
        string $format,
2455
        InputFile|string|null $thumbnail = null,
2456
    ): FailResult|true {
2457
        return $this->call(
3✔
2458
            new SetStickerSetThumbnail(
3✔
2459
                $name,
3✔
2460
                $userId,
3✔
2461
                $format,
3✔
2462
                $thumbnail,
3✔
2463
            ),
3✔
2464
        );
3✔
2465
    }
2466

2467
    /**
2468
     * @see https://core.telegram.org/bots/api#setstickersettitle
2469
     */
2470
    public function setStickerSetTitle(string $name, string $title): FailResult|true
3✔
2471
    {
2472
        return $this->call(new SetStickerSetTitle($name, $title));
3✔
2473
    }
2474

2475
    /**
2476
     * @see https://core.telegram.org/bots/api#setuseremojistatus
2477
     */
2478
    public function setUserEmojiStatus(
3✔
2479
        int $userId,
2480
        ?string $emojiStatusCustomEmojiId = null,
2481
        ?DateTimeImmutable $emojiStatusExpirationDate = null,
2482
    ): FailResult|true {
2483
        return $this->call(
3✔
2484
            new SetUserEmojiStatus(
3✔
2485
                $userId,
3✔
2486
                $emojiStatusCustomEmojiId,
3✔
2487
                $emojiStatusExpirationDate,
3✔
2488
            ),
3✔
2489
        );
3✔
2490
    }
2491

2492
    /**
2493
     * @see https://core.telegram.org/bots/api#setwebhook
2494
     */
2495
    public function setWebhook(
3✔
2496
        string $url,
2497
        ?string $ipAddress = null,
2498
        ?int $maxConnections = null,
2499
        ?array $allowUpdates = null,
2500
        ?bool $dropPendingUpdates = null,
2501
        #[SensitiveParameter]
2502
        ?string $secretToken = null,
2503
    ): FailResult|true {
2504
        return $this->call(
3✔
2505
            new SetWebhook($url, $ipAddress, $maxConnections, $allowUpdates, $dropPendingUpdates, $secretToken),
3✔
2506
        );
3✔
2507
    }
2508

2509
    /**
2510
     * @see https://core.telegram.org/bots/api#stopmessagelivelocation
2511
     */
2512
    public function stopMessageLiveLocation(
3✔
2513
        ?string $businessConnectionId = null,
2514
        int|string|null $chatId = null,
2515
        ?int $messageId = null,
2516
        ?string $inlineMessageId = null,
2517
        ?InlineKeyboardMarkup $replyMarkup = null,
2518
    ): FailResult|Message|true {
2519
        return $this->call(
3✔
2520
            new StopMessageLiveLocation(
3✔
2521
                $businessConnectionId,
3✔
2522
                $chatId,
3✔
2523
                $messageId,
3✔
2524
                $inlineMessageId,
3✔
2525
                $replyMarkup,
3✔
2526
            ),
3✔
2527
        );
3✔
2528
    }
2529

2530
    /**
2531
     * @see https://core.telegram.org/bots/api#stoppoll
2532
     */
2533
    public function stopPoll(
3✔
2534
        int|string $chatId,
2535
        int $messageId,
2536
        ?string $businessConnectionId = null,
2537
        ?InlineKeyboardMarkup $replyMarkup = null,
2538
    ): FailResult|Poll {
2539
        return $this->call(
3✔
2540
            new StopPoll(
3✔
2541
                $chatId,
3✔
2542
                $messageId,
3✔
2543
                $businessConnectionId,
3✔
2544
                $replyMarkup,
3✔
2545
            ),
3✔
2546
        );
3✔
2547
    }
2548

2549
    /**
2550
     * @see https://core.telegram.org/bots/api#unbanchatmember
2551
     */
2552
    public function unbanChatMember(
3✔
2553
        int|string $chatId,
2554
        int $userId,
2555
        ?bool $onlyIfBanned = null,
2556
    ): FailResult|true {
2557
        return $this->call(
3✔
2558
            new UnbanChatMember($chatId, $userId, $onlyIfBanned),
3✔
2559
        );
3✔
2560
    }
2561

2562
    /**
2563
     * @see https://core.telegram.org/bots/api#unbanchatsenderchat
2564
     */
2565
    public function unbanChatSenderChat(int|string $chatId, int $senderChatId): FailResult|true
3✔
2566
    {
2567
        return $this->call(
3✔
2568
            new UnbanChatSenderChat($chatId, $senderChatId),
3✔
2569
        );
3✔
2570
    }
2571

2572
    /**
2573
     * @see https://core.telegram.org/bots/api#unhidegeneralforumtopic
2574
     */
2575
    public function unhideGeneralForumTopic(int|string $chatId): FailResult|true
3✔
2576
    {
2577
        return $this->call(
3✔
2578
            new UnhideGeneralForumTopic($chatId),
3✔
2579
        );
3✔
2580
    }
2581

2582
    /**
2583
     * @see https://core.telegram.org/bots/api#unpinchatmessage
2584
     */
2585
    public function unpinChatMessage(int|string $chatId, ?int $messageId = null): FailResult|true
3✔
2586
    {
2587
        return $this->call(
3✔
2588
            new UnpinChatMessage($chatId, $messageId),
3✔
2589
        );
3✔
2590
    }
2591

2592
    /**
2593
     * @see https://core.telegram.org/bots/api#unpinallchatmessages
2594
     */
2595
    public function unpinAllChatMessages(int|string $chatId): FailResult|true
3✔
2596
    {
2597
        return $this->call(
3✔
2598
            new UnpinAllChatMessages($chatId),
3✔
2599
        );
3✔
2600
    }
2601

2602
    /**
2603
     * @see https://core.telegram.org/bots/api#unpinallforumtopicmessages
2604
     */
2605
    public function unpinAllForumTopicMessages(int|string $chatId, int $messageThreadId): FailResult|true
3✔
2606
    {
2607
        return $this->call(
3✔
2608
            new UnpinAllForumTopicMessages($chatId, $messageThreadId),
3✔
2609
        );
3✔
2610
    }
2611

2612
    /**
2613
     * @see https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
2614
     */
2615
    public function unpinAllGeneralForumTopicMessages(int|string $chatId): FailResult|true
3✔
2616
    {
2617
        return $this->call(
3✔
2618
            new UnpinAllGeneralForumTopicMessages($chatId),
3✔
2619
        );
3✔
2620
    }
2621

2622
    /**
2623
     * @see https://core.telegram.org/bots/api#uploadstickerfile
2624
     */
2625
    public function uploadStickerFile(int $userId, InputFile $sticker, string $stickerFormat): FailResult|File
3✔
2626
    {
2627
        return $this->call(
3✔
2628
            new UploadStickerFile($userId, $sticker, $stickerFormat),
3✔
2629
        );
3✔
2630
    }
2631

2632
    /**
2633
     * @see https://core.telegram.org/bots/api#verifychat
2634
     */
2635
    public function verifyChat(int|string $chatId, ?string $customDescription = null): FailResult|true
3✔
2636
    {
2637
        return $this->call(
3✔
2638
            new VerifyChat($chatId, $customDescription),
3✔
2639
        );
3✔
2640
    }
2641

2642
    /**
2643
     * @see https://core.telegram.org/bots/api#verifyuser
2644
     */
2645
    public function verifyUser(int $userId, ?string $customDescription = null): FailResult|true
3✔
2646
    {
2647
        return $this->call(
3✔
2648
            new VerifyUser($userId, $customDescription),
3✔
2649
        );
3✔
2650
    }
2651
}
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