Skip to content
Open
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
29 changes: 28 additions & 1 deletion src/Layers/Generated.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
use Telepath\Telegram\Update;
use Telepath\Telegram\User;
use Telepath\Telegram\UserChatBoosts;
use Telepath\Telegram\UserProfileAudios;
use Telepath\Telegram\UserProfilePhotos;
use Telepath\Telegram\WebhookInfo;
use Telepath\Types\Enums\ChatActionType;
Expand Down Expand Up @@ -1080,6 +1081,20 @@ public function getUserProfilePhotos(int $user_id, ?int $offset = null, ?int $li
return $this->raw('getUserProfilePhotos', func_get_args());
}

/**
* Use this method to get a list of profile audios for a user. Returns a <a href="https://core.telegram.org/bots/api#userprofileaudios">UserProfileAudios</a> object.
*
* @param int $user_id Unique identifier of the target user
* @param int $offset Sequential number of the first audio to be returned. By default, all audios are returned.
* @param int $limit Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.
*
* @throws TelegramException
*/
public function getUserProfileAudios(int $user_id, ?int $offset = null, ?int $limit = null): UserProfileAudios
{
return $this->raw('getUserProfileAudios', func_get_args());
}

/**
* Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method <a href="https://core.telegram.org/bots/webapps#initializing-mini-apps">requestEmojiStatusAccess</a>. Returns <em>True</em> on success.
*
Expand Down Expand Up @@ -1597,7 +1612,7 @@ public function getForumTopicIconStickers(): array
}

/**
* Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the <em>can_manage_topics</em> administrator rights. Returns information about the created topic as a <a href="https://core.telegram.org/bots/api#forumtopic">ForumTopic</a> object.
* Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the <em>can_manage_topics</em> administrator right. Returns information about the created topic as a <a href="https://core.telegram.org/bots/api#forumtopic">ForumTopic</a> object.
*
* @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
* @param string $name Topic name, 1-128 characters
Expand Down Expand Up @@ -1924,6 +1939,18 @@ public function getMyShortDescription(?string $language_code = null): BotShortDe
return $this->raw('getMyShortDescription', func_get_args());
}

/**
* Changes the profile photo of the bot. Returns <em>True</em> on success.
*
* @param InputProfilePhoto $photo The new profile photo to set
*
* @throws TelegramException
*/
public function setMyProfilePhoto(InputProfilePhoto $photo): bool
{
return $this->raw('setMyProfilePhoto', func_get_args());
}

/**
* Use this method to change the bot's menu button in a private chat, or the default menu button. Returns <em>True</em> on success.
*
Expand Down
6 changes: 6 additions & 0 deletions src/Telegram/ChatFullInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ class ChatFullInfo extends Type
/** <em>Optional</em>. For private chats, the rating of the user if any */
public ?UserRating $rating = null;

/** <em>Optional</em>. For private chats, the first audio added to the profile of the user */
public ?Audio $first_profile_audio = null;

/** <em>Optional</em>. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews */
public ?UniqueGiftColors $unique_gift_colors = null;

Expand Down Expand Up @@ -220,6 +223,7 @@ class ChatFullInfo extends Type
* @param int $linked_chat_id <em>Optional</em>. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.
* @param ChatLocation $location <em>Optional</em>. For supergroups, the location to which the supergroup is connected
* @param UserRating $rating <em>Optional</em>. For private chats, the rating of the user if any
* @param Audio $first_profile_audio <em>Optional</em>. For private chats, the first audio added to the profile of the user
* @param UniqueGiftColors $unique_gift_colors <em>Optional</em>. The color scheme based on a unique gift that must be used for the chat's name, message replies and link previews
* @param int $paid_message_star_count <em>Optional</em>. The number of Telegram Stars a general user have to pay to send a message to the chat
*/
Expand Down Expand Up @@ -272,6 +276,7 @@ public static function make(
?int $linked_chat_id = null,
?ChatLocation $location = null,
?UserRating $rating = null,
?Audio $first_profile_audio = null,
?UniqueGiftColors $unique_gift_colors = null,
?int $paid_message_star_count = null,
): static {
Expand Down Expand Up @@ -324,6 +329,7 @@ public static function make(
'linked_chat_id' => $linked_chat_id,
'location' => $location,
'rating' => $rating,
'first_profile_audio' => $first_profile_audio,
'unique_gift_colors' => $unique_gift_colors,
'paid_message_star_count' => $paid_message_star_count,
]);
Expand Down
28 changes: 28 additions & 0 deletions src/Telegram/ChatOwnerChanged.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

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

namespace Telepath\Telegram;

use Telepath\Types\Type;

/**
* Describes a service message about an ownership change in the chat.
*/
class ChatOwnerChanged extends Type
{
/** The new owner of the chat */
public User $new_owner;

/**
* @param User $new_owner The new owner of the chat
*/
public static function make(User $new_owner): static
{
return new static([
'new_owner' => $new_owner,
]);
}
}
28 changes: 28 additions & 0 deletions src/Telegram/ChatOwnerLeft.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

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

namespace Telepath\Telegram;

use Telepath\Types\Type;

/**
* Describes a service message about the chat owner leaving the chat.
*/
class ChatOwnerLeft extends Type
{
/** <em>Optional</em>. The user which will be the new owner of the chat if the previous owner does not return to the chat */
public ?User $new_owner = null;

/**
* @param User $new_owner <em>Optional</em>. The user which will be the new owner of the chat if the previous owner does not return to the chat
*/
public static function make(?User $new_owner = null): static
{
return new static([
'new_owner' => $new_owner,
]);
}
}
14 changes: 13 additions & 1 deletion src/Telegram/InlineKeyboardButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@
use Telepath\Types\Type;

/**
* This object represents one button of an inline keyboard. Exactly one of the optional fields must be used to specify type of the button.
* This object represents one button of an inline keyboard. Exactly one of the fields other than <em>text</em>, <em>icon_custom_emoji_id</em>, and <em>style</em> must be used to specify the type of the button.
*/
class InlineKeyboardButton extends Type
{
/** Label text on the button */
public string $text;

/** <em>Optional</em>. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on <a href="https://fragment.com">Fragment</a> or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. */
public ?string $icon_custom_emoji_id = null;

/** <em>Optional</em>. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */
public ?string $style = null;

/** <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;

Expand Down Expand Up @@ -48,6 +54,8 @@ class InlineKeyboardButton extends Type

/**
* @param string $text Label text on the button
* @param string $icon_custom_emoji_id <em>Optional</em>. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on <a href="https://fragment.com">Fragment</a> or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription.
* @param string $style <em>Optional</em>. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used.
* @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 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.
Expand All @@ -61,6 +69,8 @@ class InlineKeyboardButton extends Type
*/
public static function make(
string $text,
?string $icon_custom_emoji_id = null,
?string $style = null,
?string $url = null,
?string $callback_data = null,
?WebAppInfo $web_app = null,
Expand All @@ -74,6 +84,8 @@ public static function make(
): static {
return new static([
'text' => $text,
'icon_custom_emoji_id' => $icon_custom_emoji_id,
'style' => $style,
'url' => $url,
'callback_data' => $callback_data,
'web_app' => $web_app,
Expand Down
18 changes: 15 additions & 3 deletions src/Telegram/KeyboardButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@
use Telepath\Types\Type;

/**
* This object represents one button of the reply keyboard. At most one of the optional fields must be used to specify type of the button. For simple text buttons, <em>String</em> can be used instead of this object to specify the button text.
* This object represents one button of the reply keyboard. At most one of the fields other than <em>text</em>, <em>icon_custom_emoji_id</em>, and <em>style</em> must be used to specify the type of the button. For simple text buttons, <em>String</em> can be used instead of this object to specify the button text.
*/
class KeyboardButton extends Type
{
/** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */
/** Text of the button. If none of the fields other than <em>text</em>, <em>icon_custom_emoji_id</em>, and <em>style</em> are used, it will be sent as a message when the button is pressed */
public string $text;

/** <em>Optional</em>. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on <a href="https://fragment.com">Fragment</a> or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription. */
public ?string $icon_custom_emoji_id = null;

/** <em>Optional</em>. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used. */
public ?string $style = null;

/** <em>Optional</em>. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only. */
public ?KeyboardButtonRequestUsers $request_users = null;

Expand All @@ -35,7 +41,9 @@ class KeyboardButton extends Type
public ?WebAppInfo $web_app = null;

/**
* @param string $text Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed
* @param string $text Text of the button. If none of the fields other than <em>text</em>, <em>icon_custom_emoji_id</em>, and <em>style</em> are used, it will be sent as a message when the button is pressed
* @param string $icon_custom_emoji_id <em>Optional</em>. Unique identifier of the custom emoji shown before the text of the button. Can only be used by bots that purchased additional usernames on <a href="https://fragment.com">Fragment</a> or in the messages directly sent by the bot to private, group and supergroup chats if the owner of the bot has a Telegram Premium subscription.
* @param string $style <em>Optional</em>. Style of the button. Must be one of “danger” (red), “success” (green) or “primary” (blue). If omitted, then an app-specific style is used.
* @param KeyboardButtonRequestUsers $request_users <em>Optional</em>. If specified, pressing the button will open a list of suitable users. Identifiers of selected users will be sent to the bot in a “users_shared” service message. Available in private chats only.
* @param KeyboardButtonRequestChat $request_chat <em>Optional</em>. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only.
* @param bool $request_contact <em>Optional</em>. If <em>True</em>, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
Expand All @@ -45,6 +53,8 @@ class KeyboardButton extends Type
*/
public static function make(
string $text,
?string $icon_custom_emoji_id = null,
?string $style = null,
?KeyboardButtonRequestUsers $request_users = null,
?KeyboardButtonRequestChat $request_chat = null,
?bool $request_contact = null,
Expand All @@ -54,6 +64,8 @@ public static function make(
): static {
return new static([
'text' => $text,
'icon_custom_emoji_id' => $icon_custom_emoji_id,
'style' => $style,
'request_users' => $request_users,
'request_chat' => $request_chat,
'request_contact' => $request_contact,
Expand Down
12 changes: 12 additions & 0 deletions src/Telegram/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ class Message extends MaybeInaccessibleMessage
/** <em>Optional</em>. A member was removed from the group, information about them (this member may be the bot itself) */
public ?User $left_chat_member = null;

/** <em>Optional</em>. Service message: chat owner has left */
public ?ChatOwnerLeft $chat_owner_left = null;

/** <em>Optional</em>. Service message: chat owner has changed */
public ?ChatOwnerChanged $chat_owner_changed = null;

/** <em>Optional</em>. A chat title was changed to this value */
public ?string $new_chat_title = null;

Expand Down Expand Up @@ -390,6 +396,8 @@ class Message extends MaybeInaccessibleMessage
* @param Location $location <em>Optional</em>. Message is a shared location, information about the location
* @param User[] $new_chat_members <em>Optional</em>. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
* @param User $left_chat_member <em>Optional</em>. A member was removed from the group, information about them (this member may be the bot itself)
* @param ChatOwnerLeft $chat_owner_left <em>Optional</em>. Service message: chat owner has left
* @param ChatOwnerChanged $chat_owner_changed <em>Optional</em>. Service message: chat owner has changed
* @param string $new_chat_title <em>Optional</em>. A chat title was changed to this value
* @param PhotoSize[] $new_chat_photo <em>Optional</em>. A chat photo was change to this value
* @param bool $delete_chat_photo <em>Optional</em>. Service message: the chat photo was deleted
Expand Down Expand Up @@ -495,6 +503,8 @@ public static function make(
?Location $location = null,
?array $new_chat_members = null,
?User $left_chat_member = null,
?ChatOwnerLeft $chat_owner_left = null,
?ChatOwnerChanged $chat_owner_changed = null,
?string $new_chat_title = null,
?array $new_chat_photo = null,
?bool $delete_chat_photo = null,
Expand Down Expand Up @@ -600,6 +610,8 @@ public static function make(
'location' => $location,
'new_chat_members' => $new_chat_members,
'left_chat_member' => $left_chat_member,
'chat_owner_left' => $chat_owner_left,
'chat_owner_changed' => $chat_owner_changed,
'new_chat_title' => $new_chat_title,
'new_chat_photo' => $new_chat_photo,
'delete_chat_photo' => $delete_chat_photo,
Expand Down
6 changes: 6 additions & 0 deletions src/Telegram/UniqueGift.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class UniqueGift extends Type
/** <em>Optional</em>. <em>True</em>, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers */
public ?bool $is_premium = null;

/** <em>Optional</em>. <em>True</em>, if the gift was used to craft another gift and isn't available anymore */
public ?bool $is_burned = null;

/** <em>Optional</em>. <em>True</em>, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram */
public ?bool $is_from_blockchain = null;

Expand All @@ -55,6 +58,7 @@ class UniqueGift extends Type
* @param UniqueGiftSymbol $symbol Symbol of the gift
* @param UniqueGiftBackdrop $backdrop Backdrop of the gift
* @param bool $is_premium <em>Optional</em>. <em>True</em>, if the original regular gift was exclusively purchaseable by Telegram Premium subscribers
* @param bool $is_burned <em>Optional</em>. <em>True</em>, if the gift was used to craft another gift and isn't available anymore
* @param bool $is_from_blockchain <em>Optional</em>. <em>True</em>, if the gift is assigned from the TON blockchain and can't be resold or transferred in Telegram
* @param UniqueGiftColors $colors <em>Optional</em>. The color scheme that can be used by the gift's owner for the chat's name, replies to messages and link previews; for business account gifts and gifts that are currently on sale only
* @param Chat $publisher_chat <em>Optional</em>. Information about the chat that published the gift
Expand All @@ -68,6 +72,7 @@ public static function make(
UniqueGiftSymbol $symbol,
UniqueGiftBackdrop $backdrop,
?bool $is_premium = null,
?bool $is_burned = null,
?bool $is_from_blockchain = null,
?UniqueGiftColors $colors = null,
?Chat $publisher_chat = null,
Expand All @@ -81,6 +86,7 @@ public static function make(
'symbol' => $symbol,
'backdrop' => $backdrop,
'is_premium' => $is_premium,
'is_burned' => $is_burned,
'is_from_blockchain' => $is_from_blockchain,
'colors' => $colors,
'publisher_chat' => $publisher_chat,
Expand Down
Loading