Skip to content

Commit

Permalink
Telegram Bot API 7.11 support (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik authored Oct 31, 2024
1 parent 1e7b11a commit 658a79c
Show file tree
Hide file tree
Showing 52 changed files with 275 additions and 8 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Telegram Bot API for PHP Change Log

## 0.4.5 October 31, 2024

- New #124: Add `CopyTextButton` type.
- New #124: Add `copyText` field to `InlineKeyboardButton` type.
- New #124: Add `allowPaidBroadcast` field to `sendMessage`, `sendPhoto`, `sendVideo`, `sendAnimation`, `sendAudio`,
`sendDocument`, `sendPaidMedia`, `sendSticker`, `sendVideoNote`, `sendVoice`, `sendLocation`, `sendVenue`,
`sendContact`, `sendPoll`, `sendDice`, `sendInvoice`, `sendGame`, `sendMediaGroup` and `copyMessage` methods.
- New #124: Add `TransactionPartnerTelegramApi` type.
- Bug #124: Rename `PaidMediaPurchased` property `payload` to `paidMediaPayload`.

## 0.4.4 October 26, 2024

- Enh #119: Use fully qualified function calls to improve performance.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

The package provides a simple and convenient way to interact with the Telegram Bot API.

✔️ Telegram Bot API 7.10 (September 6, 2024) is **fully supported**.
✔️ Telegram Bot API 7.11 (October 31, 2024) is **fully supported**.

## Requirements

Expand Down
2 changes: 2 additions & 0 deletions src/Method/CopyMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function __construct(
private ?bool $protectContent = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}


Expand Down Expand Up @@ -67,6 +68,7 @@ public function getData(): array
'show_caption_above_media' => $this->showCaptionAboveMedia,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
],
Expand Down
2 changes: 2 additions & 0 deletions src/Method/Game/SendGame.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private ?InlineKeyboardMarkup $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand All @@ -49,6 +50,7 @@ public function getData(): array
'game_short_name' => $this->gameShortName,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/Payment/SendInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private ?InlineKeyboardMarkup $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -95,6 +96,7 @@ public function getData(): array
'is_flexible' => $this->isFlexible,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendAnimation.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -78,6 +79,7 @@ public function getData(): array
'has_spoiler' => $this->hasSpoiler,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendAudio.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -74,6 +75,7 @@ public function getData(): array
'thumbnail' => $this->thumbnail,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand All @@ -58,6 +59,7 @@ public function getData(): array
'vcard' => $this->vcard,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendDice.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand All @@ -52,6 +53,7 @@ public function getData(): array
'emoji' => $this->emoji,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -70,6 +71,7 @@ public function getData(): array
'disable_content_type_detection' => $this->disableContentTypeDetection,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -62,6 +63,7 @@ public function getData(): array
'proximity_alert_radius' => $this->proximityAlertRadius,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendMediaGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function __construct(
private ?bool $protectContent = null,
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -66,6 +67,7 @@ static function (
'media' => $media,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
...$fileCollector->get(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -66,6 +67,7 @@ public function getData(): array
'link_preview_options' => $this->linkPreviewOptions?->toRequestArray(),
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendPaidMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function __construct(
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?string $businessConnectionId = null,
private ?string $payload = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -79,6 +80,7 @@ static function (InputPaidMedia $inputMedia) use ($fileCollector): array {
'show_caption_above_media' => $this->showCaptionAboveMedia,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
...$fileCollector->get(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendPhoto.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -70,6 +71,7 @@ public function getData(): array
'has_spoiler' => $this->hasSpoiler,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendPoll.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -99,6 +100,7 @@ public function getData(): array
'is_closed' => $this->isClosed,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendVenue.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -66,6 +67,7 @@ public function getData(): array
'google_place_type' => $this->googlePlaceType,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -80,6 +81,7 @@ public function getData(): array
'supports_streaming' => $this->supportsStreaming,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendVideoNote.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand All @@ -59,6 +60,7 @@ public function getData(): array
'thumbnail' => $this->thumbnail,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/SendVoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand Down Expand Up @@ -68,6 +69,7 @@ public function getData(): array
'duration' => $this->duration,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/Method/Sticker/SendSticker.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function __construct(
private ?string $messageEffectId = null,
private ?ReplyParameters $replyParameters = null,
private InlineKeyboardMarkup|ReplyKeyboardMarkup|ReplyKeyboardRemove|ForceReply|null $replyMarkup = null,
private ?bool $allowPaidBroadcast = null,
) {}

public function getHttpMethod(): HttpMethod
Expand All @@ -55,6 +56,7 @@ public function getData(): array
'emoji' => $this->emoji,
'disable_notification' => $this->disableNotification,
'protect_content' => $this->protectContent,
'allow_paid_broadcast' => $this->allowPaidBroadcast,
'message_effect_id' => $this->messageEffectId,
'reply_parameters' => $this->replyParameters?->toRequestArray(),
'reply_markup' => $this->replyMarkup?->toRequestArray(),
Expand Down
2 changes: 2 additions & 0 deletions src/ParseResult/ValueProcessor/TransactionPartnerValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Vjik\TelegramBot\Api\Type\Payment\TransactionPartnerFragment;
use Vjik\TelegramBot\Api\Type\Payment\TransactionPartnerOther;
use Vjik\TelegramBot\Api\Type\Payment\TransactionPartnerTelegramAds;
use Vjik\TelegramBot\Api\Type\Payment\TransactionPartnerTelegramApi;
use Vjik\TelegramBot\Api\Type\Payment\TransactionPartnerUser;

/**
Expand All @@ -25,6 +26,7 @@ public function getClassMap(): array
return [
'fragment' => TransactionPartnerFragment::class,
'telegram_ads' => TransactionPartnerTelegramAds::class,
'telegram_api' => TransactionPartnerTelegramApi::class,
'user' => TransactionPartnerUser::class,
'other' => TransactionPartnerOther::class,
];
Expand Down
Loading

0 comments on commit 658a79c

Please sign in to comment.