Skip to content
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

Bot API 7.5 #56

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 37 additions & 6 deletions src/Layers/Generated.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
use Telepath\Telegram\ReplyParameters;
use Telepath\Telegram\SentWebAppMessage;
use Telepath\Telegram\ShippingOption;
use Telepath\Telegram\StarTransactions;
use Telepath\Telegram\Sticker;
use Telepath\Telegram\StickerSet;
use Telepath\Telegram\Update;
Expand Down Expand Up @@ -1702,9 +1703,10 @@ public function getMyDefaultAdministratorRights(?bool $for_channels = null): Cha
}

/**
* Use this method to edit text and <a href="https://core.telegram.org/bots/api#games">game</a> messages. On success, if the edited message is not an inline message, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned.
* Use this method to edit text and <a href="https://core.telegram.org/bots/api#games">game</a> messages. On success, if the edited message is not an inline message, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
*
* @param string $text New text of the message, 1-4096 characters after entities parsing
* @param string $business_connection_id Unique identifier of the business connection on behalf of which the message to be edited was sent
* @param int|string $chat_id Required if <em>inline_message_id</em> is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int $message_id Required if <em>inline_message_id</em> is not specified. Identifier of the message to edit
* @param string $inline_message_id Required if <em>chat_id</em> and <em>message_id</em> are not specified. Identifier of the inline message
Expand All @@ -1717,6 +1719,7 @@ public function getMyDefaultAdministratorRights(?bool $for_channels = null): Cha
*/
public function editMessageText(
string $text,
?string $business_connection_id = null,
int|string|null $chat_id = null,
?int $message_id = null,
?string $inline_message_id = null,
Expand All @@ -1729,8 +1732,9 @@ public function editMessageText(
}

/**
* Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned.
* Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
*
* @param string $business_connection_id Unique identifier of the business connection on behalf of which the message to be edited was sent
* @param int|string $chat_id Required if <em>inline_message_id</em> is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int $message_id Required if <em>inline_message_id</em> is not specified. Identifier of the message to edit
* @param string $inline_message_id Required if <em>chat_id</em> and <em>message_id</em> are not specified. Identifier of the inline message
Expand All @@ -1743,6 +1747,7 @@ public function editMessageText(
* @throws TelegramException
*/
public function editMessageCaption(
?string $business_connection_id = null,
int|string|null $chat_id = null,
?int $message_id = null,
?string $inline_message_id = null,
Expand All @@ -1756,9 +1761,10 @@ public function editMessageCaption(
}

/**
* Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned.
* Use this method to edit animation, audio, document, photo, or video messages. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
*
* @param InputMedia $media A JSON-serialized object for a new media content of the message
* @param string $business_connection_id Unique identifier of the business connection on behalf of which the message to be edited was sent
* @param int|string $chat_id Required if <em>inline_message_id</em> is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int $message_id Required if <em>inline_message_id</em> is not specified. Identifier of the message to edit
* @param string $inline_message_id Required if <em>chat_id</em> and <em>message_id</em> are not specified. Identifier of the inline message
Expand All @@ -1768,6 +1774,7 @@ public function editMessageCaption(
*/
public function editMessageMedia(
InputMedia $media,
?string $business_connection_id = null,
int|string|null $chat_id = null,
?int $message_id = null,
?string $inline_message_id = null,
Expand All @@ -1781,6 +1788,7 @@ public function editMessageMedia(
*
* @param float $latitude Latitude of new location
* @param float $longitude Longitude of new location
* @param string $business_connection_id Unique identifier of the business connection on behalf of which the message to be edited was sent
* @param int|string $chat_id Required if <em>inline_message_id</em> is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int $message_id Required if <em>inline_message_id</em> is not specified. Identifier of the message to edit
* @param string $inline_message_id Required if <em>chat_id</em> and <em>message_id</em> are not specified. Identifier of the inline message
Expand All @@ -1795,6 +1803,7 @@ public function editMessageMedia(
public function editMessageLiveLocation(
float $latitude,
float $longitude,
?string $business_connection_id = null,
int|string|null $chat_id = null,
?int $message_id = null,
?string $inline_message_id = null,
Expand All @@ -1810,6 +1819,7 @@ public function editMessageLiveLocation(
/**
* Use this method to stop updating a live location message before <em>live_period</em> expires. On success, if the message is not an inline message, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned.
*
* @param string $business_connection_id Unique identifier of the business connection on behalf of which the message to be edited was sent
* @param int|string $chat_id Required if <em>inline_message_id</em> is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int $message_id Required if <em>inline_message_id</em> is not specified. Identifier of the message with live location to stop
* @param string $inline_message_id Required if <em>chat_id</em> and <em>message_id</em> are not specified. Identifier of the inline message
Expand All @@ -1818,6 +1828,7 @@ public function editMessageLiveLocation(
* @throws TelegramException
*/
public function stopMessageLiveLocation(
?string $business_connection_id = null,
int|string|null $chat_id = null,
?int $message_id = null,
?string $inline_message_id = null,
Expand All @@ -1827,8 +1838,9 @@ public function stopMessageLiveLocation(
}

/**
* Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned.
* Use this method to edit only the reply markup of messages. On success, if the edited message is not an inline message, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
*
* @param string $business_connection_id Unique identifier of the business connection on behalf of which the message to be edited was sent
* @param int|string $chat_id Required if <em>inline_message_id</em> is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int $message_id Required if <em>inline_message_id</em> is not specified. Identifier of the message to edit
* @param string $inline_message_id Required if <em>chat_id</em> and <em>message_id</em> are not specified. Identifier of the inline message
Expand All @@ -1837,6 +1849,7 @@ public function stopMessageLiveLocation(
* @throws TelegramException
*/
public function editMessageReplyMarkup(
?string $business_connection_id = null,
int|string|null $chat_id = null,
?int $message_id = null,
?string $inline_message_id = null,
Expand All @@ -1850,12 +1863,17 @@ public function editMessageReplyMarkup(
*
* @param int|string $chat_id Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param int $message_id Identifier of the original message with the poll
* @param string $business_connection_id Unique identifier of the business connection on behalf of which the message to be edited was sent
* @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for a new message <a href="https://core.telegram.org/bots/features#inline-keyboards">inline keyboard</a>.
*
* @throws TelegramException
*/
public function stopPoll(int|string $chat_id, int $message_id, ?InlineKeyboardMarkup $reply_markup = null): Poll
{
public function stopPoll(
int|string $chat_id,
int $message_id,
?string $business_connection_id = null,
?InlineKeyboardMarkup $reply_markup = null,
): Poll {
return $this->raw('stopPoll', func_get_args());
}

Expand Down Expand Up @@ -2318,6 +2336,19 @@ public function answerPreCheckoutQuery(
return $this->raw('answerPreCheckoutQuery', func_get_args());
}

/**
* Returns the bot's Telegram Star transactions in chronological order. On success, returns a <a href="https://core.telegram.org/bots/api#startransactions">StarTransactions</a> object.
*
* @param int $offset Number of transactions to skip in the response
* @param int $limit The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.
*
* @throws TelegramException
*/
public function getStarTransactions(?int $offset = null, ?int $limit = null): StarTransactions
{
return $this->raw('getStarTransactions', func_get_args());
}

/**
* Refunds a successful payment in <a href="https://t.me/BotNews/90">Telegram Stars</a>. Returns <em>True</em> on success.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/InlineKeyboardButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class InlineKeyboardButton extends Type
/** <em>Optional</em>. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. */
public ?string $url = null;

/** <em>Optional</em>. Data to be sent in a <a href="https://core.telegram.org/bots/api#callbackquery">callback query</a> to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account. */
/** <em>Optional</em>. Data to be sent in a <a href="https://core.telegram.org/bots/api#callbackquery">callback query</a> to the bot when the button is pressed, 1-64 bytes */
public ?string $callback_data = null;

/** <em>Optional</em>. Description of the <a href="https://core.telegram.org/bots/webapps">Web App</a> that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method <a href="https://core.telegram.org/bots/api#answerwebappquery">answerWebAppQuery</a>. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account. */
Expand All @@ -46,7 +46,7 @@ class InlineKeyboardButton extends Type
/**
* @param string $text Label text on the button
* @param string $url <em>Optional</em>. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
* @param string $callback_data <em>Optional</em>. Data to be sent in a <a href="https://core.telegram.org/bots/api#callbackquery">callback query</a> to the bot when button is pressed, 1-64 bytes. Not supported for messages sent on behalf of a Telegram Business account.
* @param string $callback_data <em>Optional</em>. Data to be sent in a <a href="https://core.telegram.org/bots/api#callbackquery">callback query</a> to the bot when the button is pressed, 1-64 bytes
* @param WebAppInfo $web_app <em>Optional</em>. Description of the <a href="https://core.telegram.org/bots/webapps">Web App</a> that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method <a href="https://core.telegram.org/bots/api#answerwebappquery">answerWebAppQuery</a>. Available only in private chats between a user and the bot. Not supported for messages sent on behalf of a Telegram Business account.
* @param LoginUrl $login_url <em>Optional</em>. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the <a href="https://core.telegram.org/widgets/login">Telegram Login Widget</a>.
* @param string $switch_inline_query <em>Optional</em>. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted. Not supported for messages sent on behalf of a Telegram Business account.
Expand Down
29 changes: 29 additions & 0 deletions src/Telegram/RevenueWithdrawalState.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* This file is auto-generated.
*/

namespace Telepath\Telegram;

use Telepath\Bot;
use Telepath\Types\Factory;
use Telepath\Types\Type;

/**
* This object describes the state of a revenue withdrawal operation. Currently, it can be one of
*/
abstract class RevenueWithdrawalState extends Type implements Factory
{
/** Type of the state */
public string $type;

public static function factory(array $data, ?Bot $bot = null): self
{
return match ($data['type']) {
'pending' => new RevenueWithdrawalStatePending($data, $bot),
'succeeded' => new RevenueWithdrawalStateSucceeded($data, $bot),
'failed' => new RevenueWithdrawalStateFailed($data, $bot),
};
}
}
22 changes: 22 additions & 0 deletions src/Telegram/RevenueWithdrawalStateFailed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* This file is auto-generated.
*/

namespace Telepath\Telegram;

/**
* The withdrawal failed and the transaction was refunded.
*/
class RevenueWithdrawalStateFailed extends RevenueWithdrawalState
{
/** Type of the state, always “failed” */
public string $type = 'failed';

public static function make(): static
{
return new static([
]);
}
}
22 changes: 22 additions & 0 deletions src/Telegram/RevenueWithdrawalStatePending.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* This file is auto-generated.
*/

namespace Telepath\Telegram;

/**
* The withdrawal is in progress.
*/
class RevenueWithdrawalStatePending extends RevenueWithdrawalState
{
/** Type of the state, always “pending” */
public string $type = 'pending';

public static function make(): static
{
return new static([
]);
}
}
34 changes: 34 additions & 0 deletions src/Telegram/RevenueWithdrawalStateSucceeded.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/**
* This file is auto-generated.
*/

namespace Telepath\Telegram;

/**
* The withdrawal succeeded.
*/
class RevenueWithdrawalStateSucceeded extends RevenueWithdrawalState
{
/** Type of the state, always “succeeded” */
public string $type = 'succeeded';

/** Date the withdrawal was completed in Unix time */
public int $date;

/** An HTTPS URL that can be used to see transaction details */
public string $url;

/**
* @param int $date Date the withdrawal was completed in Unix time
* @param string $url An HTTPS URL that can be used to see transaction details
*/
public static function make(int $date, string $url): static
{
return new static([
'date' => $date,
'url' => $url,
]);
}
}
Loading