Skip to content

Commit

Permalink
Update code to reflect latest changes to the Bot API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
TiiFuchs committed Aug 6, 2024
1 parent 00ab3d4 commit 17f9bf0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/Layers/Generated.php
Original file line number Diff line number Diff line change
Expand Up @@ -1223,25 +1223,34 @@ public function setChatDescription(int|string $chat_id, ?string $description = n
*
* @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 a message to pin
* @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be pinned
* @param bool $disable_notification Pass <em>True</em> if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats.
*
* @throws TelegramException
*/
public function pinChatMessage(int|string $chat_id, int $message_id, ?bool $disable_notification = null): bool
{
public function pinChatMessage(
int|string $chat_id,
int $message_id,
?string $business_connection_id = null,
?bool $disable_notification = null,
): bool {
return $this->raw('pinChatMessage', func_get_args());
}

/**
* Use this method to remove a message from the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns <em>True</em> on success.
*
* @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 a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned.
* @param string $business_connection_id Unique identifier of the business connection on behalf of which the message will be unpinned
* @param int $message_id Identifier of the message to unpin. Required if <em>business_connection_id</em> is specified. If not specified, the most recent pinned message (by sending date) will be unpinned.
*
* @throws TelegramException
*/
public function unpinChatMessage(int|string $chat_id, ?int $message_id = null): bool
{
public function unpinChatMessage(
int|string $chat_id,
?string $business_connection_id = null,
?int $message_id = null,
): bool {
return $this->raw('unpinChatMessage', func_get_args());
}

Expand Down
6 changes: 6 additions & 0 deletions src/Telegram/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class User extends Type
/** <em>Optional</em>. <em>True</em>, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in <a href="https://core.telegram.org/bots/api#getme">getMe</a>. */
public ?bool $can_connect_to_business = null;

/** <em>Optional</em>. <em>True</em>, if the bot has a main Web App. Returned only in <a href="https://core.telegram.org/bots/api#getme">getMe</a>. */
public ?bool $has_main_web_app = null;

/**
* @param int $id Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
* @param bool $is_bot <em>True</em>, if this user is a bot
Expand All @@ -62,6 +65,7 @@ class User extends Type
* @param bool $can_read_all_group_messages <em>Optional</em>. <em>True</em>, if <a href="https://core.telegram.org/bots/features#privacy-mode">privacy mode</a> is disabled for the bot. Returned only in <a href="https://core.telegram.org/bots/api#getme">getMe</a>.
* @param bool $supports_inline_queries <em>Optional</em>. <em>True</em>, if the bot supports inline queries. Returned only in <a href="https://core.telegram.org/bots/api#getme">getMe</a>.
* @param bool $can_connect_to_business <em>Optional</em>. <em>True</em>, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in <a href="https://core.telegram.org/bots/api#getme">getMe</a>.
* @param bool $has_main_web_app <em>Optional</em>. <em>True</em>, if the bot has a main Web App. Returned only in <a href="https://core.telegram.org/bots/api#getme">getMe</a>.
*/
public static function make(
int $id,
Expand All @@ -76,6 +80,7 @@ public static function make(
?bool $can_read_all_group_messages = null,
?bool $supports_inline_queries = null,
?bool $can_connect_to_business = null,
?bool $has_main_web_app = null,
): static {
return new static([
'id' => $id,
Expand All @@ -90,6 +95,7 @@ public static function make(
'can_read_all_group_messages' => $can_read_all_group_messages,
'supports_inline_queries' => $supports_inline_queries,
'can_connect_to_business' => $can_connect_to_business,
'has_main_web_app' => $has_main_web_app,
]);
}
}

0 comments on commit 17f9bf0

Please sign in to comment.