Skip to content

Commit c05487c

Browse files
committed
Update code to reflect latest changes to the Bot API documentation
1 parent 4fada31 commit c05487c

73 files changed

Lines changed: 2860 additions & 184 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Layers/Generated.php

Lines changed: 565 additions & 90 deletions
Large diffs are not rendered by default.

src/Telegram/AcceptedGiftTypes.php

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/**
4+
* This file is auto-generated.
5+
*/
6+
7+
namespace Telepath\Telegram;
8+
9+
use Telepath\Types\Type;
10+
11+
/**
12+
* This object describes the types of gifts that can be gifted to a user or a chat.
13+
*/
14+
class AcceptedGiftTypes extends Type
15+
{
16+
/** <em>True</em>, if unlimited regular gifts are accepted */
17+
public bool $unlimited_gifts;
18+
19+
/** <em>True</em>, if limited regular gifts are accepted */
20+
public bool $limited_gifts;
21+
22+
/** <em>True</em>, if unique gifts or gifts that can be upgraded to unique for free are accepted */
23+
public bool $unique_gifts;
24+
25+
/** <em>True</em>, if a Telegram Premium subscription is accepted */
26+
public bool $premium_subscription;
27+
28+
/**
29+
* @param bool $unlimited_gifts <em>True</em>, if unlimited regular gifts are accepted
30+
* @param bool $limited_gifts <em>True</em>, if limited regular gifts are accepted
31+
* @param bool $unique_gifts <em>True</em>, if unique gifts or gifts that can be upgraded to unique for free are accepted
32+
* @param bool $premium_subscription <em>True</em>, if a Telegram Premium subscription is accepted
33+
*/
34+
public static function make(
35+
bool $unlimited_gifts,
36+
bool $limited_gifts,
37+
bool $unique_gifts,
38+
bool $premium_subscription,
39+
): static {
40+
return new static([
41+
'unlimited_gifts' => $unlimited_gifts,
42+
'limited_gifts' => $limited_gifts,
43+
'unique_gifts' => $unique_gifts,
44+
'premium_subscription' => $premium_subscription,
45+
]);
46+
}
47+
}

src/Telegram/BotCommandScopeChat.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ class BotCommandScopeChat extends BotCommandScope
1414
/** Scope type, must be <em>chat</em> */
1515
public string $type = 'chat';
1616

17-
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
17+
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported. */
1818
public int|string $chat_id;
1919

2020
/**
21-
* @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
21+
* @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported.
2222
*/
2323
public static function make(int|string $chat_id): static
2424
{

src/Telegram/BotCommandScopeChatAdministrators.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ class BotCommandScopeChatAdministrators extends BotCommandScope
1414
/** Scope type, must be <em>chat_administrators</em> */
1515
public string $type = 'chat_administrators';
1616

17-
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
17+
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported. */
1818
public int|string $chat_id;
1919

2020
/**
21-
* @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
21+
* @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported.
2222
*/
2323
public static function make(int|string $chat_id): static
2424
{

src/Telegram/BotCommandScopeChatMember.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class BotCommandScopeChatMember extends BotCommandScope
1414
/** Scope type, must be <em>chat_member</em> */
1515
public string $type = 'chat_member';
1616

17-
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */
17+
/** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported. */
1818
public int|string $chat_id;
1919

2020
/** Unique identifier of the target user */
2121
public int $user_id;
2222

2323
/**
24-
* @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
24+
* @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername). Channel direct messages chats and channel chats aren't supported.
2525
* @param int $user_id Unique identifier of the target user
2626
*/
2727
public static function make(int|string $chat_id, int $user_id): static

src/Telegram/BusinessBotRights.php

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?php
2+
3+
/**
4+
* This file is auto-generated.
5+
*/
6+
7+
namespace Telepath\Telegram;
8+
9+
use Telepath\Types\Type;
10+
11+
/**
12+
* Represents the rights of a business bot.
13+
*/
14+
class BusinessBotRights extends Type
15+
{
16+
/** <em>Optional</em>. <em>True</em>, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours */
17+
public ?bool $can_reply = null;
18+
19+
/** <em>Optional</em>. <em>True</em>, if the bot can mark incoming private messages as read */
20+
public ?bool $can_read_messages = null;
21+
22+
/** <em>Optional</em>. <em>True</em>, if the bot can delete messages sent by the bot */
23+
public ?bool $can_delete_sent_messages = null;
24+
25+
/** <em>Optional</em>. <em>True</em>, if the bot can delete all private messages in managed chats */
26+
public ?bool $can_delete_all_messages = null;
27+
28+
/** <em>Optional</em>. <em>True</em>, if the bot can edit the first and last name of the business account */
29+
public ?bool $can_edit_name = null;
30+
31+
/** <em>Optional</em>. <em>True</em>, if the bot can edit the bio of the business account */
32+
public ?bool $can_edit_bio = null;
33+
34+
/** <em>Optional</em>. <em>True</em>, if the bot can edit the profile photo of the business account */
35+
public ?bool $can_edit_profile_photo = null;
36+
37+
/** <em>Optional</em>. <em>True</em>, if the bot can edit the username of the business account */
38+
public ?bool $can_edit_username = null;
39+
40+
/** <em>Optional</em>. <em>True</em>, if the bot can change the privacy settings pertaining to gifts for the business account */
41+
public ?bool $can_change_gift_settings = null;
42+
43+
/** <em>Optional</em>. <em>True</em>, if the bot can view gifts and the amount of Telegram Stars owned by the business account */
44+
public ?bool $can_view_gifts_and_stars = null;
45+
46+
/** <em>Optional</em>. <em>True</em>, if the bot can convert regular gifts owned by the business account to Telegram Stars */
47+
public ?bool $can_convert_gifts_to_stars = null;
48+
49+
/** <em>Optional</em>. <em>True</em>, if the bot can transfer and upgrade gifts owned by the business account */
50+
public ?bool $can_transfer_and_upgrade_gifts = null;
51+
52+
/** <em>Optional</em>. <em>True</em>, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts */
53+
public ?bool $can_transfer_stars = null;
54+
55+
/** <em>Optional</em>. <em>True</em>, if the bot can post, edit and delete stories on behalf of the business account */
56+
public ?bool $can_manage_stories = null;
57+
58+
/**
59+
* @param bool $can_reply <em>Optional</em>. <em>True</em>, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours
60+
* @param bool $can_read_messages <em>Optional</em>. <em>True</em>, if the bot can mark incoming private messages as read
61+
* @param bool $can_delete_sent_messages <em>Optional</em>. <em>True</em>, if the bot can delete messages sent by the bot
62+
* @param bool $can_delete_all_messages <em>Optional</em>. <em>True</em>, if the bot can delete all private messages in managed chats
63+
* @param bool $can_edit_name <em>Optional</em>. <em>True</em>, if the bot can edit the first and last name of the business account
64+
* @param bool $can_edit_bio <em>Optional</em>. <em>True</em>, if the bot can edit the bio of the business account
65+
* @param bool $can_edit_profile_photo <em>Optional</em>. <em>True</em>, if the bot can edit the profile photo of the business account
66+
* @param bool $can_edit_username <em>Optional</em>. <em>True</em>, if the bot can edit the username of the business account
67+
* @param bool $can_change_gift_settings <em>Optional</em>. <em>True</em>, if the bot can change the privacy settings pertaining to gifts for the business account
68+
* @param bool $can_view_gifts_and_stars <em>Optional</em>. <em>True</em>, if the bot can view gifts and the amount of Telegram Stars owned by the business account
69+
* @param bool $can_convert_gifts_to_stars <em>Optional</em>. <em>True</em>, if the bot can convert regular gifts owned by the business account to Telegram Stars
70+
* @param bool $can_transfer_and_upgrade_gifts <em>Optional</em>. <em>True</em>, if the bot can transfer and upgrade gifts owned by the business account
71+
* @param bool $can_transfer_stars <em>Optional</em>. <em>True</em>, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts
72+
* @param bool $can_manage_stories <em>Optional</em>. <em>True</em>, if the bot can post, edit and delete stories on behalf of the business account
73+
*/
74+
public static function make(
75+
?bool $can_reply = null,
76+
?bool $can_read_messages = null,
77+
?bool $can_delete_sent_messages = null,
78+
?bool $can_delete_all_messages = null,
79+
?bool $can_edit_name = null,
80+
?bool $can_edit_bio = null,
81+
?bool $can_edit_profile_photo = null,
82+
?bool $can_edit_username = null,
83+
?bool $can_change_gift_settings = null,
84+
?bool $can_view_gifts_and_stars = null,
85+
?bool $can_convert_gifts_to_stars = null,
86+
?bool $can_transfer_and_upgrade_gifts = null,
87+
?bool $can_transfer_stars = null,
88+
?bool $can_manage_stories = null,
89+
): static {
90+
return new static([
91+
'can_reply' => $can_reply,
92+
'can_read_messages' => $can_read_messages,
93+
'can_delete_sent_messages' => $can_delete_sent_messages,
94+
'can_delete_all_messages' => $can_delete_all_messages,
95+
'can_edit_name' => $can_edit_name,
96+
'can_edit_bio' => $can_edit_bio,
97+
'can_edit_profile_photo' => $can_edit_profile_photo,
98+
'can_edit_username' => $can_edit_username,
99+
'can_change_gift_settings' => $can_change_gift_settings,
100+
'can_view_gifts_and_stars' => $can_view_gifts_and_stars,
101+
'can_convert_gifts_to_stars' => $can_convert_gifts_to_stars,
102+
'can_transfer_and_upgrade_gifts' => $can_transfer_and_upgrade_gifts,
103+
'can_transfer_stars' => $can_transfer_stars,
104+
'can_manage_stories' => $can_manage_stories,
105+
]);
106+
}
107+
}

src/Telegram/BusinessConnection.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,35 @@ class BusinessConnection extends Type
2525
/** Date the connection was established in Unix time */
2626
public int $date;
2727

28-
/** True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours */
29-
public bool $can_reply;
30-
31-
/** True, if the connection is active */
28+
/** <em>True</em>, if the connection is active */
3229
public bool $is_enabled;
3330

31+
/** <em>Optional</em>. Rights of the business bot */
32+
public ?BusinessBotRights $rights = null;
33+
3434
/**
3535
* @param string $id Unique identifier of the business connection
3636
* @param User $user Business account user that created the business connection
3737
* @param int $user_chat_id Identifier of a private chat with the user who created the business connection. 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.
3838
* @param int $date Date the connection was established in Unix time
39-
* @param bool $can_reply True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours
40-
* @param bool $is_enabled True, if the connection is active
39+
* @param bool $is_enabled <em>True</em>, if the connection is active
40+
* @param BusinessBotRights $rights <em>Optional</em>. Rights of the business bot
4141
*/
4242
public static function make(
4343
string $id,
4444
User $user,
4545
int $user_chat_id,
4646
int $date,
47-
bool $can_reply,
4847
bool $is_enabled,
48+
?BusinessBotRights $rights = null,
4949
): static {
5050
return new static([
5151
'id' => $id,
5252
'user' => $user,
5353
'user_chat_id' => $user_chat_id,
5454
'date' => $date,
55-
'can_reply' => $can_reply,
5655
'is_enabled' => $is_enabled,
56+
'rights' => $rights,
5757
]);
5858
}
5959
}

src/Telegram/Chat.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class Chat extends Type
3434
/** <em>Optional</em>. <em>True</em>, if the supergroup chat is a forum (has <a href="https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups">topics</a> enabled) */
3535
public ?bool $is_forum = null;
3636

37+
/** <em>Optional</em>. <em>True</em>, if the chat is the direct messages chat of a channel */
38+
public ?bool $is_direct_messages = null;
39+
3740
/**
3841
* @param int $id Unique identifier for this chat. 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 signed 64-bit integer or double-precision float type are safe for storing this identifier.
3942
* @param string $type Type of the chat, can be either “private”, “group”, “supergroup” or “channel”
@@ -42,6 +45,7 @@ class Chat extends Type
4245
* @param string $first_name <em>Optional</em>. First name of the other party in a private chat
4346
* @param string $last_name <em>Optional</em>. Last name of the other party in a private chat
4447
* @param bool $is_forum <em>Optional</em>. <em>True</em>, if the supergroup chat is a forum (has <a href="https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups">topics</a> enabled)
48+
* @param bool $is_direct_messages <em>Optional</em>. <em>True</em>, if the chat is the direct messages chat of a channel
4549
*/
4650
public static function make(
4751
int $id,
@@ -51,6 +55,7 @@ public static function make(
5155
?string $first_name = null,
5256
?string $last_name = null,
5357
?bool $is_forum = null,
58+
?bool $is_direct_messages = null,
5459
): static {
5560
return new static([
5661
'id' => $id,
@@ -60,6 +65,7 @@ public static function make(
6065
'first_name' => $first_name,
6166
'last_name' => $last_name,
6267
'is_forum' => $is_forum,
68+
'is_direct_messages' => $is_direct_messages,
6369
]);
6470
}
6571
}

0 commit comments

Comments
 (0)