Skip to content

Commit

Permalink
Bot API 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
luzrain committed May 28, 2024
1 parent f0db9ca commit f167efc
Show file tree
Hide file tree
Showing 36 changed files with 259 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PHP Wrapper for Telegram Bot API

[![Bot Api 7.3](https://img.shields.io/badge/Bot%20API-7.3-0088cc.svg?style=flat)](https://core.telegram.org/bots/api-changelog#may-6-2024)
[![Bot Api 7.4](https://img.shields.io/badge/Bot%20API-7.4-0088cc.svg?style=flat)](https://core.telegram.org/bots/api-changelog#may-28-2024)
[![PHP >=8.2](https://img.shields.io/badge/PHP->=8.2-777bb3.svg?style=flat)](https://www.php.net/releases/8.2/en.php)
[![Tests Status](https://img.shields.io/github/actions/workflow/status/luzrain/telegram-bot-api/tests.yaml?branch=master)](../../actions/workflows/tests.yaml)

Expand Down
3 changes: 1 addition & 2 deletions src/Method/AddStickerToSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
* Static sticker sets can have up to 120 stickers.
* Returns True on success.
*
* @extends Method<bool>
* @extends Method<true>
*/
final class AddStickerToSet extends Method
{
protected static string $methodName = 'addStickerToSet';

public function __construct(

/**
* User identifier of sticker set owner
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Method/CopyMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public function __construct(
*/
protected array|null $captionEntities = null,

/**
* Pass True, if the caption must be shown above the message media. Ignored if a new caption isn't specified.
*/
protected bool|null $showCaptionAboveMedia = null,

/**
* Sends the message silently. Users will receive a notification with no sound.
*/
Expand Down
32 changes: 17 additions & 15 deletions src/Method/CreateInvoiceLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,30 @@ public function __construct(
protected string $payload,

/**
* Payment provider token, obtained via BotFather
*/
protected string $providerToken,

/**
* Three-letter ISO 4217 currency code, see more on currencies
* Three-letter ISO 4217 currency code, see more on currencies. Pass "XTR" for payments in Telegram Stars.
*
* @see https://core.telegram.org/bots/payments#supported-currencies
*/
protected string $currency,

/**
* Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
* Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.).
* Must contain exactly one item for payments in Telegram Stars.
*
* @var list<LabeledPrice>
*/
protected array $prices,

/**
* Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
*/
protected string|null $providerToken = null,

/**
* The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double).
* For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json,
* it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0
* it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
* Defaults to 0. Not supported for payments in Telegram Stars.
*
* @see https://core.telegram.org/bots/payments/currencies.json
*/
Expand Down Expand Up @@ -97,37 +99,37 @@ public function __construct(
protected int|null $photoHeight = null,

/**
* Pass True if you require the user's full name to complete the order
* Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars.
*/
protected bool|null $needName = null,

/**
* Pass True if you require the user's phone number to complete the order
* Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars.
*/
protected bool|null $needPhoneNumber = null,

/**
* Pass True if you require the user's email address to complete the order
* Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars.
*/
protected bool|null $needEmail = null,

/**
* Pass True if you require the user's shipping address to complete the order
* Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars.
*/
protected bool|null $needShippingAddress = null,

/**
* Pass True if the user's phone number should be sent to the provider
* Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars.
*/
protected bool|null $sendPhoneNumberToProvider = null,

/**
* Pass True if the user's email address should be sent to the provider
* Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars.
*/
protected bool|null $sendEmailToProvider = null,

/**
* Pass True if the final price depends on the shipping method
* Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars.
*/
protected bool|null $isFlexible = null,
) {
Expand Down
5 changes: 5 additions & 0 deletions src/Method/EditMessageCaption.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public function __construct(
*/
protected array|null $captionEntities = null,

/**
* Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
*/
protected bool|null $showCaptionAboveMedia = null,

/**
* A JSON-serialized object for an inline keyboard.
*/
Expand Down
30 changes: 30 additions & 0 deletions src/Method/RefundStarPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace Luzrain\TelegramBotApi\Method;

use Luzrain\TelegramBotApi\Method;

/**
* Refunds a successful payment in Telegram Stars. Returns True on success.
*
* @extends Method<true>
*/
final class RefundStarPayment extends Method
{
protected static string $methodName = 'refundStarPayment';

public function __construct(
/**
* Identifier of the user whose payment will be refunded
*/
protected int $userId,

/**
* Telegram payment identifier
*/
protected string $telegramPaymentChargeId,
) {
}
}
10 changes: 10 additions & 0 deletions src/Method/SendAnimation.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public function __construct(
*/
protected array|null $captionEntities = null,

/**
* Pass True, if the caption must be shown above the message media
*/
protected bool|null $showCaptionAboveMedia = null,

/**
* Pass True if the photo needs to be covered with a spoiler animation
*/
Expand All @@ -99,6 +104,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Method/SendAudio.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Method/SendContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Method/SendDice.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Method/SendDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Method/SendGame.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
39 changes: 23 additions & 16 deletions src/Method/SendInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
use Luzrain\TelegramBotApi\Type\ReplyParameters;

/**
* Use this method to send invoices. On success, the sent Message is returned.
* Use this method to send invoices.
* On success, the sent Message is returned.
*
* @extends Method<Message>
*/
Expand Down Expand Up @@ -42,19 +43,15 @@ public function __construct(
protected string $payload,

/**
* Payment provider token, obtained via @BotFather
*/
protected string $providerToken,

/**
* Three-letter ISO 4217 currency code, see more on currencies
* Three-letter ISO 4217 currency code, see more on currencies. Pass "XTR" for payments in Telegram Stars.
*
* @see https://core.telegram.org/bots/payments#supported-currencies
*/
protected string $currency,

/**
* Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
* Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.).
* Must contain exactly one item for payments in Telegram Stars.
*
* @var list<LabeledPrice>
*/
Expand All @@ -65,11 +62,16 @@ public function __construct(
*/
protected int|null $messageThreadId = null,

/**
* Payment provider token, obtained via @BotFather. Pass an empty string for payments in Telegram Stars.
*/
protected string|null $providerToken = null,

/**
* The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double).
* For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json,
* it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
* Defaults to 0
* Defaults to 0. Not supported for payments in Telegram Stars.
*/
protected int|null $maxTipAmount = null,

Expand Down Expand Up @@ -118,37 +120,37 @@ public function __construct(
protected int|null $photoHeight = null,

/**
* Pass True if you require the user's full name to complete the order
* Pass True if you require the user's full name to complete the order. Ignored for payments in Telegram Stars.
*/
protected bool|null $needName = null,

/**
* Pass True if you require the user's phone number to complete the order
* Pass True if you require the user's phone number to complete the order. Ignored for payments in Telegram Stars.
*/
protected bool|null $needPhoneNumber = null,

/**
* Pass True if you require the user's email address to complete the order
* Pass True if you require the user's email address to complete the order. Ignored for payments in Telegram Stars.
*/
protected bool|null $needEmail = null,

/**
* Pass True if you require the user's shipping address to complete the order
* Pass True if you require the user's shipping address to complete the order. Ignored for payments in Telegram Stars.
*/
protected bool|null $needShippingAddress = null,

/**
* Pass True if the user's phone number should be sent to provider
* Pass True if the user's phone number should be sent to the provider. Ignored for payments in Telegram Stars.
*/
protected bool|null $sendPhoneNumberToProvider = null,

/**
* Pass True if the user's email address should be sent to provider
* Pass True if the user's email address should be sent to the provider. Ignored for payments in Telegram Stars.
*/
protected bool|null $sendEmailToProvider = null,

/**
* Pass True if the final price depends on the shipping method
* Pass True if the final price depends on the shipping method. Ignored for payments in Telegram Stars.
*/
protected bool|null $isFlexible = null,

Expand All @@ -162,6 +164,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Method/SendLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Method/SendMediaGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
5 changes: 5 additions & 0 deletions src/Method/SendMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public function __construct(
*/
protected bool|null $protectContent = null,

/**
* Unique identifier of the message effect to be added to the message; for private chats only
*/
protected string|null $messageEffectId = null,

/**
* Description of the message to reply to
*/
Expand Down
Loading

0 comments on commit f167efc

Please sign in to comment.