-
-
Notifications
You must be signed in to change notification settings - Fork 10
Telegram Bot API 10.0 #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
4c6e854
Add `supportsGuestQueries` field to `User` type.
vjik 42b56eb
Add `guestQueryId`, `guestBotCallerUser` and `guestBotCallerChat` fie…
vjik a2dfb62
Add `guestMessage` field to `Update` type
vjik af862fa
Add `SentGuestMessage` type
vjik b71acc3
Add `AnswerGuestQuery` method
vjik 0dee8c0
Add `canReactToMessages` field to `ChatMemberRestricted` and `ChatPer…
vjik 46e1412
Add `returnBots` parameter to `GetChatAdministrators` method
vjik 8774b6e
Add `DeleteAllMessageReactions` method
vjik 1880baf
Add `DeleteMessageReaction` method
vjik 053de25
Add `InputMediaSticker`, `InputMediaVenue` and `InputMediaLocation` t…
vjik bf5eed9
Add `PollMedia` and `LivePhoto` type
vjik 585408d
Add `explanationMedia` and `media` fields to `Poll` type
vjik 01a5a4e
Add `membersOnly` and `countryCodes` fields to `Poll` type
vjik 46d1210
Add `media` field to `PollOption` type
vjik fa643ea
Add `InputPollMedia` and `InputPollOptionMedia` types
vjik d0fb5d7
Fix psalm
vjik a1242c5
Add `explanationMedia`, `media`, `membersOnly` and `countryCodes` par…
vjik 7821d64
Add `media` field to `InputPollOption` type
vjik 1a171fe
Add `InputMediaLivePhoto` type
vjik 0ebff89
Add `live_photo` field to `Message` and `ExternalReplyInfo` types
vjik fa0aa3e
Add `SendLivePhoto` method
vjik 49f8451
Add `PaidMediaLivePhoto` type
vjik b9967ff
Add `InputPaidMediaLivePhoto` type
vjik dea8809
`SendMediaGroup` method now supports `InputMediaLivePhoto` type
vjik 68f7cb9
Add `BotAccessSettings` type
vjik 4edb58a
Add `GetManagedBotAccessSettings` method
vjik 5b4094d
Add `SetManagedBotAccessSettings` method
vjik a2d582e
Add `GetUserPersonalChatMessages` method
vjik 6d2cf40
fix
vjik 1ec3090
fix
vjik 7cad54b
`text` parameter in `SendMessageDraft` method is now optional
vjik 20761df
readme
vjik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Agent Guidelines | ||
|
|
||
| ## Writing Tests | ||
|
|
||
| - For `InputFile|string` parameters, the string must be a file ID, not a URL. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Phptg\BotApi\Method; | ||
|
|
||
| use Phptg\BotApi\ParseResult\ValueProcessor\TrueValue; | ||
| use Phptg\BotApi\Transport\HttpMethod; | ||
| use Phptg\BotApi\MethodInterface; | ||
|
|
||
| /** | ||
| * @see https://core.telegram.org/bots/api#deleteallmessagereactions | ||
| * | ||
| * @template-implements MethodInterface<true> | ||
| */ | ||
| final readonly class DeleteAllMessageReactions implements MethodInterface | ||
| { | ||
| public function __construct( | ||
| private int|string $chatId, | ||
| private ?int $userId = null, | ||
| private ?int $actorChatId = null, | ||
| ) {} | ||
|
|
||
| public function getHttpMethod(): HttpMethod | ||
| { | ||
| return HttpMethod::POST; | ||
| } | ||
|
|
||
| public function getApiMethod(): string | ||
| { | ||
| return 'deleteAllMessageReactions'; | ||
| } | ||
|
|
||
| public function getData(): array | ||
| { | ||
| return array_filter( | ||
| [ | ||
| 'chat_id' => $this->chatId, | ||
| 'user_id' => $this->userId, | ||
| 'actor_chat_id' => $this->actorChatId, | ||
| ], | ||
| static fn(mixed $value): bool => $value !== null, | ||
| ); | ||
| } | ||
|
|
||
| public function getResultType(): TrueValue | ||
| { | ||
| return new TrueValue(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Phptg\BotApi\Method; | ||
|
|
||
| use Phptg\BotApi\ParseResult\ValueProcessor\TrueValue; | ||
| use Phptg\BotApi\Transport\HttpMethod; | ||
| use Phptg\BotApi\MethodInterface; | ||
|
|
||
| /** | ||
| * @see https://core.telegram.org/bots/api#deletemessagereaction | ||
| * | ||
| * @template-implements MethodInterface<true> | ||
| */ | ||
| final readonly class DeleteMessageReaction implements MethodInterface | ||
| { | ||
| public function __construct( | ||
| private int|string $chatId, | ||
| private int $messageId, | ||
| private ?int $userId = null, | ||
| private ?int $actorChatId = null, | ||
| ) {} | ||
|
|
||
| public function getHttpMethod(): HttpMethod | ||
| { | ||
| return HttpMethod::POST; | ||
| } | ||
|
|
||
| public function getApiMethod(): string | ||
| { | ||
| return 'deleteMessageReaction'; | ||
| } | ||
|
|
||
| public function getData(): array | ||
| { | ||
| return array_filter( | ||
| [ | ||
| 'chat_id' => $this->chatId, | ||
| 'message_id' => $this->messageId, | ||
| 'user_id' => $this->userId, | ||
| 'actor_chat_id' => $this->actorChatId, | ||
| ], | ||
| static fn(mixed $value): bool => $value !== null, | ||
| ); | ||
| } | ||
|
|
||
| public function getResultType(): TrueValue | ||
| { | ||
| return new TrueValue(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Phptg\BotApi\Method; | ||
|
|
||
| use Phptg\BotApi\ParseResult\ValueProcessor\ObjectValue; | ||
| use Phptg\BotApi\Transport\HttpMethod; | ||
| use Phptg\BotApi\MethodInterface; | ||
| use Phptg\BotApi\Type\BotAccessSettings; | ||
|
|
||
| /** | ||
| * @see https://core.telegram.org/bots/api#getmanagedbotaccesssettings | ||
| * | ||
| * @template-implements MethodInterface<BotAccessSettings> | ||
| */ | ||
| final readonly class GetManagedBotAccessSettings implements MethodInterface | ||
| { | ||
| public function __construct( | ||
| private int $userId, | ||
| ) {} | ||
|
|
||
| public function getHttpMethod(): HttpMethod | ||
| { | ||
| return HttpMethod::GET; | ||
| } | ||
|
|
||
| public function getApiMethod(): string | ||
| { | ||
| return 'getManagedBotAccessSettings'; | ||
| } | ||
|
|
||
| public function getData(): array | ||
| { | ||
| return ['user_id' => $this->userId]; | ||
| } | ||
|
|
||
| public function getResultType(): ObjectValue | ||
| { | ||
| return new ObjectValue(BotAccessSettings::class); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Phptg\BotApi\Method; | ||
|
|
||
| use Phptg\BotApi\ParseResult\ValueProcessor\ArrayOfObjectsValue; | ||
| use Phptg\BotApi\Transport\HttpMethod; | ||
| use Phptg\BotApi\MethodInterface; | ||
| use Phptg\BotApi\Type\Message; | ||
|
|
||
| /** | ||
| * @see https://core.telegram.org/bots/api#getuserpersonalchatmessages | ||
| * | ||
| * @template-implements MethodInterface<array<Message>> | ||
| */ | ||
| final readonly class GetUserPersonalChatMessages implements MethodInterface | ||
| { | ||
| public function __construct( | ||
| private int $userId, | ||
| private int $limit, | ||
| ) {} | ||
|
|
||
| public function getHttpMethod(): HttpMethod | ||
| { | ||
| return HttpMethod::GET; | ||
| } | ||
|
|
||
| public function getApiMethod(): string | ||
| { | ||
| return 'getUserPersonalChatMessages'; | ||
| } | ||
|
|
||
| public function getData(): array | ||
| { | ||
| return [ | ||
| 'user_id' => $this->userId, | ||
| 'limit' => $this->limit, | ||
| ]; | ||
| } | ||
|
|
||
| public function getResultType(): ArrayOfObjectsValue | ||
| { | ||
| return new ArrayOfObjectsValue(Message::class); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Phptg\BotApi\Method\Inline; | ||
|
|
||
| use Phptg\BotApi\ParseResult\ValueProcessor\ObjectValue; | ||
| use Phptg\BotApi\Transport\HttpMethod; | ||
| use Phptg\BotApi\MethodInterface; | ||
| use Phptg\BotApi\Type\Inline\InlineQueryResult; | ||
| use Phptg\BotApi\Type\SentGuestMessage; | ||
|
|
||
| /** | ||
| * @see https://core.telegram.org/bots/api#answerguestquery | ||
| * | ||
| * @template-implements MethodInterface<SentGuestMessage> | ||
| */ | ||
| final readonly class AnswerGuestQuery implements MethodInterface | ||
| { | ||
| public function __construct( | ||
| private string $guestQueryId, | ||
| private InlineQueryResult $result, | ||
| ) {} | ||
|
|
||
| public function getHttpMethod(): HttpMethod | ||
| { | ||
| return HttpMethod::POST; | ||
| } | ||
|
|
||
| public function getApiMethod(): string | ||
| { | ||
| return 'answerGuestQuery'; | ||
| } | ||
|
|
||
| public function getData(): array | ||
| { | ||
| return [ | ||
| 'guest_query_id' => $this->guestQueryId, | ||
| 'result' => $this->result->toRequestArray(), | ||
| ]; | ||
| } | ||
|
|
||
| public function getResultType(): ObjectValue | ||
| { | ||
| return new ObjectValue(SentGuestMessage::class); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.