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
51 changes: 47 additions & 4 deletions 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 @@ -953,7 +954,7 @@ public function sendPoll(
* @param bool $protect_content Protects the contents of the sent message from forwarding and saving
* @param string $message_effect_id Unique identifier of the message effect to be added to the message
* @param ReplyParameters $reply_parameters A JSON-serialized object for description of the message to reply to
* @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for an inline keyboard
* @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for an <a href="https://core.telegram.org/bots/features#inline-keyboards">inline keyboard</a>
*
* @throws TelegramException
*/
Expand Down Expand Up @@ -1006,7 +1007,7 @@ public function sendDice(
}

/**
* Use this method to stream a partial message to a user while the message is being generated; supported only for bots with forum topic mode enabled. Returns <em>True</em> on success.
* Use this method to stream a partial message to a user while the message is being generated. Returns <em>True</em> on success.
*
* @param int $chat_id Unique identifier for the target private chat
* @param int $draft_id Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated
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 @@ -1184,6 +1199,7 @@ public function restrictChatMember(
* @param bool $can_pin_messages Pass <em>True</em> if the administrator can pin messages; for supergroups only
* @param bool $can_manage_topics Pass <em>True</em> if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
* @param bool $can_manage_direct_messages Pass <em>True</em> if the administrator can manage direct messages within the channel and decline suggested posts; for channels only
* @param bool $can_manage_tags Pass <em>True</em> if the administrator can edit the tags of regular members; for groups and supergroups only
*
* @throws TelegramException
*/
Expand All @@ -1206,6 +1222,7 @@ public function promoteChatMember(
?bool $can_pin_messages = null,
?bool $can_manage_topics = null,
?bool $can_manage_direct_messages = null,
?bool $can_manage_tags = null,
): bool {
return $this->raw('promoteChatMember', func_get_args());
}
Expand All @@ -1224,6 +1241,20 @@ public function setChatAdministratorCustomTitle(int|string $chat_id, int $user_i
return $this->raw('setChatAdministratorCustomTitle', func_get_args());
}

/**
* Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the <em>can_manage_tags</em> administrator right. Returns <em>True</em> on success.
*
* @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
* @param int $user_id Unique identifier of the target user
* @param string $tag New tag for the member; 0-16 characters, emoji are not allowed
*
* @throws TelegramException
*/
public function setChatMemberTag(int|string $chat_id, int $user_id, ?string $tag = null): bool
{
return $this->raw('setChatMemberTag', func_get_args());
}

/**
* Use this method to ban a channel chat in a supergroup or a channel. Until the chat is <a href="https://core.telegram.org/bots/api#unbanchatsenderchat">unbanned</a>, the owner of the banned chat won't be able to send messages on behalf of any of their channels. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns <em>True</em> on success.
*
Expand Down Expand Up @@ -1597,7 +1628,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 +1955,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 Expand Up @@ -2594,7 +2637,7 @@ public function stopMessageLiveLocation(
* @param int $chat_id Unique identifier for the target chat
* @param int $message_id Unique identifier for the target message
* @param InputChecklist $checklist A JSON-serialized object for the new checklist
* @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for the new inline keyboard for the message
* @param InlineKeyboardMarkup $reply_markup A JSON-serialized object for the new <a href="https://core.telegram.org/bots/features#inline-keyboards">inline keyboard</a> for the message
*
* @throws TelegramException
*/
Expand Down
6 changes: 6 additions & 0 deletions src/Telegram/ChatAdministratorRights.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class ChatAdministratorRights extends Type
/** <em>Optional</em>. <em>True</em>, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */
public ?bool $can_manage_direct_messages = null;

/** <em>Optional</em>. <em>True</em>, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. */
public ?bool $can_manage_tags = null;

/**
* @param bool $is_anonymous <em>True</em>, if the user's presence in the chat is hidden
* @param bool $can_manage_chat <em>True</em>, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege.
Expand All @@ -78,6 +81,7 @@ class ChatAdministratorRights extends Type
* @param bool $can_pin_messages <em>Optional</em>. <em>True</em>, if the user is allowed to pin messages; for groups and supergroups only
* @param bool $can_manage_topics <em>Optional</em>. <em>True</em>, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
* @param bool $can_manage_direct_messages <em>Optional</em>. <em>True</em>, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only
* @param bool $can_manage_tags <em>Optional</em>. <em>True</em>, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages.
*/
public static function make(
bool $is_anonymous,
Expand All @@ -96,6 +100,7 @@ public static function make(
?bool $can_pin_messages = null,
?bool $can_manage_topics = null,
?bool $can_manage_direct_messages = null,
?bool $can_manage_tags = null,
): static {
return new static([
'is_anonymous' => $is_anonymous,
Expand All @@ -114,6 +119,7 @@ public static function make(
'can_pin_messages' => $can_pin_messages,
'can_manage_topics' => $can_manage_topics,
'can_manage_direct_messages' => $can_manage_direct_messages,
'can_manage_tags' => $can_manage_tags,
]);
}
}
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
6 changes: 6 additions & 0 deletions src/Telegram/ChatMemberAdministrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class ChatMemberAdministrator extends ChatMember
/** <em>Optional</em>. <em>True</em>, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only */
public ?bool $can_manage_direct_messages = null;

/** <em>Optional</em>. <em>True</em>, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages. */
public ?bool $can_manage_tags = null;

/** <em>Optional</em>. Custom title for this user */
public ?string $custom_title = null;

Expand All @@ -87,6 +90,7 @@ class ChatMemberAdministrator extends ChatMember
* @param bool $can_pin_messages <em>Optional</em>. <em>True</em>, if the user is allowed to pin messages; for groups and supergroups only
* @param bool $can_manage_topics <em>Optional</em>. <em>True</em>, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
* @param bool $can_manage_direct_messages <em>Optional</em>. <em>True</em>, if the administrator can manage direct messages of the channel and decline suggested posts; for channels only
* @param bool $can_manage_tags <em>Optional</em>. <em>True</em>, if the administrator can edit the tags of regular members; for groups and supergroups only. If omitted defaults to the value of can_pin_messages.
* @param string $custom_title <em>Optional</em>. Custom title for this user
*/
public static function make(
Expand All @@ -108,6 +112,7 @@ public static function make(
?bool $can_pin_messages = null,
?bool $can_manage_topics = null,
?bool $can_manage_direct_messages = null,
?bool $can_manage_tags = null,
?string $custom_title = null,
): static {
return new static([
Expand All @@ -129,6 +134,7 @@ public static function make(
'can_pin_messages' => $can_pin_messages,
'can_manage_topics' => $can_manage_topics,
'can_manage_direct_messages' => $can_manage_direct_messages,
'can_manage_tags' => $can_manage_tags,
'custom_title' => $custom_title,
]);
}
Expand Down
7 changes: 6 additions & 1 deletion src/Telegram/ChatMemberMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,22 @@ class ChatMemberMember extends ChatMember
/** The member's status in the chat, always “member” */
public string $status = 'member';

/** <em>Optional</em>. Tag of the member */
public ?string $tag = null;

/** <em>Optional</em>. Date when the user's subscription will expire; Unix time */
public ?int $until_date = null;

/**
* @param User $user Information about the user
* @param string $tag <em>Optional</em>. Tag of the member
* @param int $until_date <em>Optional</em>. Date when the user's subscription will expire; Unix time
*/
public static function make(User $user, ?int $until_date = null): static
public static function make(User $user, ?string $tag = null, ?int $until_date = null): static
{
return new static([
'user' => $user,
'tag' => $tag,
'until_date' => $until_date,
]);
}
Expand Down
12 changes: 12 additions & 0 deletions src/Telegram/ChatMemberRestricted.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class ChatMemberRestricted extends ChatMember
/** <em>True</em>, if the user is allowed to add web page previews to their messages */
public bool $can_add_web_page_previews;

/** <em>True</em>, if the user is allowed to edit their own tag */
public bool $can_edit_tag;

/** <em>True</em>, if the user is allowed to change the chat title, photo and other settings */
public bool $can_change_info;

Expand All @@ -62,6 +65,9 @@ class ChatMemberRestricted extends ChatMember
/** Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever */
public int $until_date;

/** <em>Optional</em>. Tag of the member */
public ?string $tag = null;

/**
* @param User $user Information about the user
* @param bool $is_member <em>True</em>, if the user is a member of the chat at the moment of the request
Expand All @@ -75,11 +81,13 @@ class ChatMemberRestricted extends ChatMember
* @param bool $can_send_polls <em>True</em>, if the user is allowed to send polls and checklists
* @param bool $can_send_other_messages <em>True</em>, if the user is allowed to send animations, games, stickers and use inline bots
* @param bool $can_add_web_page_previews <em>True</em>, if the user is allowed to add web page previews to their messages
* @param bool $can_edit_tag <em>True</em>, if the user is allowed to edit their own tag
* @param bool $can_change_info <em>True</em>, if the user is allowed to change the chat title, photo and other settings
* @param bool $can_invite_users <em>True</em>, if the user is allowed to invite new users to the chat
* @param bool $can_pin_messages <em>True</em>, if the user is allowed to pin messages
* @param bool $can_manage_topics <em>True</em>, if the user is allowed to create forum topics
* @param int $until_date Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever
* @param string $tag <em>Optional</em>. Tag of the member
*/
public static function make(
User $user,
Expand All @@ -94,11 +102,13 @@ public static function make(
bool $can_send_polls,
bool $can_send_other_messages,
bool $can_add_web_page_previews,
bool $can_edit_tag,
bool $can_change_info,
bool $can_invite_users,
bool $can_pin_messages,
bool $can_manage_topics,
int $until_date,
?string $tag = null,
): static {
return new static([
'user' => $user,
Expand All @@ -113,11 +123,13 @@ public static function make(
'can_send_polls' => $can_send_polls,
'can_send_other_messages' => $can_send_other_messages,
'can_add_web_page_previews' => $can_add_web_page_previews,
'can_edit_tag' => $can_edit_tag,
'can_change_info' => $can_change_info,
'can_invite_users' => $can_invite_users,
'can_pin_messages' => $can_pin_messages,
'can_manage_topics' => $can_manage_topics,
'until_date' => $until_date,
'tag' => $tag,
]);
}
}
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,
]);
}
}
Loading