diff --git a/src/Telegram/Animation.php b/src/Telegram/Animation.php index 71cf15d..8c40d59 100644 --- a/src/Telegram/Animation.php +++ b/src/Telegram/Animation.php @@ -11,66 +11,65 @@ */ class Animation extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; - /** Video width as defined by sender */ - public int $width; + /** Video width as defined by sender */ + public int $width; - /** Video height as defined by sender */ - public int $height; + /** Video height as defined by sender */ + public int $height; - /** Duration of the video in seconds as defined by sender */ - public int $duration; + /** Duration of the video in seconds as defined by sender */ + public int $duration; - /** Optional. Animation thumbnail as defined by sender */ - public ?PhotoSize $thumb = null; + /** Optional. Animation thumbnail as defined by sender */ + public ?PhotoSize $thumb = null; - /** Optional. Original animation filename as defined by sender */ - public ?string $file_name = null; + /** Optional. Original animation filename as defined by sender */ + public ?string $file_name = null; - /** Optional. MIME type of the file as defined by sender */ - public ?string $mime_type = null; + /** Optional. MIME type of the file as defined by sender */ + public ?string $mime_type = null; - /** Optional. File size in bytes */ - public ?int $file_size = null; + /** Optional. File size in bytes */ + public ?int $file_size = null; - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param int $width Video width as defined by sender - * @param int $height Video height as defined by sender - * @param int $duration Duration of the video in seconds as defined by sender - * @param PhotoSize $thumb Optional. Animation thumbnail as defined by sender - * @param string $file_name Optional. Original animation filename as defined by sender - * @param string $mime_type Optional. MIME type of the file as defined by sender - * @param int $file_size Optional. File size in bytes - */ - public static function make( - string $file_id, - string $file_unique_id, - int $width, - int $height, - int $duration, - ?PhotoSize $thumb = null, - ?string $file_name = null, - ?string $mime_type = null, - ?int $file_size = null - ): static { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'width' => $width, - 'height' => $height, - 'duration' => $duration, - 'thumb' => $thumb, - 'file_name' => $file_name, - 'mime_type' => $mime_type, - 'file_size' => $file_size, - ]); - } + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $width Video width as defined by sender + * @param int $height Video height as defined by sender + * @param int $duration Duration of the video in seconds as defined by sender + * @param PhotoSize $thumb Optional. Animation thumbnail as defined by sender + * @param string $file_name Optional. Original animation filename as defined by sender + * @param string $mime_type Optional. MIME type of the file as defined by sender + * @param int $file_size Optional. File size in bytes + */ + public static function make( + string $file_id, + string $file_unique_id, + int $width, + int $height, + int $duration, + ?PhotoSize $thumb = null, + ?string $file_name = null, + ?string $mime_type = null, + ?int $file_size = null + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'width' => $width, + 'height' => $height, + 'duration' => $duration, + 'thumb' => $thumb, + 'file_name' => $file_name, + 'mime_type' => $mime_type, + 'file_size' => $file_size, + ]); + } } diff --git a/src/Telegram/Audio.php b/src/Telegram/Audio.php index 441c078..83aa5ea 100644 --- a/src/Telegram/Audio.php +++ b/src/Telegram/Audio.php @@ -11,66 +11,65 @@ */ class Audio extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; - /** Duration of the audio in seconds as defined by sender */ - public int $duration; + /** Duration of the audio in seconds as defined by sender */ + public int $duration; - /** Optional. Performer of the audio as defined by sender or by audio tags */ - public ?string $performer = null; + /** Optional. Performer of the audio as defined by sender or by audio tags */ + public ?string $performer = null; - /** Optional. Title of the audio as defined by sender or by audio tags */ - public ?string $title = null; + /** Optional. Title of the audio as defined by sender or by audio tags */ + public ?string $title = null; - /** Optional. Original filename as defined by sender */ - public ?string $file_name = null; + /** Optional. Original filename as defined by sender */ + public ?string $file_name = null; - /** Optional. MIME type of the file as defined by sender */ - public ?string $mime_type = null; + /** Optional. MIME type of the file as defined by sender */ + public ?string $mime_type = null; - /** Optional. File size in bytes */ - public ?int $file_size = null; + /** Optional. File size in bytes */ + public ?int $file_size = null; - /** Optional. Thumbnail of the album cover to which the music file belongs */ - public ?PhotoSize $thumb = null; + /** Optional. Thumbnail of the album cover to which the music file belongs */ + public ?PhotoSize $thumb = null; - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param int $duration Duration of the audio in seconds as defined by sender - * @param string $performer Optional. Performer of the audio as defined by sender or by audio tags - * @param string $title Optional. Title of the audio as defined by sender or by audio tags - * @param string $file_name Optional. Original filename as defined by sender - * @param string $mime_type Optional. MIME type of the file as defined by sender - * @param int $file_size Optional. File size in bytes - * @param PhotoSize $thumb Optional. Thumbnail of the album cover to which the music file belongs - */ - public static function make( - string $file_id, - string $file_unique_id, - int $duration, - ?string $performer = null, - ?string $title = null, - ?string $file_name = null, - ?string $mime_type = null, - ?int $file_size = null, - ?PhotoSize $thumb = null - ): static { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'duration' => $duration, - 'performer' => $performer, - 'title' => $title, - 'file_name' => $file_name, - 'mime_type' => $mime_type, - 'file_size' => $file_size, - 'thumb' => $thumb, - ]); - } + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $duration Duration of the audio in seconds as defined by sender + * @param string $performer Optional. Performer of the audio as defined by sender or by audio tags + * @param string $title Optional. Title of the audio as defined by sender or by audio tags + * @param string $file_name Optional. Original filename as defined by sender + * @param string $mime_type Optional. MIME type of the file as defined by sender + * @param int $file_size Optional. File size in bytes + * @param PhotoSize $thumb Optional. Thumbnail of the album cover to which the music file belongs + */ + public static function make( + string $file_id, + string $file_unique_id, + int $duration, + ?string $performer = null, + ?string $title = null, + ?string $file_name = null, + ?string $mime_type = null, + ?int $file_size = null, + ?PhotoSize $thumb = null + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'duration' => $duration, + 'performer' => $performer, + 'title' => $title, + 'file_name' => $file_name, + 'mime_type' => $mime_type, + 'file_size' => $file_size, + 'thumb' => $thumb, + ]); + } } diff --git a/src/Telegram/BotCommand.php b/src/Telegram/BotCommand.php index 78a0ac1..b3e7c3b 100644 --- a/src/Telegram/BotCommand.php +++ b/src/Telegram/BotCommand.php @@ -11,22 +11,21 @@ */ class BotCommand extends \Tii\Telepath\Type { - /** Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. */ - public string $command; + /** Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. */ + public string $command; - /** Description of the command; 1-256 characters. */ - public string $description; + /** Description of the command; 1-256 characters. */ + public string $description; - - /** - * @param string $command Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. - * @param string $description Description of the command; 1-256 characters. - */ - public static function make(string $command, string $description): static - { - return new static([ - 'command' => $command, - 'description' => $description, - ]); - } + /** + * @param string $command Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores. + * @param string $description Description of the command; 1-256 characters. + */ + public static function make(string $command, string $description): static + { + return new static([ + 'command' => $command, + 'description' => $description, + ]); + } } diff --git a/src/Telegram/BotCommandScope.php b/src/Telegram/BotCommandScope.php index 0013add..08ce209 100644 --- a/src/Telegram/BotCommandScope.php +++ b/src/Telegram/BotCommandScope.php @@ -11,20 +11,19 @@ */ abstract class BotCommandScope extends \Tii\Telepath\Type { - /** Scope type */ - public string $type; + /** Scope type */ + public string $type; - - public static function factory(array $data): static - { - return match($data['type']) { - 'default' => new BotCommandScopeDefault($data) - 'all_private_chats' => new BotCommandScopeAllPrivateChats($data) - 'all_group_chats' => new BotCommandScopeAllGroupChats($data) - 'all_chat_administrators' => new BotCommandScopeAllChatAdministrators($data) - 'chat' => new BotCommandScopeChat($data) - 'chat_administrators' => new BotCommandScopeChatAdministrators($data) - 'chat_member' => new BotCommandScopeChatMember($data) - }; - } + public static function factory(array $data): static + { + return match($data['type']) { + 'default' => new BotCommandScopeDefault($data) + 'all_private_chats' => new BotCommandScopeAllPrivateChats($data) + 'all_group_chats' => new BotCommandScopeAllGroupChats($data) + 'all_chat_administrators' => new BotCommandScopeAllChatAdministrators($data) + 'chat' => new BotCommandScopeChat($data) + 'chat_administrators' => new BotCommandScopeChatAdministrators($data) + 'chat_member' => new BotCommandScopeChatMember($data) + }; + } } diff --git a/src/Telegram/BotCommandScopeAllChatAdministrators.php b/src/Telegram/BotCommandScopeAllChatAdministrators.php index 3ab9bcb..abaaa24 100644 --- a/src/Telegram/BotCommandScopeAllChatAdministrators.php +++ b/src/Telegram/BotCommandScopeAllChatAdministrators.php @@ -11,13 +11,12 @@ */ class BotCommandScopeAllChatAdministrators extends BotCommandScope { - /** Scope type, must be all_chat_administrators */ - public string $type = 'all_chat_administrators'; + /** Scope type, must be all_chat_administrators */ + public string $type = 'all_chat_administrators'; - - public static function make(): static - { - return new static([ - ]); - } + public static function make(): static + { + return new static([ + ]); + } } diff --git a/src/Telegram/BotCommandScopeAllGroupChats.php b/src/Telegram/BotCommandScopeAllGroupChats.php index 7c535f6..afa65dc 100644 --- a/src/Telegram/BotCommandScopeAllGroupChats.php +++ b/src/Telegram/BotCommandScopeAllGroupChats.php @@ -11,13 +11,12 @@ */ class BotCommandScopeAllGroupChats extends BotCommandScope { - /** Scope type, must be all_group_chats */ - public string $type = 'all_group_chats'; + /** Scope type, must be all_group_chats */ + public string $type = 'all_group_chats'; - - public static function make(): static - { - return new static([ - ]); - } + public static function make(): static + { + return new static([ + ]); + } } diff --git a/src/Telegram/BotCommandScopeAllPrivateChats.php b/src/Telegram/BotCommandScopeAllPrivateChats.php index 5cb3d8f..035475f 100644 --- a/src/Telegram/BotCommandScopeAllPrivateChats.php +++ b/src/Telegram/BotCommandScopeAllPrivateChats.php @@ -11,13 +11,12 @@ */ class BotCommandScopeAllPrivateChats extends BotCommandScope { - /** Scope type, must be all_private_chats */ - public string $type = 'all_private_chats'; + /** Scope type, must be all_private_chats */ + public string $type = 'all_private_chats'; - - public static function make(): static - { - return new static([ - ]); - } + public static function make(): static + { + return new static([ + ]); + } } diff --git a/src/Telegram/BotCommandScopeChat.php b/src/Telegram/BotCommandScopeChat.php index 6bdc485..4946727 100644 --- a/src/Telegram/BotCommandScopeChat.php +++ b/src/Telegram/BotCommandScopeChat.php @@ -11,20 +11,19 @@ */ class BotCommandScopeChat extends BotCommandScope { - /** Scope type, must be chat */ - public string $type = 'chat'; + /** Scope type, must be chat */ + public string $type = 'chat'; - /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ - public int|string $chat_id; + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + public int|string $chat_id; - - /** - * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - */ - public static function make(int|string $chat_id): static - { - return new static([ - 'chat_id' => $chat_id, - ]); - } + /** + * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + */ + public static function make(int|string $chat_id): static + { + return new static([ + 'chat_id' => $chat_id, + ]); + } } diff --git a/src/Telegram/BotCommandScopeChatAdministrators.php b/src/Telegram/BotCommandScopeChatAdministrators.php index 7aa2f69..28d44bc 100644 --- a/src/Telegram/BotCommandScopeChatAdministrators.php +++ b/src/Telegram/BotCommandScopeChatAdministrators.php @@ -11,20 +11,19 @@ */ class BotCommandScopeChatAdministrators extends BotCommandScope { - /** Scope type, must be chat_administrators */ - public string $type = 'chat_administrators'; + /** Scope type, must be chat_administrators */ + public string $type = 'chat_administrators'; - /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ - public int|string $chat_id; + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + public int|string $chat_id; - - /** - * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) - */ - public static function make(int|string $chat_id): static - { - return new static([ - 'chat_id' => $chat_id, - ]); - } + /** + * @param int|string $chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + */ + public static function make(int|string $chat_id): static + { + return new static([ + 'chat_id' => $chat_id, + ]); + } } diff --git a/src/Telegram/BotCommandScopeChatMember.php b/src/Telegram/BotCommandScopeChatMember.php index 7837207..58653e0 100644 --- a/src/Telegram/BotCommandScopeChatMember.php +++ b/src/Telegram/BotCommandScopeChatMember.php @@ -11,25 +11,24 @@ */ class BotCommandScopeChatMember extends BotCommandScope { - /** Scope type, must be chat_member */ - public string $type = 'chat_member'; + /** Scope type, must be chat_member */ + public string $type = 'chat_member'; - /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ - public int|string $chat_id; + /** Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) */ + public int|string $chat_id; - /** Unique identifier of the target user */ - public int $user_id; + /** Unique identifier of the target user */ + public int $user_id; - - /** - * @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 - */ - public static function make(int|string $chat_id, int $user_id): static - { - return new static([ - 'chat_id' => $chat_id, - 'user_id' => $user_id, - ]); - } + /** + * @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 + */ + public static function make(int|string $chat_id, int $user_id): static + { + return new static([ + 'chat_id' => $chat_id, + 'user_id' => $user_id, + ]); + } } diff --git a/src/Telegram/BotCommandScopeDefault.php b/src/Telegram/BotCommandScopeDefault.php index e5544ce..be3ded5 100644 --- a/src/Telegram/BotCommandScopeDefault.php +++ b/src/Telegram/BotCommandScopeDefault.php @@ -11,13 +11,12 @@ */ class BotCommandScopeDefault extends BotCommandScope { - /** Scope type, must be default */ - public string $type = 'default'; + /** Scope type, must be default */ + public string $type = 'default'; - - public static function make(): static - { - return new static([ - ]); - } + public static function make(): static + { + return new static([ + ]); + } } diff --git a/src/Telegram/CallbackQuery.php b/src/Telegram/CallbackQuery.php index 4c68a55..7946a6d 100644 --- a/src/Telegram/CallbackQuery.php +++ b/src/Telegram/CallbackQuery.php @@ -11,54 +11,53 @@ */ class CallbackQuery extends \Tii\Telepath\Type { - /** Unique identifier for this query */ - public string $id; - - /** Sender */ - public User $from; - - /** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */ - public string $chat_instance; - - /** Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old */ - public ?Message $message = null; - - /** Optional. Identifier of the message sent via the bot in inline mode, that originated the query. */ - public ?string $inline_message_id = null; - - /** Optional. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field. */ - public ?string $data = null; - - /** Optional. Short name of a Game to be returned, serves as the unique identifier for the game */ - public ?string $game_short_name = null; - - - /** - * @param string $id Unique identifier for this query - * @param User $from Sender - * @param string $chat_instance Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. - * @param Message $message Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old - * @param string $inline_message_id Optional. Identifier of the message sent via the bot in inline mode, that originated the query. - * @param string $data Optional. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field. - * @param string $game_short_name Optional. Short name of a Game to be returned, serves as the unique identifier for the game - */ - public static function make( - string $id, - User $from, - string $chat_instance, - ?Message $message = null, - ?string $inline_message_id = null, - ?string $data = null, - ?string $game_short_name = null - ): static { - return new static([ - 'id' => $id, - 'from' => $from, - 'chat_instance' => $chat_instance, - 'message' => $message, - 'inline_message_id' => $inline_message_id, - 'data' => $data, - 'game_short_name' => $game_short_name, - ]); - } + /** Unique identifier for this query */ + public string $id; + + /** Sender */ + public User $from; + + /** Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. */ + public string $chat_instance; + + /** Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old */ + public ?Message $message = null; + + /** Optional. Identifier of the message sent via the bot in inline mode, that originated the query. */ + public ?string $inline_message_id = null; + + /** Optional. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field. */ + public ?string $data = null; + + /** Optional. Short name of a Game to be returned, serves as the unique identifier for the game */ + public ?string $game_short_name = null; + + /** + * @param string $id Unique identifier for this query + * @param User $from Sender + * @param string $chat_instance Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. + * @param Message $message Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old + * @param string $inline_message_id Optional. Identifier of the message sent via the bot in inline mode, that originated the query. + * @param string $data Optional. Data associated with the callback button. Be aware that a bad client can send arbitrary data in this field. + * @param string $game_short_name Optional. Short name of a Game to be returned, serves as the unique identifier for the game + */ + public static function make( + string $id, + User $from, + string $chat_instance, + ?Message $message = null, + ?string $inline_message_id = null, + ?string $data = null, + ?string $game_short_name = null + ): static { + return new static([ + 'id' => $id, + 'from' => $from, + 'chat_instance' => $chat_instance, + 'message' => $message, + 'inline_message_id' => $inline_message_id, + 'data' => $data, + 'game_short_name' => $game_short_name, + ]); + } } diff --git a/src/Telegram/Chat.php b/src/Telegram/Chat.php index bdb884e..6c9555c 100644 --- a/src/Telegram/Chat.php +++ b/src/Telegram/Chat.php @@ -11,132 +11,131 @@ */ class Chat extends \Tii\Telepath\Type { - /** 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. */ - public int $id; - - /** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */ - public string $type; - - /** Optional. Title, for supergroups, channels and group chats */ - public ?string $title = null; - - /** Optional. Username, for private chats, supergroups and channels if available */ - public ?string $username = null; - - /** Optional. First name of the other party in a private chat */ - public ?string $first_name = null; - - /** Optional. Last name of the other party in a private chat */ - public ?string $last_name = null; - - /** Optional. Chat photo. Returned only in getChat. */ - public ?ChatPhoto $photo = null; - - /** Optional. Bio of the other party in a private chat. Returned only in getChat. */ - public ?string $bio = null; - - /** Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id= links only in chats with the user. Returned only in getChat. */ - public ?bool $has_private_forwards = null; - - /** Optional. Description, for groups, supergroups and channel chats. Returned only in getChat. */ - public ?string $description = null; - - /** Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. */ - public ?string $invite_link = null; - - /** Optional. The most recent pinned message (by sending date). Returned only in getChat. */ - public ?Message $pinned_message = null; - - /** Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. */ - public ?ChatPermissions $permissions = null; - - /** Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */ - public ?int $slow_mode_delay = null; - - /** Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. */ - public ?int $message_auto_delete_time = null; - - /** Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. */ - public ?bool $has_protected_content = null; - - /** Optional. For supergroups, name of group sticker set. Returned only in getChat. */ - public ?string $sticker_set_name = null; - - /** Optional. True, if the bot can change the group sticker set. Returned only in getChat. */ - public ?bool $can_set_sticker_set = null; - - /** Optional. 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. Returned only in getChat. */ - public ?int $linked_chat_id = null; - - /** Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat. */ - public ?ChatLocation $location = null; - - - /** - * @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. - * @param string $type Type of chat, can be either “private”, “group”, “supergroup” or “channel” - * @param string $title Optional. Title, for supergroups, channels and group chats - * @param string $username Optional. Username, for private chats, supergroups and channels if available - * @param string $first_name Optional. First name of the other party in a private chat - * @param string $last_name Optional. Last name of the other party in a private chat - * @param ChatPhoto $photo Optional. Chat photo. Returned only in getChat. - * @param string $bio Optional. Bio of the other party in a private chat. Returned only in getChat. - * @param bool $has_private_forwards Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id= links only in chats with the user. Returned only in getChat. - * @param string $description Optional. Description, for groups, supergroups and channel chats. Returned only in getChat. - * @param string $invite_link Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. - * @param Message $pinned_message Optional. The most recent pinned message (by sending date). Returned only in getChat. - * @param ChatPermissions $permissions Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. - * @param int $slow_mode_delay Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. - * @param int $message_auto_delete_time Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. - * @param bool $has_protected_content Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. - * @param string $sticker_set_name Optional. For supergroups, name of group sticker set. Returned only in getChat. - * @param bool $can_set_sticker_set Optional. True, if the bot can change the group sticker set. Returned only in getChat. - * @param int $linked_chat_id Optional. 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. Returned only in getChat. - * @param ChatLocation $location Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat. - */ - public static function make( - int $id, - string $type, - ?string $title = null, - ?string $username = null, - ?string $first_name = null, - ?string $last_name = null, - ?ChatPhoto $photo = null, - ?string $bio = null, - ?bool $has_private_forwards = null, - ?string $description = null, - ?string $invite_link = null, - ?Message $pinned_message = null, - ?ChatPermissions $permissions = null, - ?int $slow_mode_delay = null, - ?int $message_auto_delete_time = null, - ?bool $has_protected_content = null, - ?string $sticker_set_name = null, - ?bool $can_set_sticker_set = null, - ?int $linked_chat_id = null, - ?ChatLocation $location = null - ): static { - return new static([ - 'id' => $id, - 'type' => $type, - 'title' => $title, - 'username' => $username, - 'first_name' => $first_name, - 'last_name' => $last_name, - 'photo' => $photo, - 'bio' => $bio, - 'has_private_forwards' => $has_private_forwards, - 'description' => $description, - 'invite_link' => $invite_link, - 'pinned_message' => $pinned_message, - 'permissions' => $permissions, - 'slow_mode_delay' => $slow_mode_delay, - 'message_auto_delete_time' => $message_auto_delete_time, - 'has_protected_content' => $has_protected_content, - 'sticker_set_name' => $sticker_set_name, - 'can_set_sticker_set' => $can_set_sticker_set, - 'linked_chat_id' => $linked_chat_id, - 'location' => $location, - ]); - } + /** 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. */ + public int $id; + + /** Type of chat, can be either “private”, “group”, “supergroup” or “channel” */ + public string $type; + + /** Optional. Title, for supergroups, channels and group chats */ + public ?string $title = null; + + /** Optional. Username, for private chats, supergroups and channels if available */ + public ?string $username = null; + + /** Optional. First name of the other party in a private chat */ + public ?string $first_name = null; + + /** Optional. Last name of the other party in a private chat */ + public ?string $last_name = null; + + /** Optional. Chat photo. Returned only in getChat. */ + public ?ChatPhoto $photo = null; + + /** Optional. Bio of the other party in a private chat. Returned only in getChat. */ + public ?string $bio = null; + + /** Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id= links only in chats with the user. Returned only in getChat. */ + public ?bool $has_private_forwards = null; + + /** Optional. Description, for groups, supergroups and channel chats. Returned only in getChat. */ + public ?string $description = null; + + /** Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. */ + public ?string $invite_link = null; + + /** Optional. The most recent pinned message (by sending date). Returned only in getChat. */ + public ?Message $pinned_message = null; + + /** Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. */ + public ?ChatPermissions $permissions = null; + + /** Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. */ + public ?int $slow_mode_delay = null; + + /** Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. */ + public ?int $message_auto_delete_time = null; + + /** Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. */ + public ?bool $has_protected_content = null; + + /** Optional. For supergroups, name of group sticker set. Returned only in getChat. */ + public ?string $sticker_set_name = null; + + /** Optional. True, if the bot can change the group sticker set. Returned only in getChat. */ + public ?bool $can_set_sticker_set = null; + + /** Optional. 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. Returned only in getChat. */ + public ?int $linked_chat_id = null; + + /** Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat. */ + public ?ChatLocation $location = null; + + /** + * @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. + * @param string $type Type of chat, can be either “private”, “group”, “supergroup” or “channel” + * @param string $title Optional. Title, for supergroups, channels and group chats + * @param string $username Optional. Username, for private chats, supergroups and channels if available + * @param string $first_name Optional. First name of the other party in a private chat + * @param string $last_name Optional. Last name of the other party in a private chat + * @param ChatPhoto $photo Optional. Chat photo. Returned only in getChat. + * @param string $bio Optional. Bio of the other party in a private chat. Returned only in getChat. + * @param bool $has_private_forwards Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id= links only in chats with the user. Returned only in getChat. + * @param string $description Optional. Description, for groups, supergroups and channel chats. Returned only in getChat. + * @param string $invite_link Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat. + * @param Message $pinned_message Optional. The most recent pinned message (by sending date). Returned only in getChat. + * @param ChatPermissions $permissions Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat. + * @param int $slow_mode_delay Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat. + * @param int $message_auto_delete_time Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. + * @param bool $has_protected_content Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. + * @param string $sticker_set_name Optional. For supergroups, name of group sticker set. Returned only in getChat. + * @param bool $can_set_sticker_set Optional. True, if the bot can change the group sticker set. Returned only in getChat. + * @param int $linked_chat_id Optional. 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. Returned only in getChat. + * @param ChatLocation $location Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat. + */ + public static function make( + int $id, + string $type, + ?string $title = null, + ?string $username = null, + ?string $first_name = null, + ?string $last_name = null, + ?ChatPhoto $photo = null, + ?string $bio = null, + ?bool $has_private_forwards = null, + ?string $description = null, + ?string $invite_link = null, + ?Message $pinned_message = null, + ?ChatPermissions $permissions = null, + ?int $slow_mode_delay = null, + ?int $message_auto_delete_time = null, + ?bool $has_protected_content = null, + ?string $sticker_set_name = null, + ?bool $can_set_sticker_set = null, + ?int $linked_chat_id = null, + ?ChatLocation $location = null + ): static { + return new static([ + 'id' => $id, + 'type' => $type, + 'title' => $title, + 'username' => $username, + 'first_name' => $first_name, + 'last_name' => $last_name, + 'photo' => $photo, + 'bio' => $bio, + 'has_private_forwards' => $has_private_forwards, + 'description' => $description, + 'invite_link' => $invite_link, + 'pinned_message' => $pinned_message, + 'permissions' => $permissions, + 'slow_mode_delay' => $slow_mode_delay, + 'message_auto_delete_time' => $message_auto_delete_time, + 'has_protected_content' => $has_protected_content, + 'sticker_set_name' => $sticker_set_name, + 'can_set_sticker_set' => $can_set_sticker_set, + 'linked_chat_id' => $linked_chat_id, + 'location' => $location, + ]); + } } diff --git a/src/Telegram/ChatAdministratorRights.php b/src/Telegram/ChatAdministratorRights.php index 7a17e1a..aee368f 100644 --- a/src/Telegram/ChatAdministratorRights.php +++ b/src/Telegram/ChatAdministratorRights.php @@ -11,78 +11,77 @@ */ class ChatAdministratorRights extends \Tii\Telepath\Type { - /** True, if the user's presence in the chat is hidden */ - public bool $is_anonymous; + /** True, if the user's presence in the chat is hidden */ + public bool $is_anonymous; - /** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */ - public bool $can_manage_chat; + /** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */ + public bool $can_manage_chat; - /** True, if the administrator can delete messages of other users */ - public bool $can_delete_messages; + /** True, if the administrator can delete messages of other users */ + public bool $can_delete_messages; - /** True, if the administrator can manage video chats */ - public bool $can_manage_video_chats; + /** True, if the administrator can manage video chats */ + public bool $can_manage_video_chats; - /** True, if the administrator can restrict, ban or unban chat members */ - public bool $can_restrict_members; + /** True, if the administrator can restrict, ban or unban chat members */ + public bool $can_restrict_members; - /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) */ - public bool $can_promote_members; + /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) */ + public bool $can_promote_members; - /** True, if the user is allowed to change the chat title, photo and other settings */ - public bool $can_change_info; + /** True, if the user is allowed to change the chat title, photo and other settings */ + public bool $can_change_info; - /** True, if the user is allowed to invite new users to the chat */ - public bool $can_invite_users; + /** True, if the user is allowed to invite new users to the chat */ + public bool $can_invite_users; - /** Optional. True, if the administrator can post in the channel; channels only */ - public ?bool $can_post_messages = null; + /** Optional. True, if the administrator can post in the channel; channels only */ + public ?bool $can_post_messages = null; - /** Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */ - public ?bool $can_edit_messages = null; + /** Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */ + public ?bool $can_edit_messages = null; - /** Optional. True, if the user is allowed to pin messages; groups and supergroups only */ - public ?bool $can_pin_messages = null; + /** Optional. True, if the user is allowed to pin messages; groups and supergroups only */ + public ?bool $can_pin_messages = null; - - /** - * @param bool $is_anonymous True, if the user's presence in the chat is hidden - * @param bool $can_manage_chat True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege - * @param bool $can_delete_messages True, if the administrator can delete messages of other users - * @param bool $can_manage_video_chats True, if the administrator can manage video chats - * @param bool $can_restrict_members True, if the administrator can restrict, ban or unban chat members - * @param bool $can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) - * @param bool $can_change_info True, if the user is allowed to change the chat title, photo and other settings - * @param bool $can_invite_users True, if the user is allowed to invite new users to the chat - * @param bool $can_post_messages Optional. True, if the administrator can post in the channel; channels only - * @param bool $can_edit_messages Optional. True, if the administrator can edit messages of other users and can pin messages; channels only - * @param bool $can_pin_messages Optional. True, if the user is allowed to pin messages; groups and supergroups only - */ - public static function make( - bool $is_anonymous, - bool $can_manage_chat, - bool $can_delete_messages, - bool $can_manage_video_chats, - bool $can_restrict_members, - bool $can_promote_members, - bool $can_change_info, - bool $can_invite_users, - ?bool $can_post_messages = null, - ?bool $can_edit_messages = null, - ?bool $can_pin_messages = null - ): static { - return new static([ - 'is_anonymous' => $is_anonymous, - 'can_manage_chat' => $can_manage_chat, - 'can_delete_messages' => $can_delete_messages, - 'can_manage_video_chats' => $can_manage_video_chats, - 'can_restrict_members' => $can_restrict_members, - 'can_promote_members' => $can_promote_members, - 'can_change_info' => $can_change_info, - 'can_invite_users' => $can_invite_users, - 'can_post_messages' => $can_post_messages, - 'can_edit_messages' => $can_edit_messages, - 'can_pin_messages' => $can_pin_messages, - ]); - } + /** + * @param bool $is_anonymous True, if the user's presence in the chat is hidden + * @param bool $can_manage_chat True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege + * @param bool $can_delete_messages True, if the administrator can delete messages of other users + * @param bool $can_manage_video_chats True, if the administrator can manage video chats + * @param bool $can_restrict_members True, if the administrator can restrict, ban or unban chat members + * @param bool $can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) + * @param bool $can_change_info True, if the user is allowed to change the chat title, photo and other settings + * @param bool $can_invite_users True, if the user is allowed to invite new users to the chat + * @param bool $can_post_messages Optional. True, if the administrator can post in the channel; channels only + * @param bool $can_edit_messages Optional. True, if the administrator can edit messages of other users and can pin messages; channels only + * @param bool $can_pin_messages Optional. True, if the user is allowed to pin messages; groups and supergroups only + */ + public static function make( + bool $is_anonymous, + bool $can_manage_chat, + bool $can_delete_messages, + bool $can_manage_video_chats, + bool $can_restrict_members, + bool $can_promote_members, + bool $can_change_info, + bool $can_invite_users, + ?bool $can_post_messages = null, + ?bool $can_edit_messages = null, + ?bool $can_pin_messages = null + ): static { + return new static([ + 'is_anonymous' => $is_anonymous, + 'can_manage_chat' => $can_manage_chat, + 'can_delete_messages' => $can_delete_messages, + 'can_manage_video_chats' => $can_manage_video_chats, + 'can_restrict_members' => $can_restrict_members, + 'can_promote_members' => $can_promote_members, + 'can_change_info' => $can_change_info, + 'can_invite_users' => $can_invite_users, + 'can_post_messages' => $can_post_messages, + 'can_edit_messages' => $can_edit_messages, + 'can_pin_messages' => $can_pin_messages, + ]); + } } diff --git a/src/Telegram/ChatInviteLink.php b/src/Telegram/ChatInviteLink.php index 802bcdd..7356926 100644 --- a/src/Telegram/ChatInviteLink.php +++ b/src/Telegram/ChatInviteLink.php @@ -11,66 +11,65 @@ */ class ChatInviteLink extends \Tii\Telepath\Type { - /** The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”. */ - public string $invite_link; + /** The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”. */ + public string $invite_link; - /** Creator of the link */ - public User $creator; + /** Creator of the link */ + public User $creator; - /** True, if users joining the chat via the link need to be approved by chat administrators */ - public bool $creates_join_request; + /** True, if users joining the chat via the link need to be approved by chat administrators */ + public bool $creates_join_request; - /** True, if the link is primary */ - public bool $is_primary; + /** True, if the link is primary */ + public bool $is_primary; - /** True, if the link is revoked */ - public bool $is_revoked; + /** True, if the link is revoked */ + public bool $is_revoked; - /** Optional. Invite link name */ - public ?string $name = null; + /** Optional. Invite link name */ + public ?string $name = null; - /** Optional. Point in time (Unix timestamp) when the link will expire or has been expired */ - public ?int $expire_date = null; + /** Optional. Point in time (Unix timestamp) when the link will expire or has been expired */ + public ?int $expire_date = null; - /** Optional. Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */ - public ?int $member_limit = null; + /** Optional. Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 */ + public ?int $member_limit = null; - /** Optional. Number of pending join requests created using this link */ - public ?int $pending_join_request_count = null; + /** Optional. Number of pending join requests created using this link */ + public ?int $pending_join_request_count = null; - - /** - * @param string $invite_link The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”. - * @param User $creator Creator of the link - * @param bool $creates_join_request True, if users joining the chat via the link need to be approved by chat administrators - * @param bool $is_primary True, if the link is primary - * @param bool $is_revoked True, if the link is revoked - * @param string $name Optional. Invite link name - * @param int $expire_date Optional. Point in time (Unix timestamp) when the link will expire or has been expired - * @param int $member_limit Optional. Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 - * @param int $pending_join_request_count Optional. Number of pending join requests created using this link - */ - public static function make( - string $invite_link, - User $creator, - bool $creates_join_request, - bool $is_primary, - bool $is_revoked, - ?string $name = null, - ?int $expire_date = null, - ?int $member_limit = null, - ?int $pending_join_request_count = null - ): static { - return new static([ - 'invite_link' => $invite_link, - 'creator' => $creator, - 'creates_join_request' => $creates_join_request, - 'is_primary' => $is_primary, - 'is_revoked' => $is_revoked, - 'name' => $name, - 'expire_date' => $expire_date, - 'member_limit' => $member_limit, - 'pending_join_request_count' => $pending_join_request_count, - ]); - } + /** + * @param string $invite_link The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”. + * @param User $creator Creator of the link + * @param bool $creates_join_request True, if users joining the chat via the link need to be approved by chat administrators + * @param bool $is_primary True, if the link is primary + * @param bool $is_revoked True, if the link is revoked + * @param string $name Optional. Invite link name + * @param int $expire_date Optional. Point in time (Unix timestamp) when the link will expire or has been expired + * @param int $member_limit Optional. Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999 + * @param int $pending_join_request_count Optional. Number of pending join requests created using this link + */ + public static function make( + string $invite_link, + User $creator, + bool $creates_join_request, + bool $is_primary, + bool $is_revoked, + ?string $name = null, + ?int $expire_date = null, + ?int $member_limit = null, + ?int $pending_join_request_count = null + ): static { + return new static([ + 'invite_link' => $invite_link, + 'creator' => $creator, + 'creates_join_request' => $creates_join_request, + 'is_primary' => $is_primary, + 'is_revoked' => $is_revoked, + 'name' => $name, + 'expire_date' => $expire_date, + 'member_limit' => $member_limit, + 'pending_join_request_count' => $pending_join_request_count, + ]); + } } diff --git a/src/Telegram/ChatJoinRequest.php b/src/Telegram/ChatJoinRequest.php index 4bd7dc1..b0638f8 100644 --- a/src/Telegram/ChatJoinRequest.php +++ b/src/Telegram/ChatJoinRequest.php @@ -11,42 +11,41 @@ */ class ChatJoinRequest extends \Tii\Telepath\Type { - /** Chat to which the request was sent */ - public Chat $chat; - - /** User that sent the join request */ - public User $from; - - /** Date the request was sent in Unix time */ - public int $date; - - /** Optional. Bio of the user. */ - public ?string $bio = null; - - /** Optional. Chat invite link that was used by the user to send the join request */ - public ?ChatInviteLink $invite_link = null; - - - /** - * @param Chat $chat Chat to which the request was sent - * @param User $from User that sent the join request - * @param int $date Date the request was sent in Unix time - * @param string $bio Optional. Bio of the user. - * @param ChatInviteLink $invite_link Optional. Chat invite link that was used by the user to send the join request - */ - public static function make( - Chat $chat, - User $from, - int $date, - ?string $bio = null, - ?ChatInviteLink $invite_link = null - ): static { - return new static([ - 'chat' => $chat, - 'from' => $from, - 'date' => $date, - 'bio' => $bio, - 'invite_link' => $invite_link, - ]); - } + /** Chat to which the request was sent */ + public Chat $chat; + + /** User that sent the join request */ + public User $from; + + /** Date the request was sent in Unix time */ + public int $date; + + /** Optional. Bio of the user. */ + public ?string $bio = null; + + /** Optional. Chat invite link that was used by the user to send the join request */ + public ?ChatInviteLink $invite_link = null; + + /** + * @param Chat $chat Chat to which the request was sent + * @param User $from User that sent the join request + * @param int $date Date the request was sent in Unix time + * @param string $bio Optional. Bio of the user. + * @param ChatInviteLink $invite_link Optional. Chat invite link that was used by the user to send the join request + */ + public static function make( + Chat $chat, + User $from, + int $date, + ?string $bio = null, + ?ChatInviteLink $invite_link = null + ): static { + return new static([ + 'chat' => $chat, + 'from' => $from, + 'date' => $date, + 'bio' => $bio, + 'invite_link' => $invite_link, + ]); + } } diff --git a/src/Telegram/ChatLocation.php b/src/Telegram/ChatLocation.php index 0521a96..ca739d8 100644 --- a/src/Telegram/ChatLocation.php +++ b/src/Telegram/ChatLocation.php @@ -11,22 +11,21 @@ */ class ChatLocation extends \Tii\Telepath\Type { - /** The location to which the supergroup is connected. Can't be a live location. */ - public Location $location; + /** The location to which the supergroup is connected. Can't be a live location. */ + public Location $location; - /** Location address; 1-64 characters, as defined by the chat owner */ - public string $address; + /** Location address; 1-64 characters, as defined by the chat owner */ + public string $address; - - /** - * @param Location $location The location to which the supergroup is connected. Can't be a live location. - * @param string $address Location address; 1-64 characters, as defined by the chat owner - */ - public static function make(Location $location, string $address): static - { - return new static([ - 'location' => $location, - 'address' => $address, - ]); - } + /** + * @param Location $location The location to which the supergroup is connected. Can't be a live location. + * @param string $address Location address; 1-64 characters, as defined by the chat owner + */ + public static function make(Location $location, string $address): static + { + return new static([ + 'location' => $location, + 'address' => $address, + ]); + } } diff --git a/src/Telegram/ChatMember.php b/src/Telegram/ChatMember.php index 52a1f83..cddce5e 100644 --- a/src/Telegram/ChatMember.php +++ b/src/Telegram/ChatMember.php @@ -11,22 +11,21 @@ */ abstract class ChatMember extends \Tii\Telepath\Type { - /** The member's status in the chat */ - public string $status; + /** The member's status in the chat */ + public string $status; - /** Information about the user */ - public User $user; + /** Information about the user */ + public User $user; - - public static function factory(array $data): static - { - return match($data['status']) { - 'creator' => new ChatMemberOwner($data) - 'administrator' => new ChatMemberAdministrator($data) - 'member' => new ChatMemberMember($data) - 'restricted' => new ChatMemberRestricted($data) - 'left' => new ChatMemberLeft($data) - 'kicked' => new ChatMemberBanned($data) - }; - } + public static function factory(array $data): static + { + return match($data['status']) { + 'creator' => new ChatMemberOwner($data) + 'administrator' => new ChatMemberAdministrator($data) + 'member' => new ChatMemberMember($data) + 'restricted' => new ChatMemberRestricted($data) + 'left' => new ChatMemberLeft($data) + 'kicked' => new ChatMemberBanned($data) + }; + } } diff --git a/src/Telegram/ChatMemberAdministrator.php b/src/Telegram/ChatMemberAdministrator.php index 0701754..7ba5024 100644 --- a/src/Telegram/ChatMemberAdministrator.php +++ b/src/Telegram/ChatMemberAdministrator.php @@ -11,96 +11,95 @@ */ class ChatMemberAdministrator extends ChatMember { - /** The member's status in the chat, always “administrator” */ - public string $status = 'administrator'; - - /** True, if the bot is allowed to edit administrator privileges of that user */ - public bool $can_be_edited; - - /** True, if the user's presence in the chat is hidden */ - public bool $is_anonymous; - - /** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */ - public bool $can_manage_chat; - - /** True, if the administrator can delete messages of other users */ - public bool $can_delete_messages; - - /** True, if the administrator can manage video chats */ - public bool $can_manage_video_chats; - - /** True, if the administrator can restrict, ban or unban chat members */ - public bool $can_restrict_members; - - /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) */ - public bool $can_promote_members; - - /** True, if the user is allowed to change the chat title, photo and other settings */ - public bool $can_change_info; - - /** True, if the user is allowed to invite new users to the chat */ - public bool $can_invite_users; - - /** Optional. True, if the administrator can post in the channel; channels only */ - public ?bool $can_post_messages = null; - - /** Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */ - public ?bool $can_edit_messages = null; - - /** Optional. True, if the user is allowed to pin messages; groups and supergroups only */ - public ?bool $can_pin_messages = null; - - /** Optional. Custom title for this user */ - public ?string $custom_title = null; - - - /** - * @param User $user Information about the user - * @param bool $can_be_edited True, if the bot is allowed to edit administrator privileges of that user - * @param bool $is_anonymous True, if the user's presence in the chat is hidden - * @param bool $can_manage_chat True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege - * @param bool $can_delete_messages True, if the administrator can delete messages of other users - * @param bool $can_manage_video_chats True, if the administrator can manage video chats - * @param bool $can_restrict_members True, if the administrator can restrict, ban or unban chat members - * @param bool $can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) - * @param bool $can_change_info True, if the user is allowed to change the chat title, photo and other settings - * @param bool $can_invite_users True, if the user is allowed to invite new users to the chat - * @param bool $can_post_messages Optional. True, if the administrator can post in the channel; channels only - * @param bool $can_edit_messages Optional. True, if the administrator can edit messages of other users and can pin messages; channels only - * @param bool $can_pin_messages Optional. True, if the user is allowed to pin messages; groups and supergroups only - * @param string $custom_title Optional. Custom title for this user - */ - public static function make( - User $user, - bool $can_be_edited, - bool $is_anonymous, - bool $can_manage_chat, - bool $can_delete_messages, - bool $can_manage_video_chats, - bool $can_restrict_members, - bool $can_promote_members, - bool $can_change_info, - bool $can_invite_users, - ?bool $can_post_messages = null, - ?bool $can_edit_messages = null, - ?bool $can_pin_messages = null, - ?string $custom_title = null - ): static { - return new static([ - 'user' => $user, - 'can_be_edited' => $can_be_edited, - 'is_anonymous' => $is_anonymous, - 'can_manage_chat' => $can_manage_chat, - 'can_delete_messages' => $can_delete_messages, - 'can_manage_video_chats' => $can_manage_video_chats, - 'can_restrict_members' => $can_restrict_members, - 'can_promote_members' => $can_promote_members, - 'can_change_info' => $can_change_info, - 'can_invite_users' => $can_invite_users, - 'can_post_messages' => $can_post_messages, - 'can_edit_messages' => $can_edit_messages, - 'can_pin_messages' => $can_pin_messages, - 'custom_title' => $custom_title, - ]); - } + /** The member's status in the chat, always “administrator” */ + public string $status = 'administrator'; + + /** True, if the bot is allowed to edit administrator privileges of that user */ + public bool $can_be_edited; + + /** True, if the user's presence in the chat is hidden */ + public bool $is_anonymous; + + /** True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege */ + public bool $can_manage_chat; + + /** True, if the administrator can delete messages of other users */ + public bool $can_delete_messages; + + /** True, if the administrator can manage video chats */ + public bool $can_manage_video_chats; + + /** True, if the administrator can restrict, ban or unban chat members */ + public bool $can_restrict_members; + + /** True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) */ + public bool $can_promote_members; + + /** True, if the user is allowed to change the chat title, photo and other settings */ + public bool $can_change_info; + + /** True, if the user is allowed to invite new users to the chat */ + public bool $can_invite_users; + + /** Optional. True, if the administrator can post in the channel; channels only */ + public ?bool $can_post_messages = null; + + /** Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */ + public ?bool $can_edit_messages = null; + + /** Optional. True, if the user is allowed to pin messages; groups and supergroups only */ + public ?bool $can_pin_messages = null; + + /** Optional. Custom title for this user */ + public ?string $custom_title = null; + + /** + * @param User $user Information about the user + * @param bool $can_be_edited True, if the bot is allowed to edit administrator privileges of that user + * @param bool $is_anonymous True, if the user's presence in the chat is hidden + * @param bool $can_manage_chat True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege + * @param bool $can_delete_messages True, if the administrator can delete messages of other users + * @param bool $can_manage_video_chats True, if the administrator can manage video chats + * @param bool $can_restrict_members True, if the administrator can restrict, ban or unban chat members + * @param bool $can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user) + * @param bool $can_change_info True, if the user is allowed to change the chat title, photo and other settings + * @param bool $can_invite_users True, if the user is allowed to invite new users to the chat + * @param bool $can_post_messages Optional. True, if the administrator can post in the channel; channels only + * @param bool $can_edit_messages Optional. True, if the administrator can edit messages of other users and can pin messages; channels only + * @param bool $can_pin_messages Optional. True, if the user is allowed to pin messages; groups and supergroups only + * @param string $custom_title Optional. Custom title for this user + */ + public static function make( + User $user, + bool $can_be_edited, + bool $is_anonymous, + bool $can_manage_chat, + bool $can_delete_messages, + bool $can_manage_video_chats, + bool $can_restrict_members, + bool $can_promote_members, + bool $can_change_info, + bool $can_invite_users, + ?bool $can_post_messages = null, + ?bool $can_edit_messages = null, + ?bool $can_pin_messages = null, + ?string $custom_title = null + ): static { + return new static([ + 'user' => $user, + 'can_be_edited' => $can_be_edited, + 'is_anonymous' => $is_anonymous, + 'can_manage_chat' => $can_manage_chat, + 'can_delete_messages' => $can_delete_messages, + 'can_manage_video_chats' => $can_manage_video_chats, + 'can_restrict_members' => $can_restrict_members, + 'can_promote_members' => $can_promote_members, + 'can_change_info' => $can_change_info, + 'can_invite_users' => $can_invite_users, + 'can_post_messages' => $can_post_messages, + 'can_edit_messages' => $can_edit_messages, + 'can_pin_messages' => $can_pin_messages, + 'custom_title' => $custom_title, + ]); + } } diff --git a/src/Telegram/ChatMemberBanned.php b/src/Telegram/ChatMemberBanned.php index e0ca54f..4ddeba8 100644 --- a/src/Telegram/ChatMemberBanned.php +++ b/src/Telegram/ChatMemberBanned.php @@ -11,22 +11,21 @@ */ class ChatMemberBanned extends ChatMember { - /** The member's status in the chat, always “kicked” */ - public string $status = 'kicked'; + /** The member's status in the chat, always “kicked” */ + public string $status = 'kicked'; - /** Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever */ - public int $until_date; + /** Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever */ + public int $until_date; - - /** - * @param User $user Information about the user - * @param int $until_date Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever - */ - public static function make(User $user, int $until_date): static - { - return new static([ - 'user' => $user, - 'until_date' => $until_date, - ]); - } + /** + * @param User $user Information about the user + * @param int $until_date Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever + */ + public static function make(User $user, int $until_date): static + { + return new static([ + 'user' => $user, + 'until_date' => $until_date, + ]); + } } diff --git a/src/Telegram/ChatMemberLeft.php b/src/Telegram/ChatMemberLeft.php index 76b5c3b..c466e5d 100644 --- a/src/Telegram/ChatMemberLeft.php +++ b/src/Telegram/ChatMemberLeft.php @@ -11,17 +11,16 @@ */ class ChatMemberLeft extends ChatMember { - /** The member's status in the chat, always “left” */ - public string $status = 'left'; + /** The member's status in the chat, always “left” */ + public string $status = 'left'; - - /** - * @param User $user Information about the user - */ - public static function make(User $user): static - { - return new static([ - 'user' => $user, - ]); - } + /** + * @param User $user Information about the user + */ + public static function make(User $user): static + { + return new static([ + 'user' => $user, + ]); + } } diff --git a/src/Telegram/ChatMemberMember.php b/src/Telegram/ChatMemberMember.php index f14e901..b88b77b 100644 --- a/src/Telegram/ChatMemberMember.php +++ b/src/Telegram/ChatMemberMember.php @@ -11,17 +11,16 @@ */ class ChatMemberMember extends ChatMember { - /** The member's status in the chat, always “member” */ - public string $status = 'member'; + /** The member's status in the chat, always “member” */ + public string $status = 'member'; - - /** - * @param User $user Information about the user - */ - public static function make(User $user): static - { - return new static([ - 'user' => $user, - ]); - } + /** + * @param User $user Information about the user + */ + public static function make(User $user): static + { + return new static([ + 'user' => $user, + ]); + } } diff --git a/src/Telegram/ChatMemberOwner.php b/src/Telegram/ChatMemberOwner.php index 132da62..ab0401b 100644 --- a/src/Telegram/ChatMemberOwner.php +++ b/src/Telegram/ChatMemberOwner.php @@ -11,27 +11,26 @@ */ class ChatMemberOwner extends ChatMember { - /** The member's status in the chat, always “creator” */ - public string $status = 'creator'; + /** The member's status in the chat, always “creator” */ + public string $status = 'creator'; - /** True, if the user's presence in the chat is hidden */ - public bool $is_anonymous; + /** True, if the user's presence in the chat is hidden */ + public bool $is_anonymous; - /** Optional. Custom title for this user */ - public ?string $custom_title = null; + /** Optional. Custom title for this user */ + public ?string $custom_title = null; - - /** - * @param User $user Information about the user - * @param bool $is_anonymous True, if the user's presence in the chat is hidden - * @param string $custom_title Optional. Custom title for this user - */ - public static function make(User $user, bool $is_anonymous, ?string $custom_title = null): static - { - return new static([ - 'user' => $user, - 'is_anonymous' => $is_anonymous, - 'custom_title' => $custom_title, - ]); - } + /** + * @param User $user Information about the user + * @param bool $is_anonymous True, if the user's presence in the chat is hidden + * @param string $custom_title Optional. Custom title for this user + */ + public static function make(User $user, bool $is_anonymous, ?string $custom_title = null): static + { + return new static([ + 'user' => $user, + 'is_anonymous' => $is_anonymous, + 'custom_title' => $custom_title, + ]); + } } diff --git a/src/Telegram/ChatMemberRestricted.php b/src/Telegram/ChatMemberRestricted.php index 751b1a4..fb3e4b3 100644 --- a/src/Telegram/ChatMemberRestricted.php +++ b/src/Telegram/ChatMemberRestricted.php @@ -11,78 +11,77 @@ */ class ChatMemberRestricted extends ChatMember { - /** The member's status in the chat, always “restricted” */ - public string $status = 'restricted'; + /** The member's status in the chat, always “restricted” */ + public string $status = 'restricted'; - /** True, if the user is a member of the chat at the moment of the request */ - public bool $is_member; + /** True, if the user is a member of the chat at the moment of the request */ + public bool $is_member; - /** True, if the user is allowed to change the chat title, photo and other settings */ - public bool $can_change_info; + /** True, if the user is allowed to change the chat title, photo and other settings */ + public bool $can_change_info; - /** True, if the user is allowed to invite new users to the chat */ - public bool $can_invite_users; + /** True, if the user is allowed to invite new users to the chat */ + public bool $can_invite_users; - /** True, if the user is allowed to pin messages */ - public bool $can_pin_messages; + /** True, if the user is allowed to pin messages */ + public bool $can_pin_messages; - /** True, if the user is allowed to send text messages, contacts, locations and venues */ - public bool $can_send_messages; + /** True, if the user is allowed to send text messages, contacts, locations and venues */ + public bool $can_send_messages; - /** True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes */ - public bool $can_send_media_messages; + /** True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes */ + public bool $can_send_media_messages; - /** True, if the user is allowed to send polls */ - public bool $can_send_polls; + /** True, if the user is allowed to send polls */ + public bool $can_send_polls; - /** True, if the user is allowed to send animations, games, stickers and use inline bots */ - public bool $can_send_other_messages; + /** True, if the user is allowed to send animations, games, stickers and use inline bots */ + public bool $can_send_other_messages; - /** True, if the user is allowed to add web page previews to their messages */ - public bool $can_add_web_page_previews; + /** True, if the user is allowed to add web page previews to their messages */ + public bool $can_add_web_page_previews; - /** Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever */ - public int $until_date; + /** Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever */ + public int $until_date; - - /** - * @param User $user Information about the user - * @param bool $is_member True, if the user is a member of the chat at the moment of the request - * @param bool $can_change_info True, if the user is allowed to change the chat title, photo and other settings - * @param bool $can_invite_users True, if the user is allowed to invite new users to the chat - * @param bool $can_pin_messages True, if the user is allowed to pin messages - * @param bool $can_send_messages True, if the user is allowed to send text messages, contacts, locations and venues - * @param bool $can_send_media_messages True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes - * @param bool $can_send_polls True, if the user is allowed to send polls - * @param bool $can_send_other_messages True, if the user is allowed to send animations, games, stickers and use inline bots - * @param bool $can_add_web_page_previews True, if the user is allowed to add web page previews to their messages - * @param int $until_date Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever - */ - public static function make( - User $user, - bool $is_member, - bool $can_change_info, - bool $can_invite_users, - bool $can_pin_messages, - bool $can_send_messages, - bool $can_send_media_messages, - bool $can_send_polls, - bool $can_send_other_messages, - bool $can_add_web_page_previews, - int $until_date - ): static { - return new static([ - 'user' => $user, - 'is_member' => $is_member, - 'can_change_info' => $can_change_info, - 'can_invite_users' => $can_invite_users, - 'can_pin_messages' => $can_pin_messages, - 'can_send_messages' => $can_send_messages, - 'can_send_media_messages' => $can_send_media_messages, - 'can_send_polls' => $can_send_polls, - 'can_send_other_messages' => $can_send_other_messages, - 'can_add_web_page_previews' => $can_add_web_page_previews, - 'until_date' => $until_date, - ]); - } + /** + * @param User $user Information about the user + * @param bool $is_member True, if the user is a member of the chat at the moment of the request + * @param bool $can_change_info True, if the user is allowed to change the chat title, photo and other settings + * @param bool $can_invite_users True, if the user is allowed to invite new users to the chat + * @param bool $can_pin_messages True, if the user is allowed to pin messages + * @param bool $can_send_messages True, if the user is allowed to send text messages, contacts, locations and venues + * @param bool $can_send_media_messages True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes + * @param bool $can_send_polls True, if the user is allowed to send polls + * @param bool $can_send_other_messages True, if the user is allowed to send animations, games, stickers and use inline bots + * @param bool $can_add_web_page_previews True, if the user is allowed to add web page previews to their messages + * @param int $until_date Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever + */ + public static function make( + User $user, + bool $is_member, + bool $can_change_info, + bool $can_invite_users, + bool $can_pin_messages, + bool $can_send_messages, + bool $can_send_media_messages, + bool $can_send_polls, + bool $can_send_other_messages, + bool $can_add_web_page_previews, + int $until_date + ): static { + return new static([ + 'user' => $user, + 'is_member' => $is_member, + 'can_change_info' => $can_change_info, + 'can_invite_users' => $can_invite_users, + 'can_pin_messages' => $can_pin_messages, + 'can_send_messages' => $can_send_messages, + 'can_send_media_messages' => $can_send_media_messages, + 'can_send_polls' => $can_send_polls, + 'can_send_other_messages' => $can_send_other_messages, + 'can_add_web_page_previews' => $can_add_web_page_previews, + 'until_date' => $until_date, + ]); + } } diff --git a/src/Telegram/ChatMemberUpdated.php b/src/Telegram/ChatMemberUpdated.php index 4408024..e18acfd 100644 --- a/src/Telegram/ChatMemberUpdated.php +++ b/src/Telegram/ChatMemberUpdated.php @@ -11,48 +11,47 @@ */ class ChatMemberUpdated extends \Tii\Telepath\Type { - /** Chat the user belongs to */ - public Chat $chat; - - /** Performer of the action, which resulted in the change */ - public User $from; - - /** Date the change was done in Unix time */ - public int $date; - - /** Previous information about the chat member */ - public ChatMember $old_chat_member; - - /** New information about the chat member */ - public ChatMember $new_chat_member; - - /** Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */ - public ?ChatInviteLink $invite_link = null; - - - /** - * @param Chat $chat Chat the user belongs to - * @param User $from Performer of the action, which resulted in the change - * @param int $date Date the change was done in Unix time - * @param ChatMember $old_chat_member Previous information about the chat member - * @param ChatMember $new_chat_member New information about the chat member - * @param ChatInviteLink $invite_link Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. - */ - public static function make( - Chat $chat, - User $from, - int $date, - ChatMember $old_chat_member, - ChatMember $new_chat_member, - ?ChatInviteLink $invite_link = null - ): static { - return new static([ - 'chat' => $chat, - 'from' => $from, - 'date' => $date, - 'old_chat_member' => $old_chat_member, - 'new_chat_member' => $new_chat_member, - 'invite_link' => $invite_link, - ]); - } + /** Chat the user belongs to */ + public Chat $chat; + + /** Performer of the action, which resulted in the change */ + public User $from; + + /** Date the change was done in Unix time */ + public int $date; + + /** Previous information about the chat member */ + public ChatMember $old_chat_member; + + /** New information about the chat member */ + public ChatMember $new_chat_member; + + /** Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. */ + public ?ChatInviteLink $invite_link = null; + + /** + * @param Chat $chat Chat the user belongs to + * @param User $from Performer of the action, which resulted in the change + * @param int $date Date the change was done in Unix time + * @param ChatMember $old_chat_member Previous information about the chat member + * @param ChatMember $new_chat_member New information about the chat member + * @param ChatInviteLink $invite_link Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only. + */ + public static function make( + Chat $chat, + User $from, + int $date, + ChatMember $old_chat_member, + ChatMember $new_chat_member, + ?ChatInviteLink $invite_link = null + ): static { + return new static([ + 'chat' => $chat, + 'from' => $from, + 'date' => $date, + 'old_chat_member' => $old_chat_member, + 'new_chat_member' => $new_chat_member, + 'invite_link' => $invite_link, + ]); + } } diff --git a/src/Telegram/ChatPermissions.php b/src/Telegram/ChatPermissions.php index 8241a03..8880b0f 100644 --- a/src/Telegram/ChatPermissions.php +++ b/src/Telegram/ChatPermissions.php @@ -11,60 +11,59 @@ */ class ChatPermissions extends \Tii\Telepath\Type { - /** Optional. True, if the user is allowed to send text messages, contacts, locations and venues */ - public ?bool $can_send_messages = null; + /** Optional. True, if the user is allowed to send text messages, contacts, locations and venues */ + public ?bool $can_send_messages = null; - /** Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages */ - public ?bool $can_send_media_messages = null; + /** Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages */ + public ?bool $can_send_media_messages = null; - /** Optional. True, if the user is allowed to send polls, implies can_send_messages */ - public ?bool $can_send_polls = null; + /** Optional. True, if the user is allowed to send polls, implies can_send_messages */ + public ?bool $can_send_polls = null; - /** Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages */ - public ?bool $can_send_other_messages = null; + /** Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages */ + public ?bool $can_send_other_messages = null; - /** Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages */ - public ?bool $can_add_web_page_previews = null; + /** Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages */ + public ?bool $can_add_web_page_previews = null; - /** Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */ - public ?bool $can_change_info = null; + /** Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups */ + public ?bool $can_change_info = null; - /** Optional. True, if the user is allowed to invite new users to the chat */ - public ?bool $can_invite_users = null; + /** Optional. True, if the user is allowed to invite new users to the chat */ + public ?bool $can_invite_users = null; - /** Optional. True, if the user is allowed to pin messages. Ignored in public supergroups */ - public ?bool $can_pin_messages = null; + /** Optional. True, if the user is allowed to pin messages. Ignored in public supergroups */ + public ?bool $can_pin_messages = null; - - /** - * @param bool $can_send_messages Optional. True, if the user is allowed to send text messages, contacts, locations and venues - * @param bool $can_send_media_messages Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages - * @param bool $can_send_polls Optional. True, if the user is allowed to send polls, implies can_send_messages - * @param bool $can_send_other_messages Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages - * @param bool $can_add_web_page_previews Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages - * @param bool $can_change_info Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups - * @param bool $can_invite_users Optional. True, if the user is allowed to invite new users to the chat - * @param bool $can_pin_messages Optional. True, if the user is allowed to pin messages. Ignored in public supergroups - */ - public static function make( - ?bool $can_send_messages = null, - ?bool $can_send_media_messages = null, - ?bool $can_send_polls = null, - ?bool $can_send_other_messages = null, - ?bool $can_add_web_page_previews = null, - ?bool $can_change_info = null, - ?bool $can_invite_users = null, - ?bool $can_pin_messages = null - ): static { - return new static([ - 'can_send_messages' => $can_send_messages, - 'can_send_media_messages' => $can_send_media_messages, - '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_change_info' => $can_change_info, - 'can_invite_users' => $can_invite_users, - 'can_pin_messages' => $can_pin_messages, - ]); - } + /** + * @param bool $can_send_messages Optional. True, if the user is allowed to send text messages, contacts, locations and venues + * @param bool $can_send_media_messages Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages + * @param bool $can_send_polls Optional. True, if the user is allowed to send polls, implies can_send_messages + * @param bool $can_send_other_messages Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages + * @param bool $can_add_web_page_previews Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages + * @param bool $can_change_info Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups + * @param bool $can_invite_users Optional. True, if the user is allowed to invite new users to the chat + * @param bool $can_pin_messages Optional. True, if the user is allowed to pin messages. Ignored in public supergroups + */ + public static function make( + ?bool $can_send_messages = null, + ?bool $can_send_media_messages = null, + ?bool $can_send_polls = null, + ?bool $can_send_other_messages = null, + ?bool $can_add_web_page_previews = null, + ?bool $can_change_info = null, + ?bool $can_invite_users = null, + ?bool $can_pin_messages = null + ): static { + return new static([ + 'can_send_messages' => $can_send_messages, + 'can_send_media_messages' => $can_send_media_messages, + '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_change_info' => $can_change_info, + 'can_invite_users' => $can_invite_users, + 'can_pin_messages' => $can_pin_messages, + ]); + } } diff --git a/src/Telegram/ChatPhoto.php b/src/Telegram/ChatPhoto.php index 41c81a1..06b4639 100644 --- a/src/Telegram/ChatPhoto.php +++ b/src/Telegram/ChatPhoto.php @@ -11,36 +11,35 @@ */ class ChatPhoto extends \Tii\Telepath\Type { - /** File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */ - public string $small_file_id; - - /** Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $small_file_unique_id; - - /** File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */ - public string $big_file_id; - - /** Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $big_file_unique_id; - - - /** - * @param string $small_file_id File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. - * @param string $small_file_unique_id Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param string $big_file_id File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. - * @param string $big_file_unique_id Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - */ - public static function make( - string $small_file_id, - string $small_file_unique_id, - string $big_file_id, - string $big_file_unique_id - ): static { - return new static([ - 'small_file_id' => $small_file_id, - 'small_file_unique_id' => $small_file_unique_id, - 'big_file_id' => $big_file_id, - 'big_file_unique_id' => $big_file_unique_id, - ]); - } + /** File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */ + public string $small_file_id; + + /** Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $small_file_unique_id; + + /** File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. */ + public string $big_file_id; + + /** Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $big_file_unique_id; + + /** + * @param string $small_file_id File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. + * @param string $small_file_unique_id Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param string $big_file_id File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed. + * @param string $big_file_unique_id Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + */ + public static function make( + string $small_file_id, + string $small_file_unique_id, + string $big_file_id, + string $big_file_unique_id + ): static { + return new static([ + 'small_file_id' => $small_file_id, + 'small_file_unique_id' => $small_file_unique_id, + 'big_file_id' => $big_file_id, + 'big_file_unique_id' => $big_file_unique_id, + ]); + } } diff --git a/src/Telegram/ChosenInlineResult.php b/src/Telegram/ChosenInlineResult.php index 35e602e..37bacda 100644 --- a/src/Telegram/ChosenInlineResult.php +++ b/src/Telegram/ChosenInlineResult.php @@ -11,42 +11,41 @@ */ class ChosenInlineResult extends \Tii\Telepath\Type { - /** The unique identifier for the result that was chosen */ - public string $result_id; - - /** The user that chose the result */ - public User $from; - - /** The query that was used to obtain the result */ - public string $query; - - /** Optional. Sender location, only for bots that require user location */ - public ?Location $location = null; - - /** Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. */ - public ?string $inline_message_id = null; - - - /** - * @param string $result_id The unique identifier for the result that was chosen - * @param User $from The user that chose the result - * @param string $query The query that was used to obtain the result - * @param Location $location Optional. Sender location, only for bots that require user location - * @param string $inline_message_id Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. - */ - public static function make( - string $result_id, - User $from, - string $query, - ?Location $location = null, - ?string $inline_message_id = null - ): static { - return new static([ - 'result_id' => $result_id, - 'from' => $from, - 'query' => $query, - 'location' => $location, - 'inline_message_id' => $inline_message_id, - ]); - } + /** The unique identifier for the result that was chosen */ + public string $result_id; + + /** The user that chose the result */ + public User $from; + + /** The query that was used to obtain the result */ + public string $query; + + /** Optional. Sender location, only for bots that require user location */ + public ?Location $location = null; + + /** Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. */ + public ?string $inline_message_id = null; + + /** + * @param string $result_id The unique identifier for the result that was chosen + * @param User $from The user that chose the result + * @param string $query The query that was used to obtain the result + * @param Location $location Optional. Sender location, only for bots that require user location + * @param string $inline_message_id Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message. + */ + public static function make( + string $result_id, + User $from, + string $query, + ?Location $location = null, + ?string $inline_message_id = null + ): static { + return new static([ + 'result_id' => $result_id, + 'from' => $from, + 'query' => $query, + 'location' => $location, + 'inline_message_id' => $inline_message_id, + ]); + } } diff --git a/src/Telegram/Contact.php b/src/Telegram/Contact.php index 2f1663d..0f455f4 100644 --- a/src/Telegram/Contact.php +++ b/src/Telegram/Contact.php @@ -11,42 +11,41 @@ */ class Contact extends \Tii\Telepath\Type { - /** Contact's phone number */ - public string $phone_number; - - /** Contact's first name */ - public string $first_name; - - /** Optional. Contact's last name */ - public ?string $last_name = null; - - /** Optional. Contact's user identifier in Telegram. 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. */ - public ?int $user_id = null; - - /** Optional. Additional data about the contact in the form of a vCard */ - public ?string $vcard = null; - - - /** - * @param string $phone_number Contact's phone number - * @param string $first_name Contact's first name - * @param string $last_name Optional. Contact's last name - * @param int $user_id Optional. Contact's user identifier in Telegram. 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 string $vcard Optional. Additional data about the contact in the form of a vCard - */ - public static function make( - string $phone_number, - string $first_name, - ?string $last_name = null, - ?int $user_id = null, - ?string $vcard = null - ): static { - return new static([ - 'phone_number' => $phone_number, - 'first_name' => $first_name, - 'last_name' => $last_name, - 'user_id' => $user_id, - 'vcard' => $vcard, - ]); - } + /** Contact's phone number */ + public string $phone_number; + + /** Contact's first name */ + public string $first_name; + + /** Optional. Contact's last name */ + public ?string $last_name = null; + + /** Optional. Contact's user identifier in Telegram. 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. */ + public ?int $user_id = null; + + /** Optional. Additional data about the contact in the form of a vCard */ + public ?string $vcard = null; + + /** + * @param string $phone_number Contact's phone number + * @param string $first_name Contact's first name + * @param string $last_name Optional. Contact's last name + * @param int $user_id Optional. Contact's user identifier in Telegram. 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 string $vcard Optional. Additional data about the contact in the form of a vCard + */ + public static function make( + string $phone_number, + string $first_name, + ?string $last_name = null, + ?int $user_id = null, + ?string $vcard = null + ): static { + return new static([ + 'phone_number' => $phone_number, + 'first_name' => $first_name, + 'last_name' => $last_name, + 'user_id' => $user_id, + 'vcard' => $vcard, + ]); + } } diff --git a/src/Telegram/Dice.php b/src/Telegram/Dice.php index 9332b04..56ba2cf 100644 --- a/src/Telegram/Dice.php +++ b/src/Telegram/Dice.php @@ -11,22 +11,21 @@ */ class Dice extends \Tii\Telepath\Type { - /** Emoji on which the dice throw animation is based */ - public string $emoji; + /** Emoji on which the dice throw animation is based */ + public string $emoji; - /** Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji */ - public int $value; + /** Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji */ + public int $value; - - /** - * @param string $emoji Emoji on which the dice throw animation is based - * @param int $value Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji - */ - public static function make(string $emoji, int $value): static - { - return new static([ - 'emoji' => $emoji, - 'value' => $value, - ]); - } + /** + * @param string $emoji Emoji on which the dice throw animation is based + * @param int $value Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji + */ + public static function make(string $emoji, int $value): static + { + return new static([ + 'emoji' => $emoji, + 'value' => $value, + ]); + } } diff --git a/src/Telegram/Document.php b/src/Telegram/Document.php index 4c89143..6dc15f8 100644 --- a/src/Telegram/Document.php +++ b/src/Telegram/Document.php @@ -11,48 +11,47 @@ */ class Document extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; - - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; - - /** Optional. Document thumbnail as defined by sender */ - public ?PhotoSize $thumb = null; - - /** Optional. Original filename as defined by sender */ - public ?string $file_name = null; - - /** Optional. MIME type of the file as defined by sender */ - public ?string $mime_type = null; - - /** Optional. File size in bytes */ - public ?int $file_size = null; - - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param PhotoSize $thumb Optional. Document thumbnail as defined by sender - * @param string $file_name Optional. Original filename as defined by sender - * @param string $mime_type Optional. MIME type of the file as defined by sender - * @param int $file_size Optional. File size in bytes - */ - public static function make( - string $file_id, - string $file_unique_id, - ?PhotoSize $thumb = null, - ?string $file_name = null, - ?string $mime_type = null, - ?int $file_size = null - ): static { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'thumb' => $thumb, - 'file_name' => $file_name, - 'mime_type' => $mime_type, - 'file_size' => $file_size, - ]); - } + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; + + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; + + /** Optional. Document thumbnail as defined by sender */ + public ?PhotoSize $thumb = null; + + /** Optional. Original filename as defined by sender */ + public ?string $file_name = null; + + /** Optional. MIME type of the file as defined by sender */ + public ?string $mime_type = null; + + /** Optional. File size in bytes */ + public ?int $file_size = null; + + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param PhotoSize $thumb Optional. Document thumbnail as defined by sender + * @param string $file_name Optional. Original filename as defined by sender + * @param string $mime_type Optional. MIME type of the file as defined by sender + * @param int $file_size Optional. File size in bytes + */ + public static function make( + string $file_id, + string $file_unique_id, + ?PhotoSize $thumb = null, + ?string $file_name = null, + ?string $mime_type = null, + ?int $file_size = null + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'thumb' => $thumb, + 'file_name' => $file_name, + 'mime_type' => $mime_type, + 'file_size' => $file_size, + ]); + } } diff --git a/src/Telegram/EncryptedCredentials.php b/src/Telegram/EncryptedCredentials.php index a9ee235..c91f9bc 100644 --- a/src/Telegram/EncryptedCredentials.php +++ b/src/Telegram/EncryptedCredentials.php @@ -11,27 +11,26 @@ */ class EncryptedCredentials extends \Tii\Telepath\Type { - /** Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication */ - public string $data; + /** Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication */ + public string $data; - /** Base64-encoded data hash for data authentication */ - public string $hash; + /** Base64-encoded data hash for data authentication */ + public string $hash; - /** Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption */ - public string $secret; + /** Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption */ + public string $secret; - - /** - * @param string $data Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication - * @param string $hash Base64-encoded data hash for data authentication - * @param string $secret Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption - */ - public static function make(string $data, string $hash, string $secret): static - { - return new static([ - 'data' => $data, - 'hash' => $hash, - 'secret' => $secret, - ]); - } + /** + * @param string $data Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication + * @param string $hash Base64-encoded data hash for data authentication + * @param string $secret Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption + */ + public static function make(string $data, string $hash, string $secret): static + { + return new static([ + 'data' => $data, + 'hash' => $hash, + 'secret' => $secret, + ]); + } } diff --git a/src/Telegram/EncryptedPassportElement.php b/src/Telegram/EncryptedPassportElement.php index d7e48c1..45bb953 100644 --- a/src/Telegram/EncryptedPassportElement.php +++ b/src/Telegram/EncryptedPassportElement.php @@ -11,78 +11,77 @@ */ class EncryptedPassportElement extends \Tii\Telepath\Type { - /** Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. */ - public string $type; + /** Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. */ + public string $type; - /** Base64-encoded element hash for using in PassportElementErrorUnspecified */ - public string $hash; + /** Base64-encoded element hash for using in PassportElementErrorUnspecified */ + public string $hash; - /** Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. */ - public ?string $data = null; + /** Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. */ + public ?string $data = null; - /** Optional. User's verified phone number, available only for “phone_number” type */ - public ?string $phone_number = null; + /** Optional. User's verified phone number, available only for “phone_number” type */ + public ?string $phone_number = null; - /** Optional. User's verified email address, available only for “email” type */ - public ?string $email = null; + /** Optional. User's verified email address, available only for “email” type */ + public ?string $email = null; - /** - * Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. - * @var PassportFile[] - */ - public ?array $files = null; + /** + * Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. + * @var PassportFile[] + */ + public ?array $files = null; - /** Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */ - public ?PassportFile $front_side = null; + /** Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */ + public ?PassportFile $front_side = null; - /** Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */ - public ?PassportFile $reverse_side = null; + /** Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */ + public ?PassportFile $reverse_side = null; - /** Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */ - public ?PassportFile $selfie = null; + /** Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. */ + public ?PassportFile $selfie = null; - /** - * Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. - * @var PassportFile[] - */ - public ?array $translation = null; + /** + * Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. + * @var PassportFile[] + */ + public ?array $translation = null; - - /** - * @param string $type Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. - * @param string $hash Base64-encoded element hash for using in PassportElementErrorUnspecified - * @param string $data Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. - * @param string $phone_number Optional. User's verified phone number, available only for “phone_number” type - * @param string $email Optional. User's verified email address, available only for “email” type - * @param PassportFile[] $files Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. - * @param PassportFile $front_side Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. - * @param PassportFile $reverse_side Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. - * @param PassportFile $selfie Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. - * @param PassportFile[] $translation Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. - */ - public static function make( - string $type, - string $hash, - ?string $data = null, - ?string $phone_number = null, - ?string $email = null, - ?array $files = null, - ?PassportFile $front_side = null, - ?PassportFile $reverse_side = null, - ?PassportFile $selfie = null, - ?array $translation = null - ): static { - return new static([ - 'type' => $type, - 'hash' => $hash, - 'data' => $data, - 'phone_number' => $phone_number, - 'email' => $email, - 'files' => $files, - 'front_side' => $front_side, - 'reverse_side' => $reverse_side, - 'selfie' => $selfie, - 'translation' => $translation, - ]); - } + /** + * @param string $type Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”. + * @param string $hash Base64-encoded element hash for using in PassportElementErrorUnspecified + * @param string $data Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials. + * @param string $phone_number Optional. User's verified phone number, available only for “phone_number” type + * @param string $email Optional. User's verified email address, available only for “email” type + * @param PassportFile[] $files Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. + * @param PassportFile $front_side Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. + * @param PassportFile $reverse_side Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials. + * @param PassportFile $selfie Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials. + * @param PassportFile[] $translation Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials. + */ + public static function make( + string $type, + string $hash, + ?string $data = null, + ?string $phone_number = null, + ?string $email = null, + ?array $files = null, + ?PassportFile $front_side = null, + ?PassportFile $reverse_side = null, + ?PassportFile $selfie = null, + ?array $translation = null + ): static { + return new static([ + 'type' => $type, + 'hash' => $hash, + 'data' => $data, + 'phone_number' => $phone_number, + 'email' => $email, + 'files' => $files, + 'front_side' => $front_side, + 'reverse_side' => $reverse_side, + 'selfie' => $selfie, + 'translation' => $translation, + ]); + } } diff --git a/src/Telegram/File.php b/src/Telegram/File.php index 3b8b213..f0a6240 100644 --- a/src/Telegram/File.php +++ b/src/Telegram/File.php @@ -11,36 +11,35 @@ */ class File extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; - - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; - - /** Optional. File size in bytes, if known */ - public ?int $file_size = null; - - /** Optional. File path. Use https://api.telegram.org/file/bot/ to get the file. */ - public ?string $file_path = null; - - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param int $file_size Optional. File size in bytes, if known - * @param string $file_path Optional. File path. Use https://api.telegram.org/file/bot/ to get the file. - */ - public static function make( - string $file_id, - string $file_unique_id, - ?int $file_size = null, - ?string $file_path = null - ): static { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'file_size' => $file_size, - 'file_path' => $file_path, - ]); - } + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; + + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; + + /** Optional. File size in bytes, if known */ + public ?int $file_size = null; + + /** Optional. File path. Use https://api.telegram.org/file/bot/ to get the file. */ + public ?string $file_path = null; + + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $file_size Optional. File size in bytes, if known + * @param string $file_path Optional. File path. Use https://api.telegram.org/file/bot/ to get the file. + */ + public static function make( + string $file_id, + string $file_unique_id, + ?int $file_size = null, + ?string $file_path = null + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'file_size' => $file_size, + 'file_path' => $file_path, + ]); + } } diff --git a/src/Telegram/ForceReply.php b/src/Telegram/ForceReply.php index 98b7941..2d248c8 100644 --- a/src/Telegram/ForceReply.php +++ b/src/Telegram/ForceReply.php @@ -11,30 +11,29 @@ */ class ForceReply extends \Tii\Telepath\Type { - /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */ - public bool $force_reply; + /** Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' */ + public bool $force_reply; - /** Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters */ - public ?string $input_field_placeholder = null; + /** Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters */ + public ?string $input_field_placeholder = null; - /** Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. */ - public ?bool $selective = null; + /** Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. */ + public ?bool $selective = null; - - /** - * @param bool $force_reply Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' - * @param string $input_field_placeholder Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters - * @param bool $selective Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. - */ - public static function make( - bool $force_reply, - ?string $input_field_placeholder = null, - ?bool $selective = null - ): static { - return new static([ - 'force_reply' => $force_reply, - 'input_field_placeholder' => $input_field_placeholder, - 'selective' => $selective, - ]); - } + /** + * @param bool $force_reply Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply' + * @param string $input_field_placeholder Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters + * @param bool $selective Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. + */ + public static function make( + bool $force_reply, + ?string $input_field_placeholder = null, + ?bool $selective = null + ): static { + return new static([ + 'force_reply' => $force_reply, + 'input_field_placeholder' => $input_field_placeholder, + 'selective' => $selective, + ]); + } } diff --git a/src/Telegram/Game.php b/src/Telegram/Game.php index 5fb685c..ee80272 100644 --- a/src/Telegram/Game.php +++ b/src/Telegram/Game.php @@ -11,54 +11,53 @@ */ class Game extends \Tii\Telepath\Type { - /** Title of the game */ - public string $title; - - /** Description of the game */ - public string $description; - - /** - * Photo that will be displayed in the game message in chats. - * @var PhotoSize[] - */ - public array $photo; - - /** Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. */ - public ?string $text = null; - - /** - * Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc. - * @var MessageEntity[] - */ - public ?array $text_entities = null; - - /** Optional. Animation that will be displayed in the game message in chats. Upload via BotFather */ - public ?Animation $animation = null; - - - /** - * @param string $title Title of the game - * @param string $description Description of the game - * @param PhotoSize[] $photo Photo that will be displayed in the game message in chats. - * @param string $text Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. - * @param MessageEntity[] $text_entities Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc. - * @param Animation $animation Optional. Animation that will be displayed in the game message in chats. Upload via BotFather - */ - public static function make( - string $title, - string $description, - array $photo, - ?string $text = null, - ?array $text_entities = null, - ?Animation $animation = null - ): static { - return new static([ - 'title' => $title, - 'description' => $description, - 'photo' => $photo, - 'text' => $text, - 'text_entities' => $text_entities, - 'animation' => $animation, - ]); - } + /** Title of the game */ + public string $title; + + /** Description of the game */ + public string $description; + + /** + * Photo that will be displayed in the game message in chats. + * @var PhotoSize[] + */ + public array $photo; + + /** Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. */ + public ?string $text = null; + + /** + * Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc. + * @var MessageEntity[] + */ + public ?array $text_entities = null; + + /** Optional. Animation that will be displayed in the game message in chats. Upload via BotFather */ + public ?Animation $animation = null; + + /** + * @param string $title Title of the game + * @param string $description Description of the game + * @param PhotoSize[] $photo Photo that will be displayed in the game message in chats. + * @param string $text Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. + * @param MessageEntity[] $text_entities Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc. + * @param Animation $animation Optional. Animation that will be displayed in the game message in chats. Upload via BotFather + */ + public static function make( + string $title, + string $description, + array $photo, + ?string $text = null, + ?array $text_entities = null, + ?Animation $animation = null + ): static { + return new static([ + 'title' => $title, + 'description' => $description, + 'photo' => $photo, + 'text' => $text, + 'text_entities' => $text_entities, + 'animation' => $animation, + ]); + } } diff --git a/src/Telegram/GameHighScore.php b/src/Telegram/GameHighScore.php index 89ae485..b2051be 100644 --- a/src/Telegram/GameHighScore.php +++ b/src/Telegram/GameHighScore.php @@ -11,27 +11,26 @@ */ class GameHighScore extends \Tii\Telepath\Type { - /** Position in high score table for the game */ - public int $position; + /** Position in high score table for the game */ + public int $position; - /** User */ - public User $user; + /** User */ + public User $user; - /** Score */ - public int $score; + /** Score */ + public int $score; - - /** - * @param int $position Position in high score table for the game - * @param User $user User - * @param int $score Score - */ - public static function make(int $position, User $user, int $score): static - { - return new static([ - 'position' => $position, - 'user' => $user, - 'score' => $score, - ]); - } + /** + * @param int $position Position in high score table for the game + * @param User $user User + * @param int $score Score + */ + public static function make(int $position, User $user, int $score): static + { + return new static([ + 'position' => $position, + 'user' => $user, + 'score' => $score, + ]); + } } diff --git a/src/Telegram/InlineKeyboardButton.php b/src/Telegram/InlineKeyboardButton.php index 57f4dce..baa69ed 100644 --- a/src/Telegram/InlineKeyboardButton.php +++ b/src/Telegram/InlineKeyboardButton.php @@ -11,66 +11,65 @@ */ class InlineKeyboardButton extends \Tii\Telepath\Type { - /** Label text on the button */ - public string $text; + /** Label text on the button */ + public string $text; - /** Optional. HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id= can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */ - public ?string $url = null; + /** Optional. HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id= can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. */ + public ?string $url = null; - /** Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */ - public ?string $callback_data = null; + /** Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes */ + public ?string $callback_data = null; - /** Optional. Description of the Web App 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 answerWebAppQuery. Available only in private chats between a user and the bot. */ - public ?WebAppInfo $web_app = null; + /** Optional. Description of the Web App 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 answerWebAppQuery. Available only in private chats between a user and the bot. */ + public ?WebAppInfo $web_app = null; - /** Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */ - public ?LoginUrl $login_url = null; + /** Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. */ + public ?LoginUrl $login_url = null; - /** Optional. 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. Can be empty, in which case just the bot's username will be inserted.Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen. */ - public ?string $switch_inline_query = null; + /** Optional. 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. Can be empty, in which case just the bot's username will be inserted.Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen. */ + public ?string $switch_inline_query = null; - /** Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. */ - public ?string $switch_inline_query_current_chat = null; + /** Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. */ + public ?string $switch_inline_query_current_chat = null; - /** Optional. Description of the game that will be launched when the user presses the button.NOTE: This type of button must always be the first button in the first row. */ - public ?CallbackGame $callback_game = null; + /** Optional. Description of the game that will be launched when the user presses the button.NOTE: This type of button must always be the first button in the first row. */ + public ?CallbackGame $callback_game = null; - /** Optional. Specify True, to send a Pay button.NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. */ - public ?bool $pay = null; + /** Optional. Specify True, to send a Pay button.NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. */ + public ?bool $pay = null; - - /** - * @param string $text Label text on the button - * @param string $url Optional. HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id= can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. - * @param string $callback_data Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes - * @param WebAppInfo $web_app Optional. Description of the Web App 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 answerWebAppQuery. Available only in private chats between a user and the bot. - * @param LoginUrl $login_url Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. - * @param string $switch_inline_query Optional. 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. Can be empty, in which case just the bot's username will be inserted.Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen. - * @param string $switch_inline_query_current_chat Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. - * @param CallbackGame $callback_game Optional. Description of the game that will be launched when the user presses the button.NOTE: This type of button must always be the first button in the first row. - * @param bool $pay Optional. Specify True, to send a Pay button.NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. - */ - public static function make( - string $text, - ?string $url = null, - ?string $callback_data = null, - ?WebAppInfo $web_app = null, - ?LoginUrl $login_url = null, - ?string $switch_inline_query = null, - ?string $switch_inline_query_current_chat = null, - ?CallbackGame $callback_game = null, - ?bool $pay = null - ): static { - return new static([ - 'text' => $text, - 'url' => $url, - 'callback_data' => $callback_data, - 'web_app' => $web_app, - 'login_url' => $login_url, - 'switch_inline_query' => $switch_inline_query, - 'switch_inline_query_current_chat' => $switch_inline_query_current_chat, - 'callback_game' => $callback_game, - 'pay' => $pay, - ]); - } + /** + * @param string $text Label text on the button + * @param string $url Optional. HTTP or tg:// url to be opened when the button is pressed. Links tg://user?id= can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. + * @param string $callback_data Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes + * @param WebAppInfo $web_app Optional. Description of the Web App 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 answerWebAppQuery. Available only in private chats between a user and the bot. + * @param LoginUrl $login_url Optional. An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget. + * @param string $switch_inline_query Optional. 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. Can be empty, in which case just the bot's username will be inserted.Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen. + * @param string $switch_inline_query_current_chat Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options. + * @param CallbackGame $callback_game Optional. Description of the game that will be launched when the user presses the button.NOTE: This type of button must always be the first button in the first row. + * @param bool $pay Optional. Specify True, to send a Pay button.NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. + */ + public static function make( + string $text, + ?string $url = null, + ?string $callback_data = null, + ?WebAppInfo $web_app = null, + ?LoginUrl $login_url = null, + ?string $switch_inline_query = null, + ?string $switch_inline_query_current_chat = null, + ?CallbackGame $callback_game = null, + ?bool $pay = null + ): static { + return new static([ + 'text' => $text, + 'url' => $url, + 'callback_data' => $callback_data, + 'web_app' => $web_app, + 'login_url' => $login_url, + 'switch_inline_query' => $switch_inline_query, + 'switch_inline_query_current_chat' => $switch_inline_query_current_chat, + 'callback_game' => $callback_game, + 'pay' => $pay, + ]); + } } diff --git a/src/Telegram/InlineKeyboardMarkup.php b/src/Telegram/InlineKeyboardMarkup.php index cb6a7e3..c6d6b33 100644 --- a/src/Telegram/InlineKeyboardMarkup.php +++ b/src/Telegram/InlineKeyboardMarkup.php @@ -11,20 +11,19 @@ */ class InlineKeyboardMarkup extends \Tii\Telepath\Type { - /** - * Array of button rows, each represented by an Array of InlineKeyboardButton objects - * @var InlineKeyboardButton[][] - */ - public array $inline_keyboard; + /** + * Array of button rows, each represented by an Array of InlineKeyboardButton objects + * @var InlineKeyboardButton[][] + */ + public array $inline_keyboard; - - /** - * @param InlineKeyboardButton[][] $inline_keyboard Array of button rows, each represented by an Array of InlineKeyboardButton objects - */ - public static function make(array $inline_keyboard): static - { - return new static([ - 'inline_keyboard' => $inline_keyboard, - ]); - } + /** + * @param InlineKeyboardButton[][] $inline_keyboard Array of button rows, each represented by an Array of InlineKeyboardButton objects + */ + public static function make(array $inline_keyboard): static + { + return new static([ + 'inline_keyboard' => $inline_keyboard, + ]); + } } diff --git a/src/Telegram/InlineQuery.php b/src/Telegram/InlineQuery.php index 70f863c..1632a09 100644 --- a/src/Telegram/InlineQuery.php +++ b/src/Telegram/InlineQuery.php @@ -11,48 +11,47 @@ */ class InlineQuery extends \Tii\Telepath\Type { - /** Unique identifier for this query */ - public string $id; - - /** Sender */ - public User $from; - - /** Text of the query (up to 256 characters) */ - public string $query; - - /** Offset of the results to be returned, can be controlled by the bot */ - public string $offset; - - /** Optional. Type of the chat, from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat */ - public ?string $chat_type = null; - - /** Optional. Sender location, only for bots that request user location */ - public ?Location $location = null; - - - /** - * @param string $id Unique identifier for this query - * @param User $from Sender - * @param string $query Text of the query (up to 256 characters) - * @param string $offset Offset of the results to be returned, can be controlled by the bot - * @param string $chat_type Optional. Type of the chat, from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat - * @param Location $location Optional. Sender location, only for bots that request user location - */ - public static function make( - string $id, - User $from, - string $query, - string $offset, - ?string $chat_type = null, - ?Location $location = null - ): static { - return new static([ - 'id' => $id, - 'from' => $from, - 'query' => $query, - 'offset' => $offset, - 'chat_type' => $chat_type, - 'location' => $location, - ]); - } + /** Unique identifier for this query */ + public string $id; + + /** Sender */ + public User $from; + + /** Text of the query (up to 256 characters) */ + public string $query; + + /** Offset of the results to be returned, can be controlled by the bot */ + public string $offset; + + /** Optional. Type of the chat, from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat */ + public ?string $chat_type = null; + + /** Optional. Sender location, only for bots that request user location */ + public ?Location $location = null; + + /** + * @param string $id Unique identifier for this query + * @param User $from Sender + * @param string $query Text of the query (up to 256 characters) + * @param string $offset Offset of the results to be returned, can be controlled by the bot + * @param string $chat_type Optional. Type of the chat, from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat + * @param Location $location Optional. Sender location, only for bots that request user location + */ + public static function make( + string $id, + User $from, + string $query, + string $offset, + ?string $chat_type = null, + ?Location $location = null + ): static { + return new static([ + 'id' => $id, + 'from' => $from, + 'query' => $query, + 'offset' => $offset, + 'chat_type' => $chat_type, + 'location' => $location, + ]); + } } diff --git a/src/Telegram/InlineQueryResult.php b/src/Telegram/InlineQueryResult.php index bf70b56..47dc7c1 100644 --- a/src/Telegram/InlineQueryResult.php +++ b/src/Telegram/InlineQueryResult.php @@ -11,32 +11,31 @@ */ abstract class InlineQueryResult extends \Tii\Telepath\Type { - /** Type of the result */ - public string $type; + /** Type of the result */ + public string $type; - /** Unique identifier for this result, 1-64 bytes */ - public string $id; + /** Unique identifier for this result, 1-64 bytes */ + public string $id; - /** Optional. Inline keyboard attached to the message */ - public ?InlineKeyboardMarkup $reply_markup = null; + /** Optional. Inline keyboard attached to the message */ + public ?InlineKeyboardMarkup $reply_markup = null; - - public static function factory(array $data): static - { - return match($data['type']) { - 'audio' => new InlineQueryResultAudio($data) - 'document' => new InlineQueryResultDocument($data) - 'gif' => new InlineQueryResultGif($data) - 'mpeg4_gif' => new InlineQueryResultMpeg4Gif($data) - 'photo' => new InlineQueryResultPhoto($data) - 'sticker' => new InlineQueryResultCachedSticker($data) - 'video' => new InlineQueryResultVideo($data) - 'voice' => new InlineQueryResultVoice($data) - 'article' => new InlineQueryResultArticle($data) - 'contact' => new InlineQueryResultContact($data) - 'game' => new InlineQueryResultGame($data) - 'location' => new InlineQueryResultLocation($data) - 'venue' => new InlineQueryResultVenue($data) - }; - } + public static function factory(array $data): static + { + return match($data['type']) { + 'audio' => new InlineQueryResultAudio($data) + 'document' => new InlineQueryResultDocument($data) + 'gif' => new InlineQueryResultGif($data) + 'mpeg4_gif' => new InlineQueryResultMpeg4Gif($data) + 'photo' => new InlineQueryResultPhoto($data) + 'sticker' => new InlineQueryResultCachedSticker($data) + 'video' => new InlineQueryResultVideo($data) + 'voice' => new InlineQueryResultVoice($data) + 'article' => new InlineQueryResultArticle($data) + 'contact' => new InlineQueryResultContact($data) + 'game' => new InlineQueryResultGame($data) + 'location' => new InlineQueryResultLocation($data) + 'venue' => new InlineQueryResultVenue($data) + }; + } } diff --git a/src/Telegram/InlineQueryResultArticle.php b/src/Telegram/InlineQueryResultArticle.php index 375f34b..5c0e245 100644 --- a/src/Telegram/InlineQueryResultArticle.php +++ b/src/Telegram/InlineQueryResultArticle.php @@ -11,69 +11,68 @@ */ class InlineQueryResultArticle extends InlineQueryResult { - /** Type of the result, must be article */ - public string $type = 'article'; + /** Type of the result, must be article */ + public string $type = 'article'; - /** Title of the result */ - public string $title; + /** Title of the result */ + public string $title; - /** Content of the message to be sent */ - public InputMessageContent $input_message_content; + /** Content of the message to be sent */ + public InputMessageContent $input_message_content; - /** Optional. URL of the result */ - public ?string $url = null; + /** Optional. URL of the result */ + public ?string $url = null; - /** Optional. Pass True, if you don't want the URL to be shown in the message */ - public ?bool $hide_url = null; + /** Optional. Pass True, if you don't want the URL to be shown in the message */ + public ?bool $hide_url = null; - /** Optional. Short description of the result */ - public ?string $description = null; + /** Optional. Short description of the result */ + public ?string $description = null; - /** Optional. Url of the thumbnail for the result */ - public ?string $thumb_url = null; + /** Optional. Url of the thumbnail for the result */ + public ?string $thumb_url = null; - /** Optional. Thumbnail width */ - public ?int $thumb_width = null; + /** Optional. Thumbnail width */ + public ?int $thumb_width = null; - /** Optional. Thumbnail height */ - public ?int $thumb_height = null; + /** Optional. Thumbnail height */ + public ?int $thumb_height = null; - - /** - * @param string $id Unique identifier for this result, 1-64 Bytes - * @param string $title Title of the result - * @param InputMessageContent $input_message_content Content of the message to be sent - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param string $url Optional. URL of the result - * @param bool $hide_url Optional. Pass True, if you don't want the URL to be shown in the message - * @param string $description Optional. Short description of the result - * @param string $thumb_url Optional. Url of the thumbnail for the result - * @param int $thumb_width Optional. Thumbnail width - * @param int $thumb_height Optional. Thumbnail height - */ - public static function make( - string $id, - string $title, - InputMessageContent $input_message_content, - ?InlineKeyboardMarkup $reply_markup = null, - ?string $url = null, - ?bool $hide_url = null, - ?string $description = null, - ?string $thumb_url = null, - ?int $thumb_width = null, - ?int $thumb_height = null - ): static { - return new static([ - 'id' => $id, - 'title' => $title, - 'input_message_content' => $input_message_content, - 'reply_markup' => $reply_markup, - 'url' => $url, - 'hide_url' => $hide_url, - 'description' => $description, - 'thumb_url' => $thumb_url, - 'thumb_width' => $thumb_width, - 'thumb_height' => $thumb_height, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 Bytes + * @param string $title Title of the result + * @param InputMessageContent $input_message_content Content of the message to be sent + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param string $url Optional. URL of the result + * @param bool $hide_url Optional. Pass True, if you don't want the URL to be shown in the message + * @param string $description Optional. Short description of the result + * @param string $thumb_url Optional. Url of the thumbnail for the result + * @param int $thumb_width Optional. Thumbnail width + * @param int $thumb_height Optional. Thumbnail height + */ + public static function make( + string $id, + string $title, + InputMessageContent $input_message_content, + ?InlineKeyboardMarkup $reply_markup = null, + ?string $url = null, + ?bool $hide_url = null, + ?string $description = null, + ?string $thumb_url = null, + ?int $thumb_width = null, + ?int $thumb_height = null + ): static { + return new static([ + 'id' => $id, + 'title' => $title, + 'input_message_content' => $input_message_content, + 'reply_markup' => $reply_markup, + 'url' => $url, + 'hide_url' => $hide_url, + 'description' => $description, + 'thumb_url' => $thumb_url, + 'thumb_width' => $thumb_width, + 'thumb_height' => $thumb_height, + ]); + } } diff --git a/src/Telegram/InlineQueryResultAudio.php b/src/Telegram/InlineQueryResultAudio.php index a3af780..9368d9d 100644 --- a/src/Telegram/InlineQueryResultAudio.php +++ b/src/Telegram/InlineQueryResultAudio.php @@ -11,72 +11,71 @@ */ class InlineQueryResultAudio extends InlineQueryResult { - /** Type of the result, must be audio */ - public string $type = 'audio'; + /** Type of the result, must be audio */ + public string $type = 'audio'; - /** A valid URL for the audio file */ - public string $audio_url; + /** A valid URL for the audio file */ + public string $audio_url; - /** Title */ - public string $title; + /** Title */ + public string $title; - /** Optional. Caption, 0-1024 characters after entities parsing */ - public ?string $caption = null; + /** Optional. Caption, 0-1024 characters after entities parsing */ + public ?string $caption = null; - /** Optional. Mode for parsing entities in the audio caption. See formatting options for more details. */ - public ?string $parse_mode = null; + /** Optional. Mode for parsing entities in the audio caption. See formatting options for more details. */ + public ?string $parse_mode = null; - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Performer */ - public ?string $performer = null; + /** Optional. Performer */ + public ?string $performer = null; - /** Optional. Audio duration in seconds */ - public ?int $audio_duration = null; + /** Optional. Audio duration in seconds */ + public ?int $audio_duration = null; - /** Optional. Content of the message to be sent instead of the audio */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the audio */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $audio_url A valid URL for the audio file - * @param string $title Title - * @param string $caption Optional. Caption, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the audio caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param string $performer Optional. Performer - * @param int $audio_duration Optional. Audio duration in seconds - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the audio - */ - public static function make( - string $id, - string $audio_url, - string $title, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?string $performer = null, - ?int $audio_duration = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'audio_url' => $audio_url, - 'title' => $title, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'performer' => $performer, - 'audio_duration' => $audio_duration, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $audio_url A valid URL for the audio file + * @param string $title Title + * @param string $caption Optional. Caption, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the audio caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param string $performer Optional. Performer + * @param int $audio_duration Optional. Audio duration in seconds + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the audio + */ + public static function make( + string $id, + string $audio_url, + string $title, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?string $performer = null, + ?int $audio_duration = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'audio_url' => $audio_url, + 'title' => $title, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'performer' => $performer, + 'audio_duration' => $audio_duration, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultCachedAudio.php b/src/Telegram/InlineQueryResultCachedAudio.php index 1af4aec..3837aa2 100644 --- a/src/Telegram/InlineQueryResultCachedAudio.php +++ b/src/Telegram/InlineQueryResultCachedAudio.php @@ -11,54 +11,53 @@ */ class InlineQueryResultCachedAudio extends InlineQueryResult { - /** Type of the result, must be audio */ - public string $type = 'audio'; - - /** A valid file identifier for the audio file */ - public string $audio_file_id; - - /** Optional. Caption, 0-1024 characters after entities parsing */ - public ?string $caption = null; - - /** Optional. Mode for parsing entities in the audio caption. See formatting options for more details. */ - public ?string $parse_mode = null; - - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; - - /** Optional. Content of the message to be sent instead of the audio */ - public ?InputMessageContent $input_message_content = null; - - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $audio_file_id A valid file identifier for the audio file - * @param string $caption Optional. Caption, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the audio caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the audio - */ - public static function make( - string $id, - string $audio_file_id, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'audio_file_id' => $audio_file_id, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** Type of the result, must be audio */ + public string $type = 'audio'; + + /** A valid file identifier for the audio file */ + public string $audio_file_id; + + /** Optional. Caption, 0-1024 characters after entities parsing */ + public ?string $caption = null; + + /** Optional. Mode for parsing entities in the audio caption. See formatting options for more details. */ + public ?string $parse_mode = null; + + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; + + /** Optional. Content of the message to be sent instead of the audio */ + public ?InputMessageContent $input_message_content = null; + + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $audio_file_id A valid file identifier for the audio file + * @param string $caption Optional. Caption, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the audio caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the audio + */ + public static function make( + string $id, + string $audio_file_id, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'audio_file_id' => $audio_file_id, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultCachedDocument.php b/src/Telegram/InlineQueryResultCachedDocument.php index 7899bff..8a00c85 100644 --- a/src/Telegram/InlineQueryResultCachedDocument.php +++ b/src/Telegram/InlineQueryResultCachedDocument.php @@ -11,66 +11,65 @@ */ class InlineQueryResultCachedDocument extends InlineQueryResult { - /** Type of the result, must be document */ - public string $type = 'document'; + /** Type of the result, must be document */ + public string $type = 'document'; - /** Title for the result */ - public string $title; + /** Title for the result */ + public string $title; - /** A valid file identifier for the file */ - public string $document_file_id; + /** A valid file identifier for the file */ + public string $document_file_id; - /** Optional. Short description of the result */ - public ?string $description = null; + /** Optional. Short description of the result */ + public ?string $description = null; - /** Optional. Caption of the document to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; + /** Optional. Caption of the document to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; - /** Optional. Mode for parsing entities in the document caption. See formatting options for more details. */ - public ?string $parse_mode = null; + /** Optional. Mode for parsing entities in the document caption. See formatting options for more details. */ + public ?string $parse_mode = null; - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Content of the message to be sent instead of the file */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the file */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $title Title for the result - * @param string $document_file_id A valid file identifier for the file - * @param string $description Optional. Short description of the result - * @param string $caption Optional. Caption of the document to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the document caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the file - */ - public static function make( - string $id, - string $title, - string $document_file_id, - ?string $description = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'title' => $title, - 'document_file_id' => $document_file_id, - 'description' => $description, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $title Title for the result + * @param string $document_file_id A valid file identifier for the file + * @param string $description Optional. Short description of the result + * @param string $caption Optional. Caption of the document to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the document caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the file + */ + public static function make( + string $id, + string $title, + string $document_file_id, + ?string $description = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'title' => $title, + 'document_file_id' => $document_file_id, + 'description' => $description, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultCachedGif.php b/src/Telegram/InlineQueryResultCachedGif.php index 2d62a18..d03fe81 100644 --- a/src/Telegram/InlineQueryResultCachedGif.php +++ b/src/Telegram/InlineQueryResultCachedGif.php @@ -11,60 +11,59 @@ */ class InlineQueryResultCachedGif extends InlineQueryResult { - /** Type of the result, must be gif */ - public string $type = 'gif'; + /** Type of the result, must be gif */ + public string $type = 'gif'; - /** A valid file identifier for the GIF file */ - public string $gif_file_id; + /** A valid file identifier for the GIF file */ + public string $gif_file_id; - /** Optional. Title for the result */ - public ?string $title = null; + /** Optional. Title for the result */ + public ?string $title = null; - /** Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; + /** Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; - /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */ - public ?string $parse_mode = null; + /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */ + public ?string $parse_mode = null; - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Content of the message to be sent instead of the GIF animation */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the GIF animation */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $gif_file_id A valid file identifier for the GIF file - * @param string $title Optional. Title for the result - * @param string $caption Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the GIF animation - */ - public static function make( - string $id, - string $gif_file_id, - ?string $title = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'gif_file_id' => $gif_file_id, - 'title' => $title, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $gif_file_id A valid file identifier for the GIF file + * @param string $title Optional. Title for the result + * @param string $caption Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the GIF animation + */ + public static function make( + string $id, + string $gif_file_id, + ?string $title = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'gif_file_id' => $gif_file_id, + 'title' => $title, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultCachedMpeg4Gif.php b/src/Telegram/InlineQueryResultCachedMpeg4Gif.php index 9f1ad05..914a70c 100644 --- a/src/Telegram/InlineQueryResultCachedMpeg4Gif.php +++ b/src/Telegram/InlineQueryResultCachedMpeg4Gif.php @@ -11,60 +11,59 @@ */ class InlineQueryResultCachedMpeg4Gif extends InlineQueryResult { - /** Type of the result, must be mpeg4_gif */ - public string $type = 'mpeg4_gif'; + /** Type of the result, must be mpeg4_gif */ + public string $type = 'mpeg4_gif'; - /** A valid file identifier for the MP4 file */ - public string $mpeg4_file_id; + /** A valid file identifier for the MP4 file */ + public string $mpeg4_file_id; - /** Optional. Title for the result */ - public ?string $title = null; + /** Optional. Title for the result */ + public ?string $title = null; - /** Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; + /** Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; - /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */ - public ?string $parse_mode = null; + /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */ + public ?string $parse_mode = null; - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Content of the message to be sent instead of the video animation */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the video animation */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $mpeg4_file_id A valid file identifier for the MP4 file - * @param string $title Optional. Title for the result - * @param string $caption Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the video animation - */ - public static function make( - string $id, - string $mpeg4_file_id, - ?string $title = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'mpeg4_file_id' => $mpeg4_file_id, - 'title' => $title, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $mpeg4_file_id A valid file identifier for the MP4 file + * @param string $title Optional. Title for the result + * @param string $caption Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the video animation + */ + public static function make( + string $id, + string $mpeg4_file_id, + ?string $title = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'mpeg4_file_id' => $mpeg4_file_id, + 'title' => $title, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultCachedPhoto.php b/src/Telegram/InlineQueryResultCachedPhoto.php index 1361293..6ed784b 100644 --- a/src/Telegram/InlineQueryResultCachedPhoto.php +++ b/src/Telegram/InlineQueryResultCachedPhoto.php @@ -11,66 +11,65 @@ */ class InlineQueryResultCachedPhoto extends InlineQueryResult { - /** Type of the result, must be photo */ - public string $type = 'photo'; + /** Type of the result, must be photo */ + public string $type = 'photo'; - /** A valid file identifier of the photo */ - public string $photo_file_id; + /** A valid file identifier of the photo */ + public string $photo_file_id; - /** Optional. Title for the result */ - public ?string $title = null; + /** Optional. Title for the result */ + public ?string $title = null; - /** Optional. Short description of the result */ - public ?string $description = null; + /** Optional. Short description of the result */ + public ?string $description = null; - /** Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; + /** Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; - /** Optional. Mode for parsing entities in the photo caption. See formatting options for more details. */ - public ?string $parse_mode = null; + /** Optional. Mode for parsing entities in the photo caption. See formatting options for more details. */ + public ?string $parse_mode = null; - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Content of the message to be sent instead of the photo */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the photo */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $photo_file_id A valid file identifier of the photo - * @param string $title Optional. Title for the result - * @param string $description Optional. Short description of the result - * @param string $caption Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the photo caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the photo - */ - public static function make( - string $id, - string $photo_file_id, - ?string $title = null, - ?string $description = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'photo_file_id' => $photo_file_id, - 'title' => $title, - 'description' => $description, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $photo_file_id A valid file identifier of the photo + * @param string $title Optional. Title for the result + * @param string $description Optional. Short description of the result + * @param string $caption Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the photo caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the photo + */ + public static function make( + string $id, + string $photo_file_id, + ?string $title = null, + ?string $description = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'photo_file_id' => $photo_file_id, + 'title' => $title, + 'description' => $description, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultCachedSticker.php b/src/Telegram/InlineQueryResultCachedSticker.php index 6a89521..b8f9b13 100644 --- a/src/Telegram/InlineQueryResultCachedSticker.php +++ b/src/Telegram/InlineQueryResultCachedSticker.php @@ -11,33 +11,32 @@ */ class InlineQueryResultCachedSticker extends InlineQueryResult { - /** Type of the result, must be sticker */ - public string $type = 'sticker'; + /** Type of the result, must be sticker */ + public string $type = 'sticker'; - /** A valid file identifier of the sticker */ - public string $sticker_file_id; + /** A valid file identifier of the sticker */ + public string $sticker_file_id; - /** Optional. Content of the message to be sent instead of the sticker */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the sticker */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $sticker_file_id A valid file identifier of the sticker - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the sticker - */ - public static function make( - string $id, - string $sticker_file_id, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'sticker_file_id' => $sticker_file_id, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $sticker_file_id A valid file identifier of the sticker + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the sticker + */ + public static function make( + string $id, + string $sticker_file_id, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'sticker_file_id' => $sticker_file_id, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultCachedVideo.php b/src/Telegram/InlineQueryResultCachedVideo.php index 6d071b9..a09472d 100644 --- a/src/Telegram/InlineQueryResultCachedVideo.php +++ b/src/Telegram/InlineQueryResultCachedVideo.php @@ -11,66 +11,65 @@ */ class InlineQueryResultCachedVideo extends InlineQueryResult { - /** Type of the result, must be video */ - public string $type = 'video'; + /** Type of the result, must be video */ + public string $type = 'video'; - /** A valid file identifier for the video file */ - public string $video_file_id; + /** A valid file identifier for the video file */ + public string $video_file_id; - /** Title for the result */ - public string $title; + /** Title for the result */ + public string $title; - /** Optional. Short description of the result */ - public ?string $description = null; + /** Optional. Short description of the result */ + public ?string $description = null; - /** Optional. Caption of the video to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; + /** Optional. Caption of the video to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; - /** Optional. Mode for parsing entities in the video caption. See formatting options for more details. */ - public ?string $parse_mode = null; + /** Optional. Mode for parsing entities in the video caption. See formatting options for more details. */ + public ?string $parse_mode = null; - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Content of the message to be sent instead of the video */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the video */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $video_file_id A valid file identifier for the video file - * @param string $title Title for the result - * @param string $description Optional. Short description of the result - * @param string $caption Optional. Caption of the video to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the video caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the video - */ - public static function make( - string $id, - string $video_file_id, - string $title, - ?string $description = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'video_file_id' => $video_file_id, - 'title' => $title, - 'description' => $description, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $video_file_id A valid file identifier for the video file + * @param string $title Title for the result + * @param string $description Optional. Short description of the result + * @param string $caption Optional. Caption of the video to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the video caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the video + */ + public static function make( + string $id, + string $video_file_id, + string $title, + ?string $description = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'video_file_id' => $video_file_id, + 'title' => $title, + 'description' => $description, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultCachedVoice.php b/src/Telegram/InlineQueryResultCachedVoice.php index 4a13b30..9aa4437 100644 --- a/src/Telegram/InlineQueryResultCachedVoice.php +++ b/src/Telegram/InlineQueryResultCachedVoice.php @@ -11,60 +11,59 @@ */ class InlineQueryResultCachedVoice extends InlineQueryResult { - /** Type of the result, must be voice */ - public string $type = 'voice'; + /** Type of the result, must be voice */ + public string $type = 'voice'; - /** A valid file identifier for the voice message */ - public string $voice_file_id; + /** A valid file identifier for the voice message */ + public string $voice_file_id; - /** Voice message title */ - public string $title; + /** Voice message title */ + public string $title; - /** Optional. Caption, 0-1024 characters after entities parsing */ - public ?string $caption = null; + /** Optional. Caption, 0-1024 characters after entities parsing */ + public ?string $caption = null; - /** Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. */ - public ?string $parse_mode = null; + /** Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. */ + public ?string $parse_mode = null; - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Content of the message to be sent instead of the voice message */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the voice message */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $voice_file_id A valid file identifier for the voice message - * @param string $title Voice message title - * @param string $caption Optional. Caption, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the voice message - */ - public static function make( - string $id, - string $voice_file_id, - string $title, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'voice_file_id' => $voice_file_id, - 'title' => $title, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $voice_file_id A valid file identifier for the voice message + * @param string $title Voice message title + * @param string $caption Optional. Caption, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the voice message + */ + public static function make( + string $id, + string $voice_file_id, + string $title, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'voice_file_id' => $voice_file_id, + 'title' => $title, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultContact.php b/src/Telegram/InlineQueryResultContact.php index 6921f71..a233454 100644 --- a/src/Telegram/InlineQueryResultContact.php +++ b/src/Telegram/InlineQueryResultContact.php @@ -11,69 +11,68 @@ */ class InlineQueryResultContact extends InlineQueryResult { - /** Type of the result, must be contact */ - public string $type = 'contact'; + /** Type of the result, must be contact */ + public string $type = 'contact'; - /** Contact's phone number */ - public string $phone_number; + /** Contact's phone number */ + public string $phone_number; - /** Contact's first name */ - public string $first_name; + /** Contact's first name */ + public string $first_name; - /** Optional. Contact's last name */ - public ?string $last_name = null; + /** Optional. Contact's last name */ + public ?string $last_name = null; - /** Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes */ - public ?string $vcard = null; + /** Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes */ + public ?string $vcard = null; - /** Optional. Content of the message to be sent instead of the contact */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the contact */ + public ?InputMessageContent $input_message_content = null; - /** Optional. Url of the thumbnail for the result */ - public ?string $thumb_url = null; + /** Optional. Url of the thumbnail for the result */ + public ?string $thumb_url = null; - /** Optional. Thumbnail width */ - public ?int $thumb_width = null; + /** Optional. Thumbnail width */ + public ?int $thumb_width = null; - /** Optional. Thumbnail height */ - public ?int $thumb_height = null; + /** Optional. Thumbnail height */ + public ?int $thumb_height = null; - - /** - * @param string $id Unique identifier for this result, 1-64 Bytes - * @param string $phone_number Contact's phone number - * @param string $first_name Contact's first name - * @param string $last_name Optional. Contact's last name - * @param string $vcard Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the contact - * @param string $thumb_url Optional. Url of the thumbnail for the result - * @param int $thumb_width Optional. Thumbnail width - * @param int $thumb_height Optional. Thumbnail height - */ - public static function make( - string $id, - string $phone_number, - string $first_name, - ?string $last_name = null, - ?string $vcard = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null, - ?string $thumb_url = null, - ?int $thumb_width = null, - ?int $thumb_height = null - ): static { - return new static([ - 'id' => $id, - 'phone_number' => $phone_number, - 'first_name' => $first_name, - 'last_name' => $last_name, - 'vcard' => $vcard, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - 'thumb_url' => $thumb_url, - 'thumb_width' => $thumb_width, - 'thumb_height' => $thumb_height, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 Bytes + * @param string $phone_number Contact's phone number + * @param string $first_name Contact's first name + * @param string $last_name Optional. Contact's last name + * @param string $vcard Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the contact + * @param string $thumb_url Optional. Url of the thumbnail for the result + * @param int $thumb_width Optional. Thumbnail width + * @param int $thumb_height Optional. Thumbnail height + */ + public static function make( + string $id, + string $phone_number, + string $first_name, + ?string $last_name = null, + ?string $vcard = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null, + ?string $thumb_url = null, + ?int $thumb_width = null, + ?int $thumb_height = null + ): static { + return new static([ + 'id' => $id, + 'phone_number' => $phone_number, + 'first_name' => $first_name, + 'last_name' => $last_name, + 'vcard' => $vcard, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + 'thumb_url' => $thumb_url, + 'thumb_width' => $thumb_width, + 'thumb_height' => $thumb_height, + ]); + } } diff --git a/src/Telegram/InlineQueryResultDocument.php b/src/Telegram/InlineQueryResultDocument.php index fe34ea7..cd37251 100644 --- a/src/Telegram/InlineQueryResultDocument.php +++ b/src/Telegram/InlineQueryResultDocument.php @@ -11,90 +11,89 @@ */ class InlineQueryResultDocument extends InlineQueryResult { - /** Type of the result, must be document */ - public string $type = 'document'; - - /** Title for the result */ - public string $title; - - /** A valid URL for the file */ - public string $document_url; - - /** Mime type of the content of the file, either “application/pdf” or “application/zip” */ - public string $mime_type; - - /** Optional. Caption of the document to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; - - /** Optional. Mode for parsing entities in the document caption. See formatting options for more details. */ - public ?string $parse_mode = null; - - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; - - /** Optional. Short description of the result */ - public ?string $description = null; - - /** Optional. Content of the message to be sent instead of the file */ - public ?InputMessageContent $input_message_content = null; - - /** Optional. URL of the thumbnail (JPEG only) for the file */ - public ?string $thumb_url = null; - - /** Optional. Thumbnail width */ - public ?int $thumb_width = null; - - /** Optional. Thumbnail height */ - public ?int $thumb_height = null; - - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $title Title for the result - * @param string $document_url A valid URL for the file - * @param string $mime_type Mime type of the content of the file, either “application/pdf” or “application/zip” - * @param string $caption Optional. Caption of the document to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the document caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param string $description Optional. Short description of the result - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the file - * @param string $thumb_url Optional. URL of the thumbnail (JPEG only) for the file - * @param int $thumb_width Optional. Thumbnail width - * @param int $thumb_height Optional. Thumbnail height - */ - public static function make( - string $id, - string $title, - string $document_url, - string $mime_type, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?string $description = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null, - ?string $thumb_url = null, - ?int $thumb_width = null, - ?int $thumb_height = null - ): static { - return new static([ - 'id' => $id, - 'title' => $title, - 'document_url' => $document_url, - 'mime_type' => $mime_type, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'description' => $description, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - 'thumb_url' => $thumb_url, - 'thumb_width' => $thumb_width, - 'thumb_height' => $thumb_height, - ]); - } + /** Type of the result, must be document */ + public string $type = 'document'; + + /** Title for the result */ + public string $title; + + /** A valid URL for the file */ + public string $document_url; + + /** Mime type of the content of the file, either “application/pdf” or “application/zip” */ + public string $mime_type; + + /** Optional. Caption of the document to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; + + /** Optional. Mode for parsing entities in the document caption. See formatting options for more details. */ + public ?string $parse_mode = null; + + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; + + /** Optional. Short description of the result */ + public ?string $description = null; + + /** Optional. Content of the message to be sent instead of the file */ + public ?InputMessageContent $input_message_content = null; + + /** Optional. URL of the thumbnail (JPEG only) for the file */ + public ?string $thumb_url = null; + + /** Optional. Thumbnail width */ + public ?int $thumb_width = null; + + /** Optional. Thumbnail height */ + public ?int $thumb_height = null; + + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $title Title for the result + * @param string $document_url A valid URL for the file + * @param string $mime_type Mime type of the content of the file, either “application/pdf” or “application/zip” + * @param string $caption Optional. Caption of the document to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the document caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param string $description Optional. Short description of the result + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the file + * @param string $thumb_url Optional. URL of the thumbnail (JPEG only) for the file + * @param int $thumb_width Optional. Thumbnail width + * @param int $thumb_height Optional. Thumbnail height + */ + public static function make( + string $id, + string $title, + string $document_url, + string $mime_type, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?string $description = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null, + ?string $thumb_url = null, + ?int $thumb_width = null, + ?int $thumb_height = null + ): static { + return new static([ + 'id' => $id, + 'title' => $title, + 'document_url' => $document_url, + 'mime_type' => $mime_type, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'description' => $description, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + 'thumb_url' => $thumb_url, + 'thumb_width' => $thumb_width, + 'thumb_height' => $thumb_height, + ]); + } } diff --git a/src/Telegram/InlineQueryResultGame.php b/src/Telegram/InlineQueryResultGame.php index c02f712..2e7a3e2 100644 --- a/src/Telegram/InlineQueryResultGame.php +++ b/src/Telegram/InlineQueryResultGame.php @@ -11,24 +11,23 @@ */ class InlineQueryResultGame extends InlineQueryResult { - /** Type of the result, must be game */ - public string $type = 'game'; + /** Type of the result, must be game */ + public string $type = 'game'; - /** Short name of the game */ - public string $game_short_name; + /** Short name of the game */ + public string $game_short_name; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $game_short_name Short name of the game - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - */ - public static function make(string $id, string $game_short_name, ?InlineKeyboardMarkup $reply_markup = null): static - { - return new static([ - 'id' => $id, - 'game_short_name' => $game_short_name, - 'reply_markup' => $reply_markup, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $game_short_name Short name of the game + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + */ + public static function make(string $id, string $game_short_name, ?InlineKeyboardMarkup $reply_markup = null): static + { + return new static([ + 'id' => $id, + 'game_short_name' => $game_short_name, + 'reply_markup' => $reply_markup, + ]); + } } diff --git a/src/Telegram/InlineQueryResultGif.php b/src/Telegram/InlineQueryResultGif.php index 493270f..6322c6f 100644 --- a/src/Telegram/InlineQueryResultGif.php +++ b/src/Telegram/InlineQueryResultGif.php @@ -11,90 +11,89 @@ */ class InlineQueryResultGif extends InlineQueryResult { - /** Type of the result, must be gif */ - public string $type = 'gif'; - - /** A valid URL for the GIF file. File size must not exceed 1MB */ - public string $gif_url; - - /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */ - public string $thumb_url; - - /** Optional. Width of the GIF */ - public ?int $gif_width = null; - - /** Optional. Height of the GIF */ - public ?int $gif_height = null; - - /** Optional. Duration of the GIF in seconds */ - public ?int $gif_duration = null; - - /** Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */ - public ?string $thumb_mime_type = null; - - /** Optional. Title for the result */ - public ?string $title = null; - - /** Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; - - /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */ - public ?string $parse_mode = null; - - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; - - /** Optional. Content of the message to be sent instead of the GIF animation */ - public ?InputMessageContent $input_message_content = null; - - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $gif_url A valid URL for the GIF file. File size must not exceed 1MB - * @param string $thumb_url URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result - * @param int $gif_width Optional. Width of the GIF - * @param int $gif_height Optional. Height of the GIF - * @param int $gif_duration Optional. Duration of the GIF in seconds - * @param string $thumb_mime_type Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” - * @param string $title Optional. Title for the result - * @param string $caption Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the GIF animation - */ - public static function make( - string $id, - string $gif_url, - string $thumb_url, - ?int $gif_width = null, - ?int $gif_height = null, - ?int $gif_duration = null, - ?string $thumb_mime_type = null, - ?string $title = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'gif_url' => $gif_url, - 'thumb_url' => $thumb_url, - 'gif_width' => $gif_width, - 'gif_height' => $gif_height, - 'gif_duration' => $gif_duration, - 'thumb_mime_type' => $thumb_mime_type, - 'title' => $title, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** Type of the result, must be gif */ + public string $type = 'gif'; + + /** A valid URL for the GIF file. File size must not exceed 1MB */ + public string $gif_url; + + /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */ + public string $thumb_url; + + /** Optional. Width of the GIF */ + public ?int $gif_width = null; + + /** Optional. Height of the GIF */ + public ?int $gif_height = null; + + /** Optional. Duration of the GIF in seconds */ + public ?int $gif_duration = null; + + /** Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */ + public ?string $thumb_mime_type = null; + + /** Optional. Title for the result */ + public ?string $title = null; + + /** Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; + + /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */ + public ?string $parse_mode = null; + + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; + + /** Optional. Content of the message to be sent instead of the GIF animation */ + public ?InputMessageContent $input_message_content = null; + + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $gif_url A valid URL for the GIF file. File size must not exceed 1MB + * @param string $thumb_url URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result + * @param int $gif_width Optional. Width of the GIF + * @param int $gif_height Optional. Height of the GIF + * @param int $gif_duration Optional. Duration of the GIF in seconds + * @param string $thumb_mime_type Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” + * @param string $title Optional. Title for the result + * @param string $caption Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the GIF animation + */ + public static function make( + string $id, + string $gif_url, + string $thumb_url, + ?int $gif_width = null, + ?int $gif_height = null, + ?int $gif_duration = null, + ?string $thumb_mime_type = null, + ?string $title = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'gif_url' => $gif_url, + 'thumb_url' => $thumb_url, + 'gif_width' => $gif_width, + 'gif_height' => $gif_height, + 'gif_duration' => $gif_duration, + 'thumb_mime_type' => $thumb_mime_type, + 'title' => $title, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultLocation.php b/src/Telegram/InlineQueryResultLocation.php index afb7386..1fc4e60 100644 --- a/src/Telegram/InlineQueryResultLocation.php +++ b/src/Telegram/InlineQueryResultLocation.php @@ -11,87 +11,86 @@ */ class InlineQueryResultLocation extends InlineQueryResult { - /** Type of the result, must be location */ - public string $type = 'location'; - - /** Location latitude in degrees */ - public float $latitude; - - /** Location longitude in degrees */ - public float $longitude; - - /** Location title */ - public string $title; - - /** Optional. The radius of uncertainty for the location, measured in meters; 0-1500 */ - public ?float $horizontal_accuracy = null; - - /** Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. */ - public ?int $live_period = null; - - /** Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */ - public ?int $heading = null; - - /** Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */ - public ?int $proximity_alert_radius = null; - - /** Optional. Content of the message to be sent instead of the location */ - public ?InputMessageContent $input_message_content = null; - - /** Optional. Url of the thumbnail for the result */ - public ?string $thumb_url = null; - - /** Optional. Thumbnail width */ - public ?int $thumb_width = null; - - /** Optional. Thumbnail height */ - public ?int $thumb_height = null; - - - /** - * @param string $id Unique identifier for this result, 1-64 Bytes - * @param float $latitude Location latitude in degrees - * @param float $longitude Location longitude in degrees - * @param string $title Location title - * @param float $horizontal_accuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500 - * @param int $live_period Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. - * @param int $heading Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. - * @param int $proximity_alert_radius Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the location - * @param string $thumb_url Optional. Url of the thumbnail for the result - * @param int $thumb_width Optional. Thumbnail width - * @param int $thumb_height Optional. Thumbnail height - */ - public static function make( - string $id, - float $latitude, - float $longitude, - string $title, - ?float $horizontal_accuracy = null, - ?int $live_period = null, - ?int $heading = null, - ?int $proximity_alert_radius = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null, - ?string $thumb_url = null, - ?int $thumb_width = null, - ?int $thumb_height = null - ): static { - return new static([ - 'id' => $id, - 'latitude' => $latitude, - 'longitude' => $longitude, - 'title' => $title, - 'horizontal_accuracy' => $horizontal_accuracy, - 'live_period' => $live_period, - 'heading' => $heading, - 'proximity_alert_radius' => $proximity_alert_radius, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - 'thumb_url' => $thumb_url, - 'thumb_width' => $thumb_width, - 'thumb_height' => $thumb_height, - ]); - } + /** Type of the result, must be location */ + public string $type = 'location'; + + /** Location latitude in degrees */ + public float $latitude; + + /** Location longitude in degrees */ + public float $longitude; + + /** Location title */ + public string $title; + + /** Optional. The radius of uncertainty for the location, measured in meters; 0-1500 */ + public ?float $horizontal_accuracy = null; + + /** Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. */ + public ?int $live_period = null; + + /** Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */ + public ?int $heading = null; + + /** Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */ + public ?int $proximity_alert_radius = null; + + /** Optional. Content of the message to be sent instead of the location */ + public ?InputMessageContent $input_message_content = null; + + /** Optional. Url of the thumbnail for the result */ + public ?string $thumb_url = null; + + /** Optional. Thumbnail width */ + public ?int $thumb_width = null; + + /** Optional. Thumbnail height */ + public ?int $thumb_height = null; + + /** + * @param string $id Unique identifier for this result, 1-64 Bytes + * @param float $latitude Location latitude in degrees + * @param float $longitude Location longitude in degrees + * @param string $title Location title + * @param float $horizontal_accuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500 + * @param int $live_period Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. + * @param int $heading Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. + * @param int $proximity_alert_radius Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the location + * @param string $thumb_url Optional. Url of the thumbnail for the result + * @param int $thumb_width Optional. Thumbnail width + * @param int $thumb_height Optional. Thumbnail height + */ + public static function make( + string $id, + float $latitude, + float $longitude, + string $title, + ?float $horizontal_accuracy = null, + ?int $live_period = null, + ?int $heading = null, + ?int $proximity_alert_radius = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null, + ?string $thumb_url = null, + ?int $thumb_width = null, + ?int $thumb_height = null + ): static { + return new static([ + 'id' => $id, + 'latitude' => $latitude, + 'longitude' => $longitude, + 'title' => $title, + 'horizontal_accuracy' => $horizontal_accuracy, + 'live_period' => $live_period, + 'heading' => $heading, + 'proximity_alert_radius' => $proximity_alert_radius, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + 'thumb_url' => $thumb_url, + 'thumb_width' => $thumb_width, + 'thumb_height' => $thumb_height, + ]); + } } diff --git a/src/Telegram/InlineQueryResultMpeg4Gif.php b/src/Telegram/InlineQueryResultMpeg4Gif.php index 0132373..9ae1102 100644 --- a/src/Telegram/InlineQueryResultMpeg4Gif.php +++ b/src/Telegram/InlineQueryResultMpeg4Gif.php @@ -11,90 +11,89 @@ */ class InlineQueryResultMpeg4Gif extends InlineQueryResult { - /** Type of the result, must be mpeg4_gif */ - public string $type = 'mpeg4_gif'; - - /** A valid URL for the MP4 file. File size must not exceed 1MB */ - public string $mpeg4_url; - - /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */ - public string $thumb_url; - - /** Optional. Video width */ - public ?int $mpeg4_width = null; - - /** Optional. Video height */ - public ?int $mpeg4_height = null; - - /** Optional. Video duration in seconds */ - public ?int $mpeg4_duration = null; - - /** Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */ - public ?string $thumb_mime_type = null; - - /** Optional. Title for the result */ - public ?string $title = null; - - /** Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; - - /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */ - public ?string $parse_mode = null; - - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; - - /** Optional. Content of the message to be sent instead of the video animation */ - public ?InputMessageContent $input_message_content = null; - - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $mpeg4_url A valid URL for the MP4 file. File size must not exceed 1MB - * @param string $thumb_url URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result - * @param int $mpeg4_width Optional. Video width - * @param int $mpeg4_height Optional. Video height - * @param int $mpeg4_duration Optional. Video duration in seconds - * @param string $thumb_mime_type Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” - * @param string $title Optional. Title for the result - * @param string $caption Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the video animation - */ - public static function make( - string $id, - string $mpeg4_url, - string $thumb_url, - ?int $mpeg4_width = null, - ?int $mpeg4_height = null, - ?int $mpeg4_duration = null, - ?string $thumb_mime_type = null, - ?string $title = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'mpeg4_url' => $mpeg4_url, - 'thumb_url' => $thumb_url, - 'mpeg4_width' => $mpeg4_width, - 'mpeg4_height' => $mpeg4_height, - 'mpeg4_duration' => $mpeg4_duration, - 'thumb_mime_type' => $thumb_mime_type, - 'title' => $title, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** Type of the result, must be mpeg4_gif */ + public string $type = 'mpeg4_gif'; + + /** A valid URL for the MP4 file. File size must not exceed 1MB */ + public string $mpeg4_url; + + /** URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result */ + public string $thumb_url; + + /** Optional. Video width */ + public ?int $mpeg4_width = null; + + /** Optional. Video height */ + public ?int $mpeg4_height = null; + + /** Optional. Video duration in seconds */ + public ?int $mpeg4_duration = null; + + /** Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” */ + public ?string $thumb_mime_type = null; + + /** Optional. Title for the result */ + public ?string $title = null; + + /** Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; + + /** Optional. Mode for parsing entities in the caption. See formatting options for more details. */ + public ?string $parse_mode = null; + + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; + + /** Optional. Content of the message to be sent instead of the video animation */ + public ?InputMessageContent $input_message_content = null; + + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $mpeg4_url A valid URL for the MP4 file. File size must not exceed 1MB + * @param string $thumb_url URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result + * @param int $mpeg4_width Optional. Video width + * @param int $mpeg4_height Optional. Video height + * @param int $mpeg4_duration Optional. Video duration in seconds + * @param string $thumb_mime_type Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg” + * @param string $title Optional. Title for the result + * @param string $caption Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the video animation + */ + public static function make( + string $id, + string $mpeg4_url, + string $thumb_url, + ?int $mpeg4_width = null, + ?int $mpeg4_height = null, + ?int $mpeg4_duration = null, + ?string $thumb_mime_type = null, + ?string $title = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'mpeg4_url' => $mpeg4_url, + 'thumb_url' => $thumb_url, + 'mpeg4_width' => $mpeg4_width, + 'mpeg4_height' => $mpeg4_height, + 'mpeg4_duration' => $mpeg4_duration, + 'thumb_mime_type' => $thumb_mime_type, + 'title' => $title, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultPhoto.php b/src/Telegram/InlineQueryResultPhoto.php index 6b7cfd9..8b6b6f7 100644 --- a/src/Telegram/InlineQueryResultPhoto.php +++ b/src/Telegram/InlineQueryResultPhoto.php @@ -11,84 +11,83 @@ */ class InlineQueryResultPhoto extends InlineQueryResult { - /** Type of the result, must be photo */ - public string $type = 'photo'; + /** Type of the result, must be photo */ + public string $type = 'photo'; - /** A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB */ - public string $photo_url; + /** A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB */ + public string $photo_url; - /** URL of the thumbnail for the photo */ - public string $thumb_url; + /** URL of the thumbnail for the photo */ + public string $thumb_url; - /** Optional. Width of the photo */ - public ?int $photo_width = null; + /** Optional. Width of the photo */ + public ?int $photo_width = null; - /** Optional. Height of the photo */ - public ?int $photo_height = null; + /** Optional. Height of the photo */ + public ?int $photo_height = null; - /** Optional. Title for the result */ - public ?string $title = null; + /** Optional. Title for the result */ + public ?string $title = null; - /** Optional. Short description of the result */ - public ?string $description = null; + /** Optional. Short description of the result */ + public ?string $description = null; - /** Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; + /** Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; - /** Optional. Mode for parsing entities in the photo caption. See formatting options for more details. */ - public ?string $parse_mode = null; + /** Optional. Mode for parsing entities in the photo caption. See formatting options for more details. */ + public ?string $parse_mode = null; - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Content of the message to be sent instead of the photo */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the photo */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $photo_url A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB - * @param string $thumb_url URL of the thumbnail for the photo - * @param int $photo_width Optional. Width of the photo - * @param int $photo_height Optional. Height of the photo - * @param string $title Optional. Title for the result - * @param string $description Optional. Short description of the result - * @param string $caption Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the photo caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the photo - */ - public static function make( - string $id, - string $photo_url, - string $thumb_url, - ?int $photo_width = null, - ?int $photo_height = null, - ?string $title = null, - ?string $description = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'photo_url' => $photo_url, - 'thumb_url' => $thumb_url, - 'photo_width' => $photo_width, - 'photo_height' => $photo_height, - 'title' => $title, - 'description' => $description, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $photo_url A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB + * @param string $thumb_url URL of the thumbnail for the photo + * @param int $photo_width Optional. Width of the photo + * @param int $photo_height Optional. Height of the photo + * @param string $title Optional. Title for the result + * @param string $description Optional. Short description of the result + * @param string $caption Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the photo caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the photo + */ + public static function make( + string $id, + string $photo_url, + string $thumb_url, + ?int $photo_width = null, + ?int $photo_height = null, + ?string $title = null, + ?string $description = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'photo_url' => $photo_url, + 'thumb_url' => $thumb_url, + 'photo_width' => $photo_width, + 'photo_height' => $photo_height, + 'title' => $title, + 'description' => $description, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultVenue.php b/src/Telegram/InlineQueryResultVenue.php index 6af4a4f..080b885 100644 --- a/src/Telegram/InlineQueryResultVenue.php +++ b/src/Telegram/InlineQueryResultVenue.php @@ -11,93 +11,92 @@ */ class InlineQueryResultVenue extends InlineQueryResult { - /** Type of the result, must be venue */ - public string $type = 'venue'; - - /** Latitude of the venue location in degrees */ - public float $latitude; - - /** Longitude of the venue location in degrees */ - public float $longitude; - - /** Title of the venue */ - public string $title; - - /** Address of the venue */ - public string $address; - - /** Optional. Foursquare identifier of the venue if known */ - public ?string $foursquare_id = null; - - /** Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ - public ?string $foursquare_type = null; - - /** Optional. Google Places identifier of the venue */ - public ?string $google_place_id = null; - - /** Optional. Google Places type of the venue. (See supported types.) */ - public ?string $google_place_type = null; - - /** Optional. Content of the message to be sent instead of the venue */ - public ?InputMessageContent $input_message_content = null; - - /** Optional. Url of the thumbnail for the result */ - public ?string $thumb_url = null; - - /** Optional. Thumbnail width */ - public ?int $thumb_width = null; - - /** Optional. Thumbnail height */ - public ?int $thumb_height = null; - - - /** - * @param string $id Unique identifier for this result, 1-64 Bytes - * @param float $latitude Latitude of the venue location in degrees - * @param float $longitude Longitude of the venue location in degrees - * @param string $title Title of the venue - * @param string $address Address of the venue - * @param string $foursquare_id Optional. Foursquare identifier of the venue if known - * @param string $foursquare_type Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) - * @param string $google_place_id Optional. Google Places identifier of the venue - * @param string $google_place_type Optional. Google Places type of the venue. (See supported types.) - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the venue - * @param string $thumb_url Optional. Url of the thumbnail for the result - * @param int $thumb_width Optional. Thumbnail width - * @param int $thumb_height Optional. Thumbnail height - */ - public static function make( - string $id, - float $latitude, - float $longitude, - string $title, - string $address, - ?string $foursquare_id = null, - ?string $foursquare_type = null, - ?string $google_place_id = null, - ?string $google_place_type = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null, - ?string $thumb_url = null, - ?int $thumb_width = null, - ?int $thumb_height = null - ): static { - return new static([ - 'id' => $id, - 'latitude' => $latitude, - 'longitude' => $longitude, - 'title' => $title, - 'address' => $address, - 'foursquare_id' => $foursquare_id, - 'foursquare_type' => $foursquare_type, - 'google_place_id' => $google_place_id, - 'google_place_type' => $google_place_type, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - 'thumb_url' => $thumb_url, - 'thumb_width' => $thumb_width, - 'thumb_height' => $thumb_height, - ]); - } + /** Type of the result, must be venue */ + public string $type = 'venue'; + + /** Latitude of the venue location in degrees */ + public float $latitude; + + /** Longitude of the venue location in degrees */ + public float $longitude; + + /** Title of the venue */ + public string $title; + + /** Address of the venue */ + public string $address; + + /** Optional. Foursquare identifier of the venue if known */ + public ?string $foursquare_id = null; + + /** Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ + public ?string $foursquare_type = null; + + /** Optional. Google Places identifier of the venue */ + public ?string $google_place_id = null; + + /** Optional. Google Places type of the venue. (See supported types.) */ + public ?string $google_place_type = null; + + /** Optional. Content of the message to be sent instead of the venue */ + public ?InputMessageContent $input_message_content = null; + + /** Optional. Url of the thumbnail for the result */ + public ?string $thumb_url = null; + + /** Optional. Thumbnail width */ + public ?int $thumb_width = null; + + /** Optional. Thumbnail height */ + public ?int $thumb_height = null; + + /** + * @param string $id Unique identifier for this result, 1-64 Bytes + * @param float $latitude Latitude of the venue location in degrees + * @param float $longitude Longitude of the venue location in degrees + * @param string $title Title of the venue + * @param string $address Address of the venue + * @param string $foursquare_id Optional. Foursquare identifier of the venue if known + * @param string $foursquare_type Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) + * @param string $google_place_id Optional. Google Places identifier of the venue + * @param string $google_place_type Optional. Google Places type of the venue. (See supported types.) + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the venue + * @param string $thumb_url Optional. Url of the thumbnail for the result + * @param int $thumb_width Optional. Thumbnail width + * @param int $thumb_height Optional. Thumbnail height + */ + public static function make( + string $id, + float $latitude, + float $longitude, + string $title, + string $address, + ?string $foursquare_id = null, + ?string $foursquare_type = null, + ?string $google_place_id = null, + ?string $google_place_type = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null, + ?string $thumb_url = null, + ?int $thumb_width = null, + ?int $thumb_height = null + ): static { + return new static([ + 'id' => $id, + 'latitude' => $latitude, + 'longitude' => $longitude, + 'title' => $title, + 'address' => $address, + 'foursquare_id' => $foursquare_id, + 'foursquare_type' => $foursquare_type, + 'google_place_id' => $google_place_id, + 'google_place_type' => $google_place_type, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + 'thumb_url' => $thumb_url, + 'thumb_width' => $thumb_width, + 'thumb_height' => $thumb_height, + ]); + } } diff --git a/src/Telegram/InlineQueryResultVideo.php b/src/Telegram/InlineQueryResultVideo.php index c09b62e..38e9582 100644 --- a/src/Telegram/InlineQueryResultVideo.php +++ b/src/Telegram/InlineQueryResultVideo.php @@ -11,96 +11,95 @@ */ class InlineQueryResultVideo extends InlineQueryResult { - /** Type of the result, must be video */ - public string $type = 'video'; - - /** A valid URL for the embedded video player or video file */ - public string $video_url; - - /** Mime type of the content of video url, “text/html” or “video/mp4” */ - public string $mime_type; - - /** URL of the thumbnail (JPEG only) for the video */ - public string $thumb_url; - - /** Title for the result */ - public string $title; - - /** Optional. Caption of the video to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; - - /** Optional. Mode for parsing entities in the video caption. See formatting options for more details. */ - public ?string $parse_mode = null; - - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; - - /** Optional. Video width */ - public ?int $video_width = null; - - /** Optional. Video height */ - public ?int $video_height = null; - - /** Optional. Video duration in seconds */ - public ?int $video_duration = null; - - /** Optional. Short description of the result */ - public ?string $description = null; - - /** Optional. Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). */ - public ?InputMessageContent $input_message_content = null; - - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $video_url A valid URL for the embedded video player or video file - * @param string $mime_type Mime type of the content of video url, “text/html” or “video/mp4” - * @param string $thumb_url URL of the thumbnail (JPEG only) for the video - * @param string $title Title for the result - * @param string $caption Optional. Caption of the video to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the video caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param int $video_width Optional. Video width - * @param int $video_height Optional. Video height - * @param int $video_duration Optional. Video duration in seconds - * @param string $description Optional. Short description of the result - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). - */ - public static function make( - string $id, - string $video_url, - string $mime_type, - string $thumb_url, - string $title, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?int $video_width = null, - ?int $video_height = null, - ?int $video_duration = null, - ?string $description = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'video_url' => $video_url, - 'mime_type' => $mime_type, - 'thumb_url' => $thumb_url, - 'title' => $title, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'video_width' => $video_width, - 'video_height' => $video_height, - 'video_duration' => $video_duration, - 'description' => $description, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** Type of the result, must be video */ + public string $type = 'video'; + + /** A valid URL for the embedded video player or video file */ + public string $video_url; + + /** Mime type of the content of video url, “text/html” or “video/mp4” */ + public string $mime_type; + + /** URL of the thumbnail (JPEG only) for the video */ + public string $thumb_url; + + /** Title for the result */ + public string $title; + + /** Optional. Caption of the video to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; + + /** Optional. Mode for parsing entities in the video caption. See formatting options for more details. */ + public ?string $parse_mode = null; + + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; + + /** Optional. Video width */ + public ?int $video_width = null; + + /** Optional. Video height */ + public ?int $video_height = null; + + /** Optional. Video duration in seconds */ + public ?int $video_duration = null; + + /** Optional. Short description of the result */ + public ?string $description = null; + + /** Optional. Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). */ + public ?InputMessageContent $input_message_content = null; + + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $video_url A valid URL for the embedded video player or video file + * @param string $mime_type Mime type of the content of video url, “text/html” or “video/mp4” + * @param string $thumb_url URL of the thumbnail (JPEG only) for the video + * @param string $title Title for the result + * @param string $caption Optional. Caption of the video to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the video caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param int $video_width Optional. Video width + * @param int $video_height Optional. Video height + * @param int $video_duration Optional. Video duration in seconds + * @param string $description Optional. Short description of the result + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video). + */ + public static function make( + string $id, + string $video_url, + string $mime_type, + string $thumb_url, + string $title, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?int $video_width = null, + ?int $video_height = null, + ?int $video_duration = null, + ?string $description = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'video_url' => $video_url, + 'mime_type' => $mime_type, + 'thumb_url' => $thumb_url, + 'title' => $title, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'video_width' => $video_width, + 'video_height' => $video_height, + 'video_duration' => $video_duration, + 'description' => $description, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InlineQueryResultVoice.php b/src/Telegram/InlineQueryResultVoice.php index 9f60945..53a2848 100644 --- a/src/Telegram/InlineQueryResultVoice.php +++ b/src/Telegram/InlineQueryResultVoice.php @@ -11,66 +11,65 @@ */ class InlineQueryResultVoice extends InlineQueryResult { - /** Type of the result, must be voice */ - public string $type = 'voice'; + /** Type of the result, must be voice */ + public string $type = 'voice'; - /** A valid URL for the voice recording */ - public string $voice_url; + /** A valid URL for the voice recording */ + public string $voice_url; - /** Recording title */ - public string $title; + /** Recording title */ + public string $title; - /** Optional. Caption, 0-1024 characters after entities parsing */ - public ?string $caption = null; + /** Optional. Caption, 0-1024 characters after entities parsing */ + public ?string $caption = null; - /** Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. */ - public ?string $parse_mode = null; + /** Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. */ + public ?string $parse_mode = null; - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Recording duration in seconds */ - public ?int $voice_duration = null; + /** Optional. Recording duration in seconds */ + public ?int $voice_duration = null; - /** Optional. Content of the message to be sent instead of the voice recording */ - public ?InputMessageContent $input_message_content = null; + /** Optional. Content of the message to be sent instead of the voice recording */ + public ?InputMessageContent $input_message_content = null; - - /** - * @param string $id Unique identifier for this result, 1-64 bytes - * @param string $voice_url A valid URL for the voice recording - * @param string $title Recording title - * @param string $caption Optional. Caption, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param int $voice_duration Optional. Recording duration in seconds - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message - * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the voice recording - */ - public static function make( - string $id, - string $voice_url, - string $title, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?int $voice_duration = null, - ?InlineKeyboardMarkup $reply_markup = null, - ?InputMessageContent $input_message_content = null - ): static { - return new static([ - 'id' => $id, - 'voice_url' => $voice_url, - 'title' => $title, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'voice_duration' => $voice_duration, - 'reply_markup' => $reply_markup, - 'input_message_content' => $input_message_content, - ]); - } + /** + * @param string $id Unique identifier for this result, 1-64 bytes + * @param string $voice_url A valid URL for the voice recording + * @param string $title Recording title + * @param string $caption Optional. Caption, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the voice message caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param int $voice_duration Optional. Recording duration in seconds + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message + * @param InputMessageContent $input_message_content Optional. Content of the message to be sent instead of the voice recording + */ + public static function make( + string $id, + string $voice_url, + string $title, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?int $voice_duration = null, + ?InlineKeyboardMarkup $reply_markup = null, + ?InputMessageContent $input_message_content = null + ): static { + return new static([ + 'id' => $id, + 'voice_url' => $voice_url, + 'title' => $title, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'voice_duration' => $voice_duration, + 'reply_markup' => $reply_markup, + 'input_message_content' => $input_message_content, + ]); + } } diff --git a/src/Telegram/InputContactMessageContent.php b/src/Telegram/InputContactMessageContent.php index 3a99f7a..482ee80 100644 --- a/src/Telegram/InputContactMessageContent.php +++ b/src/Telegram/InputContactMessageContent.php @@ -11,36 +11,35 @@ */ class InputContactMessageContent extends InputMessageContent { - /** Contact's phone number */ - public string $phone_number; - - /** Contact's first name */ - public string $first_name; - - /** Optional. Contact's last name */ - public ?string $last_name = null; - - /** Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes */ - public ?string $vcard = null; - - - /** - * @param string $phone_number Contact's phone number - * @param string $first_name Contact's first name - * @param string $last_name Optional. Contact's last name - * @param string $vcard Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes - */ - public static function make( - string $phone_number, - string $first_name, - ?string $last_name = null, - ?string $vcard = null - ): static { - return new static([ - 'phone_number' => $phone_number, - 'first_name' => $first_name, - 'last_name' => $last_name, - 'vcard' => $vcard, - ]); - } + /** Contact's phone number */ + public string $phone_number; + + /** Contact's first name */ + public string $first_name; + + /** Optional. Contact's last name */ + public ?string $last_name = null; + + /** Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes */ + public ?string $vcard = null; + + /** + * @param string $phone_number Contact's phone number + * @param string $first_name Contact's first name + * @param string $last_name Optional. Contact's last name + * @param string $vcard Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes + */ + public static function make( + string $phone_number, + string $first_name, + ?string $last_name = null, + ?string $vcard = null + ): static { + return new static([ + 'phone_number' => $phone_number, + 'first_name' => $first_name, + 'last_name' => $last_name, + 'vcard' => $vcard, + ]); + } } diff --git a/src/Telegram/InputInvoiceMessageContent.php b/src/Telegram/InputInvoiceMessageContent.php index 9b518b7..bd1b42d 100644 --- a/src/Telegram/InputInvoiceMessageContent.php +++ b/src/Telegram/InputInvoiceMessageContent.php @@ -11,138 +11,137 @@ */ class InputInvoiceMessageContent extends InputMessageContent { - /** Product name, 1-32 characters */ - public string $title; - - /** Product description, 1-255 characters */ - public string $description; - - /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */ - public string $payload; - - /** Payment provider token, obtained via Botfather */ - public string $provider_token; - - /** Three-letter ISO 4217 currency code, see more on currencies */ - public string $currency; - - /** - * Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - * @var LabeledPrice[] - */ - public array $prices; - - /** Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 */ - public ?int $max_tip_amount = null; - - /** - * Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. - * @var int[] - */ - public ?array $suggested_tip_amounts = null; - - /** Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. */ - public ?string $provider_data = null; - - /** Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. */ - public ?string $photo_url = null; - - /** Optional. Photo size */ - public ?int $photo_size = null; - - /** Optional. Photo width */ - public ?int $photo_width = null; - - /** Optional. Photo height */ - public ?int $photo_height = null; - - /** Optional. Pass True, if you require the user's full name to complete the order */ - public ?bool $need_name = null; - - /** Optional. Pass True, if you require the user's phone number to complete the order */ - public ?bool $need_phone_number = null; - - /** Optional. Pass True, if you require the user's email address to complete the order */ - public ?bool $need_email = null; - - /** Optional. Pass True, if you require the user's shipping address to complete the order */ - public ?bool $need_shipping_address = null; - - /** Optional. Pass True, if user's phone number should be sent to provider */ - public ?bool $send_phone_number_to_provider = null; - - /** Optional. Pass True, if user's email address should be sent to provider */ - public ?bool $send_email_to_provider = null; - - /** Optional. Pass True, if the final price depends on the shipping method */ - public ?bool $is_flexible = null; - - - /** - * @param string $title Product name, 1-32 characters - * @param string $description Product description, 1-255 characters - * @param string $payload Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. - * @param string $provider_token Payment provider token, obtained via Botfather - * @param string $currency Three-letter ISO 4217 currency code, see more on currencies - * @param LabeledPrice[] $prices Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) - * @param int $max_tip_amount Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 - * @param int[] $suggested_tip_amounts Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. - * @param string $provider_data Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. - * @param string $photo_url Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. - * @param int $photo_size Optional. Photo size - * @param int $photo_width Optional. Photo width - * @param int $photo_height Optional. Photo height - * @param bool $need_name Optional. Pass True, if you require the user's full name to complete the order - * @param bool $need_phone_number Optional. Pass True, if you require the user's phone number to complete the order - * @param bool $need_email Optional. Pass True, if you require the user's email address to complete the order - * @param bool $need_shipping_address Optional. Pass True, if you require the user's shipping address to complete the order - * @param bool $send_phone_number_to_provider Optional. Pass True, if user's phone number should be sent to provider - * @param bool $send_email_to_provider Optional. Pass True, if user's email address should be sent to provider - * @param bool $is_flexible Optional. Pass True, if the final price depends on the shipping method - */ - public static function make( - string $title, - string $description, - string $payload, - string $provider_token, - string $currency, - array $prices, - ?int $max_tip_amount = null, - ?array $suggested_tip_amounts = null, - ?string $provider_data = null, - ?string $photo_url = null, - ?int $photo_size = null, - ?int $photo_width = null, - ?int $photo_height = null, - ?bool $need_name = null, - ?bool $need_phone_number = null, - ?bool $need_email = null, - ?bool $need_shipping_address = null, - ?bool $send_phone_number_to_provider = null, - ?bool $send_email_to_provider = null, - ?bool $is_flexible = null - ): static { - return new static([ - 'title' => $title, - 'description' => $description, - 'payload' => $payload, - 'provider_token' => $provider_token, - 'currency' => $currency, - 'prices' => $prices, - 'max_tip_amount' => $max_tip_amount, - 'suggested_tip_amounts' => $suggested_tip_amounts, - 'provider_data' => $provider_data, - 'photo_url' => $photo_url, - 'photo_size' => $photo_size, - 'photo_width' => $photo_width, - 'photo_height' => $photo_height, - 'need_name' => $need_name, - 'need_phone_number' => $need_phone_number, - 'need_email' => $need_email, - 'need_shipping_address' => $need_shipping_address, - 'send_phone_number_to_provider' => $send_phone_number_to_provider, - 'send_email_to_provider' => $send_email_to_provider, - 'is_flexible' => $is_flexible, - ]); - } + /** Product name, 1-32 characters */ + public string $title; + + /** Product description, 1-255 characters */ + public string $description; + + /** Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. */ + public string $payload; + + /** Payment provider token, obtained via Botfather */ + public string $provider_token; + + /** Three-letter ISO 4217 currency code, see more on currencies */ + public string $currency; + + /** + * Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + * @var LabeledPrice[] + */ + public array $prices; + + /** Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 */ + public ?int $max_tip_amount = null; + + /** + * Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. + * @var int[] + */ + public ?array $suggested_tip_amounts = null; + + /** Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. */ + public ?string $provider_data = null; + + /** Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. */ + public ?string $photo_url = null; + + /** Optional. Photo size */ + public ?int $photo_size = null; + + /** Optional. Photo width */ + public ?int $photo_width = null; + + /** Optional. Photo height */ + public ?int $photo_height = null; + + /** Optional. Pass True, if you require the user's full name to complete the order */ + public ?bool $need_name = null; + + /** Optional. Pass True, if you require the user's phone number to complete the order */ + public ?bool $need_phone_number = null; + + /** Optional. Pass True, if you require the user's email address to complete the order */ + public ?bool $need_email = null; + + /** Optional. Pass True, if you require the user's shipping address to complete the order */ + public ?bool $need_shipping_address = null; + + /** Optional. Pass True, if user's phone number should be sent to provider */ + public ?bool $send_phone_number_to_provider = null; + + /** Optional. Pass True, if user's email address should be sent to provider */ + public ?bool $send_email_to_provider = null; + + /** Optional. Pass True, if the final price depends on the shipping method */ + public ?bool $is_flexible = null; + + /** + * @param string $title Product name, 1-32 characters + * @param string $description Product description, 1-255 characters + * @param string $payload Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. + * @param string $provider_token Payment provider token, obtained via Botfather + * @param string $currency Three-letter ISO 4217 currency code, see more on currencies + * @param LabeledPrice[] $prices Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) + * @param int $max_tip_amount Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0 + * @param int[] $suggested_tip_amounts Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount. + * @param string $provider_data Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider. + * @param string $photo_url Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for. + * @param int $photo_size Optional. Photo size + * @param int $photo_width Optional. Photo width + * @param int $photo_height Optional. Photo height + * @param bool $need_name Optional. Pass True, if you require the user's full name to complete the order + * @param bool $need_phone_number Optional. Pass True, if you require the user's phone number to complete the order + * @param bool $need_email Optional. Pass True, if you require the user's email address to complete the order + * @param bool $need_shipping_address Optional. Pass True, if you require the user's shipping address to complete the order + * @param bool $send_phone_number_to_provider Optional. Pass True, if user's phone number should be sent to provider + * @param bool $send_email_to_provider Optional. Pass True, if user's email address should be sent to provider + * @param bool $is_flexible Optional. Pass True, if the final price depends on the shipping method + */ + public static function make( + string $title, + string $description, + string $payload, + string $provider_token, + string $currency, + array $prices, + ?int $max_tip_amount = null, + ?array $suggested_tip_amounts = null, + ?string $provider_data = null, + ?string $photo_url = null, + ?int $photo_size = null, + ?int $photo_width = null, + ?int $photo_height = null, + ?bool $need_name = null, + ?bool $need_phone_number = null, + ?bool $need_email = null, + ?bool $need_shipping_address = null, + ?bool $send_phone_number_to_provider = null, + ?bool $send_email_to_provider = null, + ?bool $is_flexible = null + ): static { + return new static([ + 'title' => $title, + 'description' => $description, + 'payload' => $payload, + 'provider_token' => $provider_token, + 'currency' => $currency, + 'prices' => $prices, + 'max_tip_amount' => $max_tip_amount, + 'suggested_tip_amounts' => $suggested_tip_amounts, + 'provider_data' => $provider_data, + 'photo_url' => $photo_url, + 'photo_size' => $photo_size, + 'photo_width' => $photo_width, + 'photo_height' => $photo_height, + 'need_name' => $need_name, + 'need_phone_number' => $need_phone_number, + 'need_email' => $need_email, + 'need_shipping_address' => $need_shipping_address, + 'send_phone_number_to_provider' => $send_phone_number_to_provider, + 'send_email_to_provider' => $send_email_to_provider, + 'is_flexible' => $is_flexible, + ]); + } } diff --git a/src/Telegram/InputLocationMessageContent.php b/src/Telegram/InputLocationMessageContent.php index 4ecf594..8fa1d24 100644 --- a/src/Telegram/InputLocationMessageContent.php +++ b/src/Telegram/InputLocationMessageContent.php @@ -11,48 +11,47 @@ */ class InputLocationMessageContent extends InputMessageContent { - /** Latitude of the location in degrees */ - public float $latitude; - - /** Longitude of the location in degrees */ - public float $longitude; - - /** Optional. The radius of uncertainty for the location, measured in meters; 0-1500 */ - public ?float $horizontal_accuracy = null; - - /** Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. */ - public ?int $live_period = null; - - /** Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */ - public ?int $heading = null; - - /** Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */ - public ?int $proximity_alert_radius = null; - - - /** - * @param float $latitude Latitude of the location in degrees - * @param float $longitude Longitude of the location in degrees - * @param float $horizontal_accuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500 - * @param int $live_period Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. - * @param int $heading Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. - * @param int $proximity_alert_radius Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. - */ - public static function make( - float $latitude, - float $longitude, - ?float $horizontal_accuracy = null, - ?int $live_period = null, - ?int $heading = null, - ?int $proximity_alert_radius = null - ): static { - return new static([ - 'latitude' => $latitude, - 'longitude' => $longitude, - 'horizontal_accuracy' => $horizontal_accuracy, - 'live_period' => $live_period, - 'heading' => $heading, - 'proximity_alert_radius' => $proximity_alert_radius, - ]); - } + /** Latitude of the location in degrees */ + public float $latitude; + + /** Longitude of the location in degrees */ + public float $longitude; + + /** Optional. The radius of uncertainty for the location, measured in meters; 0-1500 */ + public ?float $horizontal_accuracy = null; + + /** Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. */ + public ?int $live_period = null; + + /** Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. */ + public ?int $heading = null; + + /** Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. */ + public ?int $proximity_alert_radius = null; + + /** + * @param float $latitude Latitude of the location in degrees + * @param float $longitude Longitude of the location in degrees + * @param float $horizontal_accuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500 + * @param int $live_period Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. + * @param int $heading Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified. + * @param int $proximity_alert_radius Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified. + */ + public static function make( + float $latitude, + float $longitude, + ?float $horizontal_accuracy = null, + ?int $live_period = null, + ?int $heading = null, + ?int $proximity_alert_radius = null + ): static { + return new static([ + 'latitude' => $latitude, + 'longitude' => $longitude, + 'horizontal_accuracy' => $horizontal_accuracy, + 'live_period' => $live_period, + 'heading' => $heading, + 'proximity_alert_radius' => $proximity_alert_radius, + ]); + } } diff --git a/src/Telegram/InputMedia.php b/src/Telegram/InputMedia.php index 5049f51..41ee6a6 100644 --- a/src/Telegram/InputMedia.php +++ b/src/Telegram/InputMedia.php @@ -11,33 +11,32 @@ */ abstract class InputMedia extends \Tii\Telepath\Type { - /** Type of the result */ - public string $type; - - /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » */ - public string $media; - - /** Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing */ - public ?string $caption = null; - - /** Optional. Mode for parsing entities in the animation caption. See formatting options for more details. */ - public ?string $parse_mode = null; - - /** - * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $caption_entities = null; - - - public static function factory(array $data): static - { - return match($data['type']) { - 'animation' => new InputMediaAnimation($data) - 'document' => new InputMediaDocument($data) - 'audio' => new InputMediaAudio($data) - 'photo' => new InputMediaPhoto($data) - 'video' => new InputMediaVideo($data) - }; - } + /** Type of the result */ + public string $type; + + /** File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » */ + public string $media; + + /** Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing */ + public ?string $caption = null; + + /** Optional. Mode for parsing entities in the animation caption. See formatting options for more details. */ + public ?string $parse_mode = null; + + /** + * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $caption_entities = null; + + public static function factory(array $data): static + { + return match($data['type']) { + 'animation' => new InputMediaAnimation($data) + 'document' => new InputMediaDocument($data) + 'audio' => new InputMediaAudio($data) + 'photo' => new InputMediaPhoto($data) + 'video' => new InputMediaVideo($data) + }; + } } diff --git a/src/Telegram/InputMediaAnimation.php b/src/Telegram/InputMediaAnimation.php index 02e1a0d..066d9f5 100644 --- a/src/Telegram/InputMediaAnimation.php +++ b/src/Telegram/InputMediaAnimation.php @@ -11,51 +11,50 @@ */ class InputMediaAnimation extends InputMedia { - /** Type of the result, must be animation */ - public string $type = 'animation'; - - /** Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » */ - public \Tii\Telepath\InputFile|string|null $thumb = null; - - /** Optional. Animation width */ - public ?int $width = null; - - /** Optional. Animation height */ - public ?int $height = null; - - /** Optional. Animation duration in seconds */ - public ?int $duration = null; - - - /** - * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » - * @param \Tii\Telepath\InputFile|string $thumb Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » - * @param string $caption Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the animation caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param int $width Optional. Animation width - * @param int $height Optional. Animation height - * @param int $duration Optional. Animation duration in seconds - */ - public static function make( - string $media, - \Tii\Telepath\InputFile|string|null $thumb = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?int $width = null, - ?int $height = null, - ?int $duration = null - ): static { - return new static([ - 'media' => $media, - 'thumb' => $thumb, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'width' => $width, - 'height' => $height, - 'duration' => $duration, - ]); - } + /** Type of the result, must be animation */ + public string $type = 'animation'; + + /** Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » */ + public \Tii\Telepath\InputFile|string|null $thumb = null; + + /** Optional. Animation width */ + public ?int $width = null; + + /** Optional. Animation height */ + public ?int $height = null; + + /** Optional. Animation duration in seconds */ + public ?int $duration = null; + + /** + * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » + * @param \Tii\Telepath\InputFile|string $thumb Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » + * @param string $caption Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the animation caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param int $width Optional. Animation width + * @param int $height Optional. Animation height + * @param int $duration Optional. Animation duration in seconds + */ + public static function make( + string $media, + \Tii\Telepath\InputFile|string|null $thumb = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?int $width = null, + ?int $height = null, + ?int $duration = null + ): static { + return new static([ + 'media' => $media, + 'thumb' => $thumb, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'width' => $width, + 'height' => $height, + 'duration' => $duration, + ]); + } } diff --git a/src/Telegram/InputMediaAudio.php b/src/Telegram/InputMediaAudio.php index fca1757..96f7796 100644 --- a/src/Telegram/InputMediaAudio.php +++ b/src/Telegram/InputMediaAudio.php @@ -11,51 +11,50 @@ */ class InputMediaAudio extends InputMedia { - /** Type of the result, must be audio */ - public string $type = 'audio'; - - /** Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » */ - public \Tii\Telepath\InputFile|string|null $thumb = null; - - /** Optional. Duration of the audio in seconds */ - public ?int $duration = null; - - /** Optional. Performer of the audio */ - public ?string $performer = null; - - /** Optional. Title of the audio */ - public ?string $title = null; - - - /** - * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » - * @param \Tii\Telepath\InputFile|string $thumb Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » - * @param string $caption Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the audio caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param int $duration Optional. Duration of the audio in seconds - * @param string $performer Optional. Performer of the audio - * @param string $title Optional. Title of the audio - */ - public static function make( - string $media, - \Tii\Telepath\InputFile|string|null $thumb = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?int $duration = null, - ?string $performer = null, - ?string $title = null - ): static { - return new static([ - 'media' => $media, - 'thumb' => $thumb, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'duration' => $duration, - 'performer' => $performer, - 'title' => $title, - ]); - } + /** Type of the result, must be audio */ + public string $type = 'audio'; + + /** Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » */ + public \Tii\Telepath\InputFile|string|null $thumb = null; + + /** Optional. Duration of the audio in seconds */ + public ?int $duration = null; + + /** Optional. Performer of the audio */ + public ?string $performer = null; + + /** Optional. Title of the audio */ + public ?string $title = null; + + /** + * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » + * @param \Tii\Telepath\InputFile|string $thumb Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » + * @param string $caption Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the audio caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param int $duration Optional. Duration of the audio in seconds + * @param string $performer Optional. Performer of the audio + * @param string $title Optional. Title of the audio + */ + public static function make( + string $media, + \Tii\Telepath\InputFile|string|null $thumb = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?int $duration = null, + ?string $performer = null, + ?string $title = null + ): static { + return new static([ + 'media' => $media, + 'thumb' => $thumb, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'duration' => $duration, + 'performer' => $performer, + 'title' => $title, + ]); + } } diff --git a/src/Telegram/InputMediaDocument.php b/src/Telegram/InputMediaDocument.php index 374239c..c0a600c 100644 --- a/src/Telegram/InputMediaDocument.php +++ b/src/Telegram/InputMediaDocument.php @@ -11,39 +11,38 @@ */ class InputMediaDocument extends InputMedia { - /** Type of the result, must be document */ - public string $type = 'document'; + /** Type of the result, must be document */ + public string $type = 'document'; - /** Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » */ - public \Tii\Telepath\InputFile|string|null $thumb = null; + /** Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » */ + public \Tii\Telepath\InputFile|string|null $thumb = null; - /** Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album. */ - public ?bool $disable_content_type_detection = null; + /** Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album. */ + public ?bool $disable_content_type_detection = null; - - /** - * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » - * @param \Tii\Telepath\InputFile|string $thumb Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » - * @param string $caption Optional. Caption of the document to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the document caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param bool $disable_content_type_detection Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album. - */ - public static function make( - string $media, - \Tii\Telepath\InputFile|string|null $thumb = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?bool $disable_content_type_detection = null - ): static { - return new static([ - 'media' => $media, - 'thumb' => $thumb, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'disable_content_type_detection' => $disable_content_type_detection, - ]); - } + /** + * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » + * @param \Tii\Telepath\InputFile|string $thumb Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » + * @param string $caption Optional. Caption of the document to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the document caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param bool $disable_content_type_detection Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album. + */ + public static function make( + string $media, + \Tii\Telepath\InputFile|string|null $thumb = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?bool $disable_content_type_detection = null + ): static { + return new static([ + 'media' => $media, + 'thumb' => $thumb, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'disable_content_type_detection' => $disable_content_type_detection, + ]); + } } diff --git a/src/Telegram/InputMediaPhoto.php b/src/Telegram/InputMediaPhoto.php index 36bf336..e32005b 100644 --- a/src/Telegram/InputMediaPhoto.php +++ b/src/Telegram/InputMediaPhoto.php @@ -11,27 +11,26 @@ */ class InputMediaPhoto extends InputMedia { - /** Type of the result, must be photo */ - public string $type = 'photo'; + /** Type of the result, must be photo */ + public string $type = 'photo'; - - /** - * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » - * @param string $caption Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the photo caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - */ - public static function make( - string $media, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null - ): static { - return new static([ - 'media' => $media, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - ]); - } + /** + * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » + * @param string $caption Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the photo caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + */ + public static function make( + string $media, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null + ): static { + return new static([ + 'media' => $media, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + ]); + } } diff --git a/src/Telegram/InputMediaVideo.php b/src/Telegram/InputMediaVideo.php index d722c7b..0fa7d64 100644 --- a/src/Telegram/InputMediaVideo.php +++ b/src/Telegram/InputMediaVideo.php @@ -11,57 +11,56 @@ */ class InputMediaVideo extends InputMedia { - /** Type of the result, must be video */ - public string $type = 'video'; + /** Type of the result, must be video */ + public string $type = 'video'; - /** Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » */ - public \Tii\Telepath\InputFile|string|null $thumb = null; + /** Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » */ + public \Tii\Telepath\InputFile|string|null $thumb = null; - /** Optional. Video width */ - public ?int $width = null; + /** Optional. Video width */ + public ?int $width = null; - /** Optional. Video height */ - public ?int $height = null; + /** Optional. Video height */ + public ?int $height = null; - /** Optional. Video duration in seconds */ - public ?int $duration = null; + /** Optional. Video duration in seconds */ + public ?int $duration = null; - /** Optional. Pass True, if the uploaded video is suitable for streaming */ - public ?bool $supports_streaming = null; + /** Optional. Pass True, if the uploaded video is suitable for streaming */ + public ?bool $supports_streaming = null; - - /** - * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » - * @param \Tii\Telepath\InputFile|string $thumb Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » - * @param string $caption Optional. Caption of the video to be sent, 0-1024 characters after entities parsing - * @param string $parse_mode Optional. Mode for parsing entities in the video caption. See formatting options for more details. - * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode - * @param int $width Optional. Video width - * @param int $height Optional. Video height - * @param int $duration Optional. Video duration in seconds - * @param bool $supports_streaming Optional. Pass True, if the uploaded video is suitable for streaming - */ - public static function make( - string $media, - \Tii\Telepath\InputFile|string|null $thumb = null, - ?string $caption = null, - ?string $parse_mode = null, - ?array $caption_entities = null, - ?int $width = null, - ?int $height = null, - ?int $duration = null, - ?bool $supports_streaming = null - ): static { - return new static([ - 'media' => $media, - 'thumb' => $thumb, - 'caption' => $caption, - 'parse_mode' => $parse_mode, - 'caption_entities' => $caption_entities, - 'width' => $width, - 'height' => $height, - 'duration' => $duration, - 'supports_streaming' => $supports_streaming, - ]); - } + /** + * @param string $media File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://” to upload a new one using multipart/form-data under name. More info on Sending Files » + * @param \Tii\Telepath\InputFile|string $thumb Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://” if the thumbnail was uploaded using multipart/form-data under . More info on Sending Files » + * @param string $caption Optional. Caption of the video to be sent, 0-1024 characters after entities parsing + * @param string $parse_mode Optional. Mode for parsing entities in the video caption. See formatting options for more details. + * @param MessageEntity[] $caption_entities Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode + * @param int $width Optional. Video width + * @param int $height Optional. Video height + * @param int $duration Optional. Video duration in seconds + * @param bool $supports_streaming Optional. Pass True, if the uploaded video is suitable for streaming + */ + public static function make( + string $media, + \Tii\Telepath\InputFile|string|null $thumb = null, + ?string $caption = null, + ?string $parse_mode = null, + ?array $caption_entities = null, + ?int $width = null, + ?int $height = null, + ?int $duration = null, + ?bool $supports_streaming = null + ): static { + return new static([ + 'media' => $media, + 'thumb' => $thumb, + 'caption' => $caption, + 'parse_mode' => $parse_mode, + 'caption_entities' => $caption_entities, + 'width' => $width, + 'height' => $height, + 'duration' => $duration, + 'supports_streaming' => $supports_streaming, + ]); + } } diff --git a/src/Telegram/InputMessageContent.php b/src/Telegram/InputMessageContent.php index 52a255f..c65f895 100644 --- a/src/Telegram/InputMessageContent.php +++ b/src/Telegram/InputMessageContent.php @@ -11,10 +11,10 @@ */ abstract class InputMessageContent extends \Tii\Telepath\Type { - public static function factory(array $data): static - { - return match($data[null]) { - '' => new InputInvoiceMessageContent($data) - }; - } + public static function factory(array $data): static + { + return match($data[null]) { + '' => new InputInvoiceMessageContent($data) + }; + } } diff --git a/src/Telegram/InputTextMessageContent.php b/src/Telegram/InputTextMessageContent.php index 0627322..aa2da3b 100644 --- a/src/Telegram/InputTextMessageContent.php +++ b/src/Telegram/InputTextMessageContent.php @@ -11,39 +11,38 @@ */ class InputTextMessageContent extends InputMessageContent { - /** Text of the message to be sent, 1-4096 characters */ - public string $message_text; - - /** Optional. Mode for parsing entities in the message text. See formatting options for more details. */ - public ?string $parse_mode = null; - - /** - * Optional. List of special entities that appear in message text, which can be specified instead of parse_mode - * @var MessageEntity[] - */ - public ?array $entities = null; - - /** Optional. Disables link previews for links in the sent message */ - public ?bool $disable_web_page_preview = null; - - - /** - * @param string $message_text Text of the message to be sent, 1-4096 characters - * @param string $parse_mode Optional. Mode for parsing entities in the message text. See formatting options for more details. - * @param MessageEntity[] $entities Optional. List of special entities that appear in message text, which can be specified instead of parse_mode - * @param bool $disable_web_page_preview Optional. Disables link previews for links in the sent message - */ - public static function make( - string $message_text, - ?string $parse_mode = null, - ?array $entities = null, - ?bool $disable_web_page_preview = null - ): static { - return new static([ - 'message_text' => $message_text, - 'parse_mode' => $parse_mode, - 'entities' => $entities, - 'disable_web_page_preview' => $disable_web_page_preview, - ]); - } + /** Text of the message to be sent, 1-4096 characters */ + public string $message_text; + + /** Optional. Mode for parsing entities in the message text. See formatting options for more details. */ + public ?string $parse_mode = null; + + /** + * Optional. List of special entities that appear in message text, which can be specified instead of parse_mode + * @var MessageEntity[] + */ + public ?array $entities = null; + + /** Optional. Disables link previews for links in the sent message */ + public ?bool $disable_web_page_preview = null; + + /** + * @param string $message_text Text of the message to be sent, 1-4096 characters + * @param string $parse_mode Optional. Mode for parsing entities in the message text. See formatting options for more details. + * @param MessageEntity[] $entities Optional. List of special entities that appear in message text, which can be specified instead of parse_mode + * @param bool $disable_web_page_preview Optional. Disables link previews for links in the sent message + */ + public static function make( + string $message_text, + ?string $parse_mode = null, + ?array $entities = null, + ?bool $disable_web_page_preview = null + ): static { + return new static([ + 'message_text' => $message_text, + 'parse_mode' => $parse_mode, + 'entities' => $entities, + 'disable_web_page_preview' => $disable_web_page_preview, + ]); + } } diff --git a/src/Telegram/InputVenueMessageContent.php b/src/Telegram/InputVenueMessageContent.php index c04e20c..cab095a 100644 --- a/src/Telegram/InputVenueMessageContent.php +++ b/src/Telegram/InputVenueMessageContent.php @@ -11,60 +11,59 @@ */ class InputVenueMessageContent extends InputMessageContent { - /** Latitude of the venue in degrees */ - public float $latitude; + /** Latitude of the venue in degrees */ + public float $latitude; - /** Longitude of the venue in degrees */ - public float $longitude; + /** Longitude of the venue in degrees */ + public float $longitude; - /** Name of the venue */ - public string $title; + /** Name of the venue */ + public string $title; - /** Address of the venue */ - public string $address; + /** Address of the venue */ + public string $address; - /** Optional. Foursquare identifier of the venue, if known */ - public ?string $foursquare_id = null; + /** Optional. Foursquare identifier of the venue, if known */ + public ?string $foursquare_id = null; - /** Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ - public ?string $foursquare_type = null; + /** Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ + public ?string $foursquare_type = null; - /** Optional. Google Places identifier of the venue */ - public ?string $google_place_id = null; + /** Optional. Google Places identifier of the venue */ + public ?string $google_place_id = null; - /** Optional. Google Places type of the venue. (See supported types.) */ - public ?string $google_place_type = null; + /** Optional. Google Places type of the venue. (See supported types.) */ + public ?string $google_place_type = null; - - /** - * @param float $latitude Latitude of the venue in degrees - * @param float $longitude Longitude of the venue in degrees - * @param string $title Name of the venue - * @param string $address Address of the venue - * @param string $foursquare_id Optional. Foursquare identifier of the venue, if known - * @param string $foursquare_type Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) - * @param string $google_place_id Optional. Google Places identifier of the venue - * @param string $google_place_type Optional. Google Places type of the venue. (See supported types.) - */ - public static function make( - float $latitude, - float $longitude, - string $title, - string $address, - ?string $foursquare_id = null, - ?string $foursquare_type = null, - ?string $google_place_id = null, - ?string $google_place_type = null - ): static { - return new static([ - 'latitude' => $latitude, - 'longitude' => $longitude, - 'title' => $title, - 'address' => $address, - 'foursquare_id' => $foursquare_id, - 'foursquare_type' => $foursquare_type, - 'google_place_id' => $google_place_id, - 'google_place_type' => $google_place_type, - ]); - } + /** + * @param float $latitude Latitude of the venue in degrees + * @param float $longitude Longitude of the venue in degrees + * @param string $title Name of the venue + * @param string $address Address of the venue + * @param string $foursquare_id Optional. Foursquare identifier of the venue, if known + * @param string $foursquare_type Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) + * @param string $google_place_id Optional. Google Places identifier of the venue + * @param string $google_place_type Optional. Google Places type of the venue. (See supported types.) + */ + public static function make( + float $latitude, + float $longitude, + string $title, + string $address, + ?string $foursquare_id = null, + ?string $foursquare_type = null, + ?string $google_place_id = null, + ?string $google_place_type = null + ): static { + return new static([ + 'latitude' => $latitude, + 'longitude' => $longitude, + 'title' => $title, + 'address' => $address, + 'foursquare_id' => $foursquare_id, + 'foursquare_type' => $foursquare_type, + 'google_place_id' => $google_place_id, + 'google_place_type' => $google_place_type, + ]); + } } diff --git a/src/Telegram/Invoice.php b/src/Telegram/Invoice.php index e17ebdd..08babb5 100644 --- a/src/Telegram/Invoice.php +++ b/src/Telegram/Invoice.php @@ -11,42 +11,41 @@ */ class Invoice extends \Tii\Telepath\Type { - /** Product name */ - public string $title; - - /** Product description */ - public string $description; - - /** Unique bot deep-linking parameter that can be used to generate this invoice */ - public string $start_parameter; - - /** Three-letter ISO 4217 currency code */ - public string $currency; - - /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ - public int $total_amount; - - - /** - * @param string $title Product name - * @param string $description Product description - * @param string $start_parameter Unique bot deep-linking parameter that can be used to generate this invoice - * @param string $currency Three-letter ISO 4217 currency code - * @param int $total_amount Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - */ - public static function make( - string $title, - string $description, - string $start_parameter, - string $currency, - int $total_amount - ): static { - return new static([ - 'title' => $title, - 'description' => $description, - 'start_parameter' => $start_parameter, - 'currency' => $currency, - 'total_amount' => $total_amount, - ]); - } + /** Product name */ + public string $title; + + /** Product description */ + public string $description; + + /** Unique bot deep-linking parameter that can be used to generate this invoice */ + public string $start_parameter; + + /** Three-letter ISO 4217 currency code */ + public string $currency; + + /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ + public int $total_amount; + + /** + * @param string $title Product name + * @param string $description Product description + * @param string $start_parameter Unique bot deep-linking parameter that can be used to generate this invoice + * @param string $currency Three-letter ISO 4217 currency code + * @param int $total_amount Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). + */ + public static function make( + string $title, + string $description, + string $start_parameter, + string $currency, + int $total_amount + ): static { + return new static([ + 'title' => $title, + 'description' => $description, + 'start_parameter' => $start_parameter, + 'currency' => $currency, + 'total_amount' => $total_amount, + ]); + } } diff --git a/src/Telegram/KeyboardButton.php b/src/Telegram/KeyboardButton.php index defcc4f..c797c65 100644 --- a/src/Telegram/KeyboardButton.php +++ b/src/Telegram/KeyboardButton.php @@ -11,42 +11,41 @@ */ class KeyboardButton extends \Tii\Telepath\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 */ - public string $text; - - /** Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */ - public ?bool $request_contact = null; - - /** Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only. */ - public ?bool $request_location = null; - - /** Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. */ - public ?KeyboardButtonPollType $request_poll = null; - - /** Optional. If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. */ - 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 bool $request_contact Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. - * @param bool $request_location Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only. - * @param KeyboardButtonPollType $request_poll Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. - * @param WebAppInfo $web_app Optional. If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. - */ - public static function make( - string $text, - ?bool $request_contact = null, - ?bool $request_location = null, - ?KeyboardButtonPollType $request_poll = null, - ?WebAppInfo $web_app = null - ): static { - return new static([ - 'text' => $text, - 'request_contact' => $request_contact, - 'request_location' => $request_location, - 'request_poll' => $request_poll, - 'web_app' => $web_app, - ]); - } + /** Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed */ + public string $text; + + /** Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. */ + public ?bool $request_contact = null; + + /** Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only. */ + public ?bool $request_location = null; + + /** Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. */ + public ?KeyboardButtonPollType $request_poll = null; + + /** Optional. If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. */ + 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 bool $request_contact Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only. + * @param bool $request_location Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only. + * @param KeyboardButtonPollType $request_poll Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only. + * @param WebAppInfo $web_app Optional. If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only. + */ + public static function make( + string $text, + ?bool $request_contact = null, + ?bool $request_location = null, + ?KeyboardButtonPollType $request_poll = null, + ?WebAppInfo $web_app = null + ): static { + return new static([ + 'text' => $text, + 'request_contact' => $request_contact, + 'request_location' => $request_location, + 'request_poll' => $request_poll, + 'web_app' => $web_app, + ]); + } } diff --git a/src/Telegram/KeyboardButtonPollType.php b/src/Telegram/KeyboardButtonPollType.php index f107cbf..8f510bc 100644 --- a/src/Telegram/KeyboardButtonPollType.php +++ b/src/Telegram/KeyboardButtonPollType.php @@ -11,17 +11,16 @@ */ class KeyboardButtonPollType extends \Tii\Telepath\Type { - /** Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */ - public ?string $type = null; + /** Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. */ + public ?string $type = null; - - /** - * @param string $type Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. - */ - public static function make(?string $type = null): static - { - return new static([ - 'type' => $type, - ]); - } + /** + * @param string $type Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type. + */ + public static function make(?string $type = null): static + { + return new static([ + 'type' => $type, + ]); + } } diff --git a/src/Telegram/LabeledPrice.php b/src/Telegram/LabeledPrice.php index e7e9284..1380386 100644 --- a/src/Telegram/LabeledPrice.php +++ b/src/Telegram/LabeledPrice.php @@ -11,22 +11,21 @@ */ class LabeledPrice extends \Tii\Telepath\Type { - /** Portion label */ - public string $label; + /** Portion label */ + public string $label; - /** Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ - public int $amount; + /** Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ + public int $amount; - - /** - * @param string $label Portion label - * @param int $amount Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - */ - public static function make(string $label, int $amount): static - { - return new static([ - 'label' => $label, - 'amount' => $amount, - ]); - } + /** + * @param string $label Portion label + * @param int $amount Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). + */ + public static function make(string $label, int $amount): static + { + return new static([ + 'label' => $label, + 'amount' => $amount, + ]); + } } diff --git a/src/Telegram/Location.php b/src/Telegram/Location.php index 6f293b5..07a2029 100644 --- a/src/Telegram/Location.php +++ b/src/Telegram/Location.php @@ -11,48 +11,47 @@ */ class Location extends \Tii\Telepath\Type { - /** Longitude as defined by sender */ - public float $longitude; - - /** Latitude as defined by sender */ - public float $latitude; - - /** Optional. The radius of uncertainty for the location, measured in meters; 0-1500 */ - public ?float $horizontal_accuracy = null; - - /** Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only. */ - public ?int $live_period = null; - - /** Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only. */ - public ?int $heading = null; - - /** Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */ - public ?int $proximity_alert_radius = null; - - - /** - * @param float $longitude Longitude as defined by sender - * @param float $latitude Latitude as defined by sender - * @param float $horizontal_accuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500 - * @param int $live_period Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only. - * @param int $heading Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only. - * @param int $proximity_alert_radius Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. - */ - public static function make( - float $longitude, - float $latitude, - ?float $horizontal_accuracy = null, - ?int $live_period = null, - ?int $heading = null, - ?int $proximity_alert_radius = null - ): static { - return new static([ - 'longitude' => $longitude, - 'latitude' => $latitude, - 'horizontal_accuracy' => $horizontal_accuracy, - 'live_period' => $live_period, - 'heading' => $heading, - 'proximity_alert_radius' => $proximity_alert_radius, - ]); - } + /** Longitude as defined by sender */ + public float $longitude; + + /** Latitude as defined by sender */ + public float $latitude; + + /** Optional. The radius of uncertainty for the location, measured in meters; 0-1500 */ + public ?float $horizontal_accuracy = null; + + /** Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only. */ + public ?int $live_period = null; + + /** Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only. */ + public ?int $heading = null; + + /** Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. */ + public ?int $proximity_alert_radius = null; + + /** + * @param float $longitude Longitude as defined by sender + * @param float $latitude Latitude as defined by sender + * @param float $horizontal_accuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500 + * @param int $live_period Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only. + * @param int $heading Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only. + * @param int $proximity_alert_radius Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only. + */ + public static function make( + float $longitude, + float $latitude, + ?float $horizontal_accuracy = null, + ?int $live_period = null, + ?int $heading = null, + ?int $proximity_alert_radius = null + ): static { + return new static([ + 'longitude' => $longitude, + 'latitude' => $latitude, + 'horizontal_accuracy' => $horizontal_accuracy, + 'live_period' => $live_period, + 'heading' => $heading, + 'proximity_alert_radius' => $proximity_alert_radius, + ]); + } } diff --git a/src/Telegram/LoginUrl.php b/src/Telegram/LoginUrl.php index 3b244c9..3cd4a10 100644 --- a/src/Telegram/LoginUrl.php +++ b/src/Telegram/LoginUrl.php @@ -11,36 +11,35 @@ */ class LoginUrl extends \Tii\Telepath\Type { - /** An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization. */ - public string $url; - - /** Optional. New text of the button in forwarded messages. */ - public ?string $forward_text = null; - - /** Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. */ - public ?string $bot_username = null; - - /** Optional. Pass True to request the permission for your bot to send messages to the user. */ - public ?bool $request_write_access = null; - - - /** - * @param string $url An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization. - * @param string $forward_text Optional. New text of the button in forwarded messages. - * @param string $bot_username Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. - * @param bool $request_write_access Optional. Pass True to request the permission for your bot to send messages to the user. - */ - public static function make( - string $url, - ?string $forward_text = null, - ?string $bot_username = null, - ?bool $request_write_access = null - ): static { - return new static([ - 'url' => $url, - 'forward_text' => $forward_text, - 'bot_username' => $bot_username, - 'request_write_access' => $request_write_access, - ]); - } + /** An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization. */ + public string $url; + + /** Optional. New text of the button in forwarded messages. */ + public ?string $forward_text = null; + + /** Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. */ + public ?string $bot_username = null; + + /** Optional. Pass True to request the permission for your bot to send messages to the user. */ + public ?bool $request_write_access = null; + + /** + * @param string $url An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.NOTE: You must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization. + * @param string $forward_text Optional. New text of the button in forwarded messages. + * @param string $bot_username Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. + * @param bool $request_write_access Optional. Pass True to request the permission for your bot to send messages to the user. + */ + public static function make( + string $url, + ?string $forward_text = null, + ?string $bot_username = null, + ?bool $request_write_access = null + ): static { + return new static([ + 'url' => $url, + 'forward_text' => $forward_text, + 'bot_username' => $bot_username, + 'request_write_access' => $request_write_access, + ]); + } } diff --git a/src/Telegram/MaskPosition.php b/src/Telegram/MaskPosition.php index d70caaf..3e5893b 100644 --- a/src/Telegram/MaskPosition.php +++ b/src/Telegram/MaskPosition.php @@ -11,32 +11,31 @@ */ class MaskPosition extends \Tii\Telepath\Type { - /** The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”. */ - public string $point; - - /** Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. */ - public float $x_shift; - - /** Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. */ - public float $y_shift; - - /** Mask scaling coefficient. For example, 2.0 means double size. */ - public float $scale; - - - /** - * @param string $point The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”. - * @param float $x_shift Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. - * @param float $y_shift Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. - * @param float $scale Mask scaling coefficient. For example, 2.0 means double size. - */ - public static function make(string $point, float $x_shift, float $y_shift, float $scale): static - { - return new static([ - 'point' => $point, - 'x_shift' => $x_shift, - 'y_shift' => $y_shift, - 'scale' => $scale, - ]); - } + /** The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”. */ + public string $point; + + /** Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. */ + public float $x_shift; + + /** Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. */ + public float $y_shift; + + /** Mask scaling coefficient. For example, 2.0 means double size. */ + public float $scale; + + /** + * @param string $point The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”. + * @param float $x_shift Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position. + * @param float $y_shift Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position. + * @param float $scale Mask scaling coefficient. For example, 2.0 means double size. + */ + public static function make(string $point, float $x_shift, float $y_shift, float $scale): static + { + return new static([ + 'point' => $point, + 'x_shift' => $x_shift, + 'y_shift' => $y_shift, + 'scale' => $scale, + ]); + } } diff --git a/src/Telegram/MenuButton.php b/src/Telegram/MenuButton.php index 7c348ab..0c1d79f 100644 --- a/src/Telegram/MenuButton.php +++ b/src/Telegram/MenuButton.php @@ -11,16 +11,15 @@ */ abstract class MenuButton extends \Tii\Telepath\Type { - /** Type of the button */ - public string $type; + /** Type of the button */ + public string $type; - - public static function factory(array $data): static - { - return match($data['type']) { - 'commands' => new MenuButtonCommands($data) - 'web_app' => new MenuButtonWebApp($data) - 'default' => new MenuButtonDefault($data) - }; - } + public static function factory(array $data): static + { + return match($data['type']) { + 'commands' => new MenuButtonCommands($data) + 'web_app' => new MenuButtonWebApp($data) + 'default' => new MenuButtonDefault($data) + }; + } } diff --git a/src/Telegram/MenuButtonCommands.php b/src/Telegram/MenuButtonCommands.php index b00cb72..5763336 100644 --- a/src/Telegram/MenuButtonCommands.php +++ b/src/Telegram/MenuButtonCommands.php @@ -11,13 +11,12 @@ */ class MenuButtonCommands extends MenuButton { - /** Type of the button, must be commands */ - public string $type = 'commands'; + /** Type of the button, must be commands */ + public string $type = 'commands'; - - public static function make(): static - { - return new static([ - ]); - } + public static function make(): static + { + return new static([ + ]); + } } diff --git a/src/Telegram/MenuButtonDefault.php b/src/Telegram/MenuButtonDefault.php index b67e7f1..70db62a 100644 --- a/src/Telegram/MenuButtonDefault.php +++ b/src/Telegram/MenuButtonDefault.php @@ -11,13 +11,12 @@ */ class MenuButtonDefault extends MenuButton { - /** Type of the button, must be default */ - public string $type = 'default'; + /** Type of the button, must be default */ + public string $type = 'default'; - - public static function make(): static - { - return new static([ - ]); - } + public static function make(): static + { + return new static([ + ]); + } } diff --git a/src/Telegram/MenuButtonWebApp.php b/src/Telegram/MenuButtonWebApp.php index 14f1e83..2eac582 100644 --- a/src/Telegram/MenuButtonWebApp.php +++ b/src/Telegram/MenuButtonWebApp.php @@ -11,25 +11,24 @@ */ class MenuButtonWebApp extends MenuButton { - /** Type of the button, must be web_app */ - public string $type = 'web_app'; + /** Type of the button, must be web_app */ + public string $type = 'web_app'; - /** Text on the button */ - public string $text; + /** Text on the button */ + public string $text; - /** Description of the Web App 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 answerWebAppQuery. */ - public WebAppInfo $web_app; + /** Description of the Web App 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 answerWebAppQuery. */ + public WebAppInfo $web_app; - - /** - * @param string $text Text on the button - * @param WebAppInfo $web_app Description of the Web App 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 answerWebAppQuery. - */ - public static function make(string $text, WebAppInfo $web_app): static - { - return new static([ - 'text' => $text, - 'web_app' => $web_app, - ]); - } + /** + * @param string $text Text on the button + * @param WebAppInfo $web_app Description of the Web App 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 answerWebAppQuery. + */ + public static function make(string $text, WebAppInfo $web_app): static + { + return new static([ + 'text' => $text, + 'web_app' => $web_app, + ]); + } } diff --git a/src/Telegram/Message.php b/src/Telegram/Message.php index 0b72b57..f387192 100644 --- a/src/Telegram/Message.php +++ b/src/Telegram/Message.php @@ -11,381 +11,380 @@ */ class Message extends \Tii\Telepath\Type { - /** Unique message identifier inside this chat */ - public int $message_id; + /** Unique message identifier inside this chat */ + public int $message_id; - /** Date the message was sent in Unix time */ - public int $date; + /** Date the message was sent in Unix time */ + public int $date; - /** Conversation the message belongs to */ - public Chat $chat; + /** Conversation the message belongs to */ + public Chat $chat; - /** Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */ - public ?User $from = null; + /** Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */ + public ?User $from = null; - /** Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */ - public ?Chat $sender_chat = null; + /** Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. */ + public ?Chat $sender_chat = null; - /** Optional. For forwarded messages, sender of the original message */ - public ?User $forward_from = null; + /** Optional. For forwarded messages, sender of the original message */ + public ?User $forward_from = null; - /** Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat */ - public ?Chat $forward_from_chat = null; + /** Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat */ + public ?Chat $forward_from_chat = null; - /** Optional. For messages forwarded from channels, identifier of the original message in the channel */ - public ?int $forward_from_message_id = null; + /** Optional. For messages forwarded from channels, identifier of the original message in the channel */ + public ?int $forward_from_message_id = null; - /** Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */ - public ?string $forward_signature = null; + /** Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present */ + public ?string $forward_signature = null; - /** Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */ - public ?string $forward_sender_name = null; + /** Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages */ + public ?string $forward_sender_name = null; - /** Optional. For forwarded messages, date the original message was sent in Unix time */ - public ?int $forward_date = null; + /** Optional. For forwarded messages, date the original message was sent in Unix time */ + public ?int $forward_date = null; - /** Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group */ - public ?bool $is_automatic_forward = null; + /** Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group */ + public ?bool $is_automatic_forward = null; - /** Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */ - public ?Message $reply_to_message = null; + /** Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. */ + public ?Message $reply_to_message = null; - /** Optional. Bot through which the message was sent */ - public ?User $via_bot = null; + /** Optional. Bot through which the message was sent */ + public ?User $via_bot = null; - /** Optional. Date the message was last edited in Unix time */ - public ?int $edit_date = null; + /** Optional. Date the message was last edited in Unix time */ + public ?int $edit_date = null; - /** Optional. True, if the message can't be forwarded */ - public ?bool $has_protected_content = null; + /** Optional. True, if the message can't be forwarded */ + public ?bool $has_protected_content = null; - /** Optional. The unique identifier of a media message group this message belongs to */ - public ?string $media_group_id = null; + /** Optional. The unique identifier of a media message group this message belongs to */ + public ?string $media_group_id = null; - /** Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */ - public ?string $author_signature = null; + /** Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator */ + public ?string $author_signature = null; - /** Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters */ - public ?string $text = null; + /** Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters */ + public ?string $text = null; - /** - * Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text - * @var MessageEntity[] - */ - public ?array $entities = null; + /** + * Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text + * @var MessageEntity[] + */ + public ?array $entities = null; - /** Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set */ - public ?Animation $animation = null; + /** Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set */ + public ?Animation $animation = null; - /** Optional. Message is an audio file, information about the file */ - public ?Audio $audio = null; + /** Optional. Message is an audio file, information about the file */ + public ?Audio $audio = null; - /** Optional. Message is a general file, information about the file */ - public ?Document $document = null; + /** Optional. Message is a general file, information about the file */ + public ?Document $document = null; - /** - * Optional. Message is a photo, available sizes of the photo - * @var PhotoSize[] - */ - public ?array $photo = null; + /** + * Optional. Message is a photo, available sizes of the photo + * @var PhotoSize[] + */ + public ?array $photo = null; - /** Optional. Message is a sticker, information about the sticker */ - public ?Sticker $sticker = null; + /** Optional. Message is a sticker, information about the sticker */ + public ?Sticker $sticker = null; - /** Optional. Message is a video, information about the video */ - public ?Video $video = null; + /** Optional. Message is a video, information about the video */ + public ?Video $video = null; - /** Optional. Message is a video note, information about the video message */ - public ?VideoNote $video_note = null; + /** Optional. Message is a video note, information about the video message */ + public ?VideoNote $video_note = null; - /** Optional. Message is a voice message, information about the file */ - public ?Voice $voice = null; + /** Optional. Message is a voice message, information about the file */ + public ?Voice $voice = null; - /** Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters */ - public ?string $caption = null; + /** Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters */ + public ?string $caption = null; - /** - * Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption - * @var MessageEntity[] - */ - public ?array $caption_entities = null; + /** + * Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption + * @var MessageEntity[] + */ + public ?array $caption_entities = null; - /** Optional. Message is a shared contact, information about the contact */ - public ?Contact $contact = null; + /** Optional. Message is a shared contact, information about the contact */ + public ?Contact $contact = null; - /** Optional. Message is a dice with random value */ - public ?Dice $dice = null; + /** Optional. Message is a dice with random value */ + public ?Dice $dice = null; - /** Optional. Message is a game, information about the game. More about games » */ - public ?Game $game = null; + /** Optional. Message is a game, information about the game. More about games » */ + public ?Game $game = null; - /** Optional. Message is a native poll, information about the poll */ - public ?Poll $poll = null; + /** Optional. Message is a native poll, information about the poll */ + public ?Poll $poll = null; - /** Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */ - public ?Venue $venue = null; + /** Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set */ + public ?Venue $venue = null; - /** Optional. Message is a shared location, information about the location */ - public ?Location $location = null; + /** Optional. Message is a shared location, information about the location */ + public ?Location $location = null; - /** - * Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) - * @var User[] - */ - public ?array $new_chat_members = null; + /** + * Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members) + * @var User[] + */ + public ?array $new_chat_members = null; - /** Optional. A member was removed from the group, information about them (this member may be the bot itself) */ - public ?User $left_chat_member = null; + /** Optional. A member was removed from the group, information about them (this member may be the bot itself) */ + public ?User $left_chat_member = null; - /** Optional. A chat title was changed to this value */ - public ?string $new_chat_title = null; + /** Optional. A chat title was changed to this value */ + public ?string $new_chat_title = null; - /** - * Optional. A chat photo was change to this value - * @var PhotoSize[] - */ - public ?array $new_chat_photo = null; - - /** Optional. Service message: the chat photo was deleted */ - public ?bool $delete_chat_photo = null; - - /** Optional. Service message: the group has been created */ - public ?bool $group_chat_created = null; - - /** Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */ - public ?bool $supergroup_chat_created = null; - - /** Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */ - public ?bool $channel_chat_created = null; - - /** Optional. Service message: auto-delete timer settings changed in the chat */ - public ?MessageAutoDeleteTimerChanged $message_auto_delete_timer_changed = null; - - /** Optional. The group has been migrated to a supergroup with the specified identifier. 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. */ - public ?int $migrate_to_chat_id = null; - - /** Optional. The supergroup has been migrated from a group with the specified identifier. 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. */ - public ?int $migrate_from_chat_id = null; - - /** Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */ - public ?Message $pinned_message = null; - - /** Optional. Message is an invoice for a payment, information about the invoice. More about payments » */ - public ?Invoice $invoice = null; - - /** Optional. Message is a service message about a successful payment, information about the payment. More about payments » */ - public ?SuccessfulPayment $successful_payment = null; - - /** Optional. The domain name of the website on which the user has logged in. More about Telegram Login » */ - public ?string $connected_website = null; - - /** Optional. Telegram Passport data */ - public ?PassportData $passport_data = null; - - /** Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */ - public ?ProximityAlertTriggered $proximity_alert_triggered = null; - - /** Optional. Service message: video chat scheduled */ - public ?VideoChatScheduled $video_chat_scheduled = null; - - /** Optional. Service message: video chat started */ - public ?VideoChatStarted $video_chat_started = null; - - /** Optional. Service message: video chat ended */ - public ?VideoChatEnded $video_chat_ended = null; - - /** Optional. Service message: new participants invited to a video chat */ - public ?VideoChatParticipantsInvited $video_chat_participants_invited = null; - - /** Optional. Service message: data sent by a Web App */ - public ?WebAppData $web_app_data = null; - - /** Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */ - public ?InlineKeyboardMarkup $reply_markup = null; - - - /** - * @param int $message_id Unique message identifier inside this chat - * @param int $date Date the message was sent in Unix time - * @param Chat $chat Conversation the message belongs to - * @param User $from Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. - * @param Chat $sender_chat Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. - * @param User $forward_from Optional. For forwarded messages, sender of the original message - * @param Chat $forward_from_chat Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat - * @param int $forward_from_message_id Optional. For messages forwarded from channels, identifier of the original message in the channel - * @param string $forward_signature Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present - * @param string $forward_sender_name Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages - * @param int $forward_date Optional. For forwarded messages, date the original message was sent in Unix time - * @param bool $is_automatic_forward Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group - * @param Message $reply_to_message Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. - * @param User $via_bot Optional. Bot through which the message was sent - * @param int $edit_date Optional. Date the message was last edited in Unix time - * @param bool $has_protected_content Optional. True, if the message can't be forwarded - * @param string $media_group_id Optional. The unique identifier of a media message group this message belongs to - * @param string $author_signature Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator - * @param string $text Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters - * @param MessageEntity[] $entities Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text - * @param Animation $animation Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set - * @param Audio $audio Optional. Message is an audio file, information about the file - * @param Document $document Optional. Message is a general file, information about the file - * @param PhotoSize[] $photo Optional. Message is a photo, available sizes of the photo - * @param Sticker $sticker Optional. Message is a sticker, information about the sticker - * @param Video $video Optional. Message is a video, information about the video - * @param VideoNote $video_note Optional. Message is a video note, information about the video message - * @param Voice $voice Optional. Message is a voice message, information about the file - * @param string $caption Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters - * @param MessageEntity[] $caption_entities Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption - * @param Contact $contact Optional. Message is a shared contact, information about the contact - * @param Dice $dice Optional. Message is a dice with random value - * @param Game $game Optional. Message is a game, information about the game. More about games » - * @param Poll $poll Optional. Message is a native poll, information about the poll - * @param Venue $venue Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set - * @param Location $location Optional. Message is a shared location, information about the location - * @param User[] $new_chat_members Optional. 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 Optional. A member was removed from the group, information about them (this member may be the bot itself) - * @param string $new_chat_title Optional. A chat title was changed to this value - * @param PhotoSize[] $new_chat_photo Optional. A chat photo was change to this value - * @param bool $delete_chat_photo Optional. Service message: the chat photo was deleted - * @param bool $group_chat_created Optional. Service message: the group has been created - * @param bool $supergroup_chat_created Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. - * @param bool $channel_chat_created Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. - * @param MessageAutoDeleteTimerChanged $message_auto_delete_timer_changed Optional. Service message: auto-delete timer settings changed in the chat - * @param int $migrate_to_chat_id Optional. The group has been migrated to a supergroup with the specified identifier. 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. - * @param int $migrate_from_chat_id Optional. The supergroup has been migrated from a group with the specified identifier. 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. - * @param Message $pinned_message Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. - * @param Invoice $invoice Optional. Message is an invoice for a payment, information about the invoice. More about payments » - * @param SuccessfulPayment $successful_payment Optional. Message is a service message about a successful payment, information about the payment. More about payments » - * @param string $connected_website Optional. The domain name of the website on which the user has logged in. More about Telegram Login » - * @param PassportData $passport_data Optional. Telegram Passport data - * @param ProximityAlertTriggered $proximity_alert_triggered Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. - * @param VideoChatScheduled $video_chat_scheduled Optional. Service message: video chat scheduled - * @param VideoChatStarted $video_chat_started Optional. Service message: video chat started - * @param VideoChatEnded $video_chat_ended Optional. Service message: video chat ended - * @param VideoChatParticipantsInvited $video_chat_participants_invited Optional. Service message: new participants invited to a video chat - * @param WebAppData $web_app_data Optional. Service message: data sent by a Web App - * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. - */ - public static function make( - int $message_id, - int $date, - Chat $chat, - ?User $from = null, - ?Chat $sender_chat = null, - ?User $forward_from = null, - ?Chat $forward_from_chat = null, - ?int $forward_from_message_id = null, - ?string $forward_signature = null, - ?string $forward_sender_name = null, - ?int $forward_date = null, - ?bool $is_automatic_forward = null, - ?Message $reply_to_message = null, - ?User $via_bot = null, - ?int $edit_date = null, - ?bool $has_protected_content = null, - ?string $media_group_id = null, - ?string $author_signature = null, - ?string $text = null, - ?array $entities = null, - ?Animation $animation = null, - ?Audio $audio = null, - ?Document $document = null, - ?array $photo = null, - ?Sticker $sticker = null, - ?Video $video = null, - ?VideoNote $video_note = null, - ?Voice $voice = null, - ?string $caption = null, - ?array $caption_entities = null, - ?Contact $contact = null, - ?Dice $dice = null, - ?Game $game = null, - ?Poll $poll = null, - ?Venue $venue = null, - ?Location $location = null, - ?array $new_chat_members = null, - ?User $left_chat_member = null, - ?string $new_chat_title = null, - ?array $new_chat_photo = null, - ?bool $delete_chat_photo = null, - ?bool $group_chat_created = null, - ?bool $supergroup_chat_created = null, - ?bool $channel_chat_created = null, - ?MessageAutoDeleteTimerChanged $message_auto_delete_timer_changed = null, - ?int $migrate_to_chat_id = null, - ?int $migrate_from_chat_id = null, - ?Message $pinned_message = null, - ?Invoice $invoice = null, - ?SuccessfulPayment $successful_payment = null, - ?string $connected_website = null, - ?PassportData $passport_data = null, - ?ProximityAlertTriggered $proximity_alert_triggered = null, - ?VideoChatScheduled $video_chat_scheduled = null, - ?VideoChatStarted $video_chat_started = null, - ?VideoChatEnded $video_chat_ended = null, - ?VideoChatParticipantsInvited $video_chat_participants_invited = null, - ?WebAppData $web_app_data = null, - ?InlineKeyboardMarkup $reply_markup = null - ): static { - return new static([ - 'message_id' => $message_id, - 'date' => $date, - 'chat' => $chat, - 'from' => $from, - 'sender_chat' => $sender_chat, - 'forward_from' => $forward_from, - 'forward_from_chat' => $forward_from_chat, - 'forward_from_message_id' => $forward_from_message_id, - 'forward_signature' => $forward_signature, - 'forward_sender_name' => $forward_sender_name, - 'forward_date' => $forward_date, - 'is_automatic_forward' => $is_automatic_forward, - 'reply_to_message' => $reply_to_message, - 'via_bot' => $via_bot, - 'edit_date' => $edit_date, - 'has_protected_content' => $has_protected_content, - 'media_group_id' => $media_group_id, - 'author_signature' => $author_signature, - 'text' => $text, - 'entities' => $entities, - 'animation' => $animation, - 'audio' => $audio, - 'document' => $document, - 'photo' => $photo, - 'sticker' => $sticker, - 'video' => $video, - 'video_note' => $video_note, - 'voice' => $voice, - 'caption' => $caption, - 'caption_entities' => $caption_entities, - 'contact' => $contact, - 'dice' => $dice, - 'game' => $game, - 'poll' => $poll, - 'venue' => $venue, - 'location' => $location, - 'new_chat_members' => $new_chat_members, - 'left_chat_member' => $left_chat_member, - 'new_chat_title' => $new_chat_title, - 'new_chat_photo' => $new_chat_photo, - 'delete_chat_photo' => $delete_chat_photo, - 'group_chat_created' => $group_chat_created, - 'supergroup_chat_created' => $supergroup_chat_created, - 'channel_chat_created' => $channel_chat_created, - 'message_auto_delete_timer_changed' => $message_auto_delete_timer_changed, - 'migrate_to_chat_id' => $migrate_to_chat_id, - 'migrate_from_chat_id' => $migrate_from_chat_id, - 'pinned_message' => $pinned_message, - 'invoice' => $invoice, - 'successful_payment' => $successful_payment, - 'connected_website' => $connected_website, - 'passport_data' => $passport_data, - 'proximity_alert_triggered' => $proximity_alert_triggered, - 'video_chat_scheduled' => $video_chat_scheduled, - 'video_chat_started' => $video_chat_started, - 'video_chat_ended' => $video_chat_ended, - 'video_chat_participants_invited' => $video_chat_participants_invited, - 'web_app_data' => $web_app_data, - 'reply_markup' => $reply_markup, - ]); - } + /** + * Optional. A chat photo was change to this value + * @var PhotoSize[] + */ + public ?array $new_chat_photo = null; + + /** Optional. Service message: the chat photo was deleted */ + public ?bool $delete_chat_photo = null; + + /** Optional. Service message: the group has been created */ + public ?bool $group_chat_created = null; + + /** Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. */ + public ?bool $supergroup_chat_created = null; + + /** Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */ + public ?bool $channel_chat_created = null; + + /** Optional. Service message: auto-delete timer settings changed in the chat */ + public ?MessageAutoDeleteTimerChanged $message_auto_delete_timer_changed = null; + + /** Optional. The group has been migrated to a supergroup with the specified identifier. 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. */ + public ?int $migrate_to_chat_id = null; + + /** Optional. The supergroup has been migrated from a group with the specified identifier. 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. */ + public ?int $migrate_from_chat_id = null; + + /** Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. */ + public ?Message $pinned_message = null; + + /** Optional. Message is an invoice for a payment, information about the invoice. More about payments » */ + public ?Invoice $invoice = null; + + /** Optional. Message is a service message about a successful payment, information about the payment. More about payments » */ + public ?SuccessfulPayment $successful_payment = null; + + /** Optional. The domain name of the website on which the user has logged in. More about Telegram Login » */ + public ?string $connected_website = null; + + /** Optional. Telegram Passport data */ + public ?PassportData $passport_data = null; + + /** Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. */ + public ?ProximityAlertTriggered $proximity_alert_triggered = null; + + /** Optional. Service message: video chat scheduled */ + public ?VideoChatScheduled $video_chat_scheduled = null; + + /** Optional. Service message: video chat started */ + public ?VideoChatStarted $video_chat_started = null; + + /** Optional. Service message: video chat ended */ + public ?VideoChatEnded $video_chat_ended = null; + + /** Optional. Service message: new participants invited to a video chat */ + public ?VideoChatParticipantsInvited $video_chat_participants_invited = null; + + /** Optional. Service message: data sent by a Web App */ + public ?WebAppData $web_app_data = null; + + /** Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */ + public ?InlineKeyboardMarkup $reply_markup = null; + + /** + * @param int $message_id Unique message identifier inside this chat + * @param int $date Date the message was sent in Unix time + * @param Chat $chat Conversation the message belongs to + * @param User $from Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. + * @param Chat $sender_chat Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat. + * @param User $forward_from Optional. For forwarded messages, sender of the original message + * @param Chat $forward_from_chat Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat + * @param int $forward_from_message_id Optional. For messages forwarded from channels, identifier of the original message in the channel + * @param string $forward_signature Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present + * @param string $forward_sender_name Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages + * @param int $forward_date Optional. For forwarded messages, date the original message was sent in Unix time + * @param bool $is_automatic_forward Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group + * @param Message $reply_to_message Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. + * @param User $via_bot Optional. Bot through which the message was sent + * @param int $edit_date Optional. Date the message was last edited in Unix time + * @param bool $has_protected_content Optional. True, if the message can't be forwarded + * @param string $media_group_id Optional. The unique identifier of a media message group this message belongs to + * @param string $author_signature Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator + * @param string $text Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters + * @param MessageEntity[] $entities Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text + * @param Animation $animation Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set + * @param Audio $audio Optional. Message is an audio file, information about the file + * @param Document $document Optional. Message is a general file, information about the file + * @param PhotoSize[] $photo Optional. Message is a photo, available sizes of the photo + * @param Sticker $sticker Optional. Message is a sticker, information about the sticker + * @param Video $video Optional. Message is a video, information about the video + * @param VideoNote $video_note Optional. Message is a video note, information about the video message + * @param Voice $voice Optional. Message is a voice message, information about the file + * @param string $caption Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters + * @param MessageEntity[] $caption_entities Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption + * @param Contact $contact Optional. Message is a shared contact, information about the contact + * @param Dice $dice Optional. Message is a dice with random value + * @param Game $game Optional. Message is a game, information about the game. More about games » + * @param Poll $poll Optional. Message is a native poll, information about the poll + * @param Venue $venue Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set + * @param Location $location Optional. Message is a shared location, information about the location + * @param User[] $new_chat_members Optional. 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 Optional. A member was removed from the group, information about them (this member may be the bot itself) + * @param string $new_chat_title Optional. A chat title was changed to this value + * @param PhotoSize[] $new_chat_photo Optional. A chat photo was change to this value + * @param bool $delete_chat_photo Optional. Service message: the chat photo was deleted + * @param bool $group_chat_created Optional. Service message: the group has been created + * @param bool $supergroup_chat_created Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup. + * @param bool $channel_chat_created Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. + * @param MessageAutoDeleteTimerChanged $message_auto_delete_timer_changed Optional. Service message: auto-delete timer settings changed in the chat + * @param int $migrate_to_chat_id Optional. The group has been migrated to a supergroup with the specified identifier. 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. + * @param int $migrate_from_chat_id Optional. The supergroup has been migrated from a group with the specified identifier. 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. + * @param Message $pinned_message Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply. + * @param Invoice $invoice Optional. Message is an invoice for a payment, information about the invoice. More about payments » + * @param SuccessfulPayment $successful_payment Optional. Message is a service message about a successful payment, information about the payment. More about payments » + * @param string $connected_website Optional. The domain name of the website on which the user has logged in. More about Telegram Login » + * @param PassportData $passport_data Optional. Telegram Passport data + * @param ProximityAlertTriggered $proximity_alert_triggered Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location. + * @param VideoChatScheduled $video_chat_scheduled Optional. Service message: video chat scheduled + * @param VideoChatStarted $video_chat_started Optional. Service message: video chat started + * @param VideoChatEnded $video_chat_ended Optional. Service message: video chat ended + * @param VideoChatParticipantsInvited $video_chat_participants_invited Optional. Service message: new participants invited to a video chat + * @param WebAppData $web_app_data Optional. Service message: data sent by a Web App + * @param InlineKeyboardMarkup $reply_markup Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. + */ + public static function make( + int $message_id, + int $date, + Chat $chat, + ?User $from = null, + ?Chat $sender_chat = null, + ?User $forward_from = null, + ?Chat $forward_from_chat = null, + ?int $forward_from_message_id = null, + ?string $forward_signature = null, + ?string $forward_sender_name = null, + ?int $forward_date = null, + ?bool $is_automatic_forward = null, + ?Message $reply_to_message = null, + ?User $via_bot = null, + ?int $edit_date = null, + ?bool $has_protected_content = null, + ?string $media_group_id = null, + ?string $author_signature = null, + ?string $text = null, + ?array $entities = null, + ?Animation $animation = null, + ?Audio $audio = null, + ?Document $document = null, + ?array $photo = null, + ?Sticker $sticker = null, + ?Video $video = null, + ?VideoNote $video_note = null, + ?Voice $voice = null, + ?string $caption = null, + ?array $caption_entities = null, + ?Contact $contact = null, + ?Dice $dice = null, + ?Game $game = null, + ?Poll $poll = null, + ?Venue $venue = null, + ?Location $location = null, + ?array $new_chat_members = null, + ?User $left_chat_member = null, + ?string $new_chat_title = null, + ?array $new_chat_photo = null, + ?bool $delete_chat_photo = null, + ?bool $group_chat_created = null, + ?bool $supergroup_chat_created = null, + ?bool $channel_chat_created = null, + ?MessageAutoDeleteTimerChanged $message_auto_delete_timer_changed = null, + ?int $migrate_to_chat_id = null, + ?int $migrate_from_chat_id = null, + ?Message $pinned_message = null, + ?Invoice $invoice = null, + ?SuccessfulPayment $successful_payment = null, + ?string $connected_website = null, + ?PassportData $passport_data = null, + ?ProximityAlertTriggered $proximity_alert_triggered = null, + ?VideoChatScheduled $video_chat_scheduled = null, + ?VideoChatStarted $video_chat_started = null, + ?VideoChatEnded $video_chat_ended = null, + ?VideoChatParticipantsInvited $video_chat_participants_invited = null, + ?WebAppData $web_app_data = null, + ?InlineKeyboardMarkup $reply_markup = null + ): static { + return new static([ + 'message_id' => $message_id, + 'date' => $date, + 'chat' => $chat, + 'from' => $from, + 'sender_chat' => $sender_chat, + 'forward_from' => $forward_from, + 'forward_from_chat' => $forward_from_chat, + 'forward_from_message_id' => $forward_from_message_id, + 'forward_signature' => $forward_signature, + 'forward_sender_name' => $forward_sender_name, + 'forward_date' => $forward_date, + 'is_automatic_forward' => $is_automatic_forward, + 'reply_to_message' => $reply_to_message, + 'via_bot' => $via_bot, + 'edit_date' => $edit_date, + 'has_protected_content' => $has_protected_content, + 'media_group_id' => $media_group_id, + 'author_signature' => $author_signature, + 'text' => $text, + 'entities' => $entities, + 'animation' => $animation, + 'audio' => $audio, + 'document' => $document, + 'photo' => $photo, + 'sticker' => $sticker, + 'video' => $video, + 'video_note' => $video_note, + 'voice' => $voice, + 'caption' => $caption, + 'caption_entities' => $caption_entities, + 'contact' => $contact, + 'dice' => $dice, + 'game' => $game, + 'poll' => $poll, + 'venue' => $venue, + 'location' => $location, + 'new_chat_members' => $new_chat_members, + 'left_chat_member' => $left_chat_member, + 'new_chat_title' => $new_chat_title, + 'new_chat_photo' => $new_chat_photo, + 'delete_chat_photo' => $delete_chat_photo, + 'group_chat_created' => $group_chat_created, + 'supergroup_chat_created' => $supergroup_chat_created, + 'channel_chat_created' => $channel_chat_created, + 'message_auto_delete_timer_changed' => $message_auto_delete_timer_changed, + 'migrate_to_chat_id' => $migrate_to_chat_id, + 'migrate_from_chat_id' => $migrate_from_chat_id, + 'pinned_message' => $pinned_message, + 'invoice' => $invoice, + 'successful_payment' => $successful_payment, + 'connected_website' => $connected_website, + 'passport_data' => $passport_data, + 'proximity_alert_triggered' => $proximity_alert_triggered, + 'video_chat_scheduled' => $video_chat_scheduled, + 'video_chat_started' => $video_chat_started, + 'video_chat_ended' => $video_chat_ended, + 'video_chat_participants_invited' => $video_chat_participants_invited, + 'web_app_data' => $web_app_data, + 'reply_markup' => $reply_markup, + ]); + } } diff --git a/src/Telegram/MessageAutoDeleteTimerChanged.php b/src/Telegram/MessageAutoDeleteTimerChanged.php index 9b6c55f..1fa12e9 100644 --- a/src/Telegram/MessageAutoDeleteTimerChanged.php +++ b/src/Telegram/MessageAutoDeleteTimerChanged.php @@ -11,17 +11,16 @@ */ class MessageAutoDeleteTimerChanged extends \Tii\Telepath\Type { - /** New auto-delete time for messages in the chat; in seconds */ - public int $message_auto_delete_time; + /** New auto-delete time for messages in the chat; in seconds */ + public int $message_auto_delete_time; - - /** - * @param int $message_auto_delete_time New auto-delete time for messages in the chat; in seconds - */ - public static function make(int $message_auto_delete_time): static - { - return new static([ - 'message_auto_delete_time' => $message_auto_delete_time, - ]); - } + /** + * @param int $message_auto_delete_time New auto-delete time for messages in the chat; in seconds + */ + public static function make(int $message_auto_delete_time): static + { + return new static([ + 'message_auto_delete_time' => $message_auto_delete_time, + ]); + } } diff --git a/src/Telegram/MessageEntity.php b/src/Telegram/MessageEntity.php index 102a779..51c1475 100644 --- a/src/Telegram/MessageEntity.php +++ b/src/Telegram/MessageEntity.php @@ -11,48 +11,47 @@ */ class MessageEntity extends \Tii\Telepath\Type { - /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames) */ - public string $type; - - /** Offset in UTF-16 code units to the start of the entity */ - public int $offset; - - /** Length of the entity in UTF-16 code units */ - public int $length; - - /** Optional. For “text_link” only, url that will be opened after user taps on the text */ - public ?string $url = null; - - /** Optional. For “text_mention” only, the mentioned user */ - public ?User $user = null; - - /** Optional. For “pre” only, the programming language of the entity text */ - public ?string $language = null; - - - /** - * @param string $type Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames) - * @param int $offset Offset in UTF-16 code units to the start of the entity - * @param int $length Length of the entity in UTF-16 code units - * @param string $url Optional. For “text_link” only, url that will be opened after user taps on the text - * @param User $user Optional. For “text_mention” only, the mentioned user - * @param string $language Optional. For “pre” only, the programming language of the entity text - */ - public static function make( - string $type, - int $offset, - int $length, - ?string $url = null, - ?User $user = null, - ?string $language = null - ): static { - return new static([ - 'type' => $type, - 'offset' => $offset, - 'length' => $length, - 'url' => $url, - 'user' => $user, - 'language' => $language, - ]); - } + /** Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames) */ + public string $type; + + /** Offset in UTF-16 code units to the start of the entity */ + public int $offset; + + /** Length of the entity in UTF-16 code units */ + public int $length; + + /** Optional. For “text_link” only, url that will be opened after user taps on the text */ + public ?string $url = null; + + /** Optional. For “text_mention” only, the mentioned user */ + public ?User $user = null; + + /** Optional. For “pre” only, the programming language of the entity text */ + public ?string $language = null; + + /** + * @param string $type Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames) + * @param int $offset Offset in UTF-16 code units to the start of the entity + * @param int $length Length of the entity in UTF-16 code units + * @param string $url Optional. For “text_link” only, url that will be opened after user taps on the text + * @param User $user Optional. For “text_mention” only, the mentioned user + * @param string $language Optional. For “pre” only, the programming language of the entity text + */ + public static function make( + string $type, + int $offset, + int $length, + ?string $url = null, + ?User $user = null, + ?string $language = null + ): static { + return new static([ + 'type' => $type, + 'offset' => $offset, + 'length' => $length, + 'url' => $url, + 'user' => $user, + 'language' => $language, + ]); + } } diff --git a/src/Telegram/MessageId.php b/src/Telegram/MessageId.php index a105400..e410968 100644 --- a/src/Telegram/MessageId.php +++ b/src/Telegram/MessageId.php @@ -11,17 +11,16 @@ */ class MessageId extends \Tii\Telepath\Type { - /** Unique message identifier */ - public int $message_id; + /** Unique message identifier */ + public int $message_id; - - /** - * @param int $message_id Unique message identifier - */ - public static function make(int $message_id): static - { - return new static([ - 'message_id' => $message_id, - ]); - } + /** + * @param int $message_id Unique message identifier + */ + public static function make(int $message_id): static + { + return new static([ + 'message_id' => $message_id, + ]); + } } diff --git a/src/Telegram/OrderInfo.php b/src/Telegram/OrderInfo.php index 2629774..d6b0fb2 100644 --- a/src/Telegram/OrderInfo.php +++ b/src/Telegram/OrderInfo.php @@ -11,36 +11,35 @@ */ class OrderInfo extends \Tii\Telepath\Type { - /** Optional. User name */ - public ?string $name = null; - - /** Optional. User's phone number */ - public ?string $phone_number = null; - - /** Optional. User email */ - public ?string $email = null; - - /** Optional. User shipping address */ - public ?ShippingAddress $shipping_address = null; - - - /** - * @param string $name Optional. User name - * @param string $phone_number Optional. User's phone number - * @param string $email Optional. User email - * @param ShippingAddress $shipping_address Optional. User shipping address - */ - public static function make( - ?string $name = null, - ?string $phone_number = null, - ?string $email = null, - ?ShippingAddress $shipping_address = null - ): static { - return new static([ - 'name' => $name, - 'phone_number' => $phone_number, - 'email' => $email, - 'shipping_address' => $shipping_address, - ]); - } + /** Optional. User name */ + public ?string $name = null; + + /** Optional. User's phone number */ + public ?string $phone_number = null; + + /** Optional. User email */ + public ?string $email = null; + + /** Optional. User shipping address */ + public ?ShippingAddress $shipping_address = null; + + /** + * @param string $name Optional. User name + * @param string $phone_number Optional. User's phone number + * @param string $email Optional. User email + * @param ShippingAddress $shipping_address Optional. User shipping address + */ + public static function make( + ?string $name = null, + ?string $phone_number = null, + ?string $email = null, + ?ShippingAddress $shipping_address = null + ): static { + return new static([ + 'name' => $name, + 'phone_number' => $phone_number, + 'email' => $email, + 'shipping_address' => $shipping_address, + ]); + } } diff --git a/src/Telegram/PassportData.php b/src/Telegram/PassportData.php index 0699b41..16ae41d 100644 --- a/src/Telegram/PassportData.php +++ b/src/Telegram/PassportData.php @@ -11,25 +11,24 @@ */ class PassportData extends \Tii\Telepath\Type { - /** - * Array with information about documents and other Telegram Passport elements that was shared with the bot - * @var EncryptedPassportElement[] - */ - public array $data; + /** + * Array with information about documents and other Telegram Passport elements that was shared with the bot + * @var EncryptedPassportElement[] + */ + public array $data; - /** Encrypted credentials required to decrypt the data */ - public EncryptedCredentials $credentials; + /** Encrypted credentials required to decrypt the data */ + public EncryptedCredentials $credentials; - - /** - * @param EncryptedPassportElement[] $data Array with information about documents and other Telegram Passport elements that was shared with the bot - * @param EncryptedCredentials $credentials Encrypted credentials required to decrypt the data - */ - public static function make(array $data, EncryptedCredentials $credentials): static - { - return new static([ - 'data' => $data, - 'credentials' => $credentials, - ]); - } + /** + * @param EncryptedPassportElement[] $data Array with information about documents and other Telegram Passport elements that was shared with the bot + * @param EncryptedCredentials $credentials Encrypted credentials required to decrypt the data + */ + public static function make(array $data, EncryptedCredentials $credentials): static + { + return new static([ + 'data' => $data, + 'credentials' => $credentials, + ]); + } } diff --git a/src/Telegram/PassportElementError.php b/src/Telegram/PassportElementError.php index 06fda95..bad562e 100644 --- a/src/Telegram/PassportElementError.php +++ b/src/Telegram/PassportElementError.php @@ -11,28 +11,27 @@ */ abstract class PassportElementError extends \Tii\Telepath\Type { - /** Error source */ - public string $source; + /** Error source */ + public string $source; - /** The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” */ - public string $type; + /** The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” */ + public string $type; - /** Error message */ - public string $message; + /** Error message */ + public string $message; - - public static function factory(array $data): static - { - return match($data['source']) { - 'data' => new PassportElementErrorDataField($data) - 'front_side' => new PassportElementErrorFrontSide($data) - 'reverse_side' => new PassportElementErrorReverseSide($data) - 'selfie' => new PassportElementErrorSelfie($data) - 'file' => new PassportElementErrorFile($data) - 'files' => new PassportElementErrorFiles($data) - 'translation_file' => new PassportElementErrorTranslationFile($data) - 'translation_files' => new PassportElementErrorTranslationFiles($data) - 'unspecified' => new PassportElementErrorUnspecified($data) - }; - } + public static function factory(array $data): static + { + return match($data['source']) { + 'data' => new PassportElementErrorDataField($data) + 'front_side' => new PassportElementErrorFrontSide($data) + 'reverse_side' => new PassportElementErrorReverseSide($data) + 'selfie' => new PassportElementErrorSelfie($data) + 'file' => new PassportElementErrorFile($data) + 'files' => new PassportElementErrorFiles($data) + 'translation_file' => new PassportElementErrorTranslationFile($data) + 'translation_files' => new PassportElementErrorTranslationFiles($data) + 'unspecified' => new PassportElementErrorUnspecified($data) + }; + } } diff --git a/src/Telegram/PassportElementErrorDataField.php b/src/Telegram/PassportElementErrorDataField.php index 81fe926..00ff3e4 100644 --- a/src/Telegram/PassportElementErrorDataField.php +++ b/src/Telegram/PassportElementErrorDataField.php @@ -11,29 +11,28 @@ */ class PassportElementErrorDataField extends PassportElementError { - /** Error source, must be data */ - public string $source = 'data'; + /** Error source, must be data */ + public string $source = 'data'; - /** Name of the data field which has the error */ - public string $field_name; + /** Name of the data field which has the error */ + public string $field_name; - /** Base64-encoded data hash */ - public string $data_hash; + /** Base64-encoded data hash */ + public string $data_hash; - - /** - * @param string $type The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” - * @param string $field_name Name of the data field which has the error - * @param string $data_hash Base64-encoded data hash - * @param string $message Error message - */ - public static function make(string $type, string $field_name, string $data_hash, string $message): static - { - return new static([ - 'type' => $type, - 'field_name' => $field_name, - 'data_hash' => $data_hash, - 'message' => $message, - ]); - } + /** + * @param string $type The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address” + * @param string $field_name Name of the data field which has the error + * @param string $data_hash Base64-encoded data hash + * @param string $message Error message + */ + public static function make(string $type, string $field_name, string $data_hash, string $message): static + { + return new static([ + 'type' => $type, + 'field_name' => $field_name, + 'data_hash' => $data_hash, + 'message' => $message, + ]); + } } diff --git a/src/Telegram/PassportElementErrorFile.php b/src/Telegram/PassportElementErrorFile.php index e04985b..a4eb500 100644 --- a/src/Telegram/PassportElementErrorFile.php +++ b/src/Telegram/PassportElementErrorFile.php @@ -11,24 +11,23 @@ */ class PassportElementErrorFile extends PassportElementError { - /** Error source, must be file */ - public string $source = 'file'; + /** Error source, must be file */ + public string $source = 'file'; - /** Base64-encoded file hash */ - public string $file_hash; + /** Base64-encoded file hash */ + public string $file_hash; - - /** - * @param string $type The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” - * @param string $file_hash Base64-encoded file hash - * @param string $message Error message - */ - public static function make(string $type, string $file_hash, string $message): static - { - return new static([ - 'type' => $type, - 'file_hash' => $file_hash, - 'message' => $message, - ]); - } + /** + * @param string $type The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” + * @param string $file_hash Base64-encoded file hash + * @param string $message Error message + */ + public static function make(string $type, string $file_hash, string $message): static + { + return new static([ + 'type' => $type, + 'file_hash' => $file_hash, + 'message' => $message, + ]); + } } diff --git a/src/Telegram/PassportElementErrorFiles.php b/src/Telegram/PassportElementErrorFiles.php index 4205671..2d94141 100644 --- a/src/Telegram/PassportElementErrorFiles.php +++ b/src/Telegram/PassportElementErrorFiles.php @@ -11,27 +11,26 @@ */ class PassportElementErrorFiles extends PassportElementError { - /** Error source, must be files */ - public string $source = 'files'; + /** Error source, must be files */ + public string $source = 'files'; - /** - * List of base64-encoded file hashes - * @var string[] - */ - public array $file_hashes; + /** + * List of base64-encoded file hashes + * @var string[] + */ + public array $file_hashes; - - /** - * @param string $type The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” - * @param string[] $file_hashes List of base64-encoded file hashes - * @param string $message Error message - */ - public static function make(string $type, array $file_hashes, string $message): static - { - return new static([ - 'type' => $type, - 'file_hashes' => $file_hashes, - 'message' => $message, - ]); - } + /** + * @param string $type The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” + * @param string[] $file_hashes List of base64-encoded file hashes + * @param string $message Error message + */ + public static function make(string $type, array $file_hashes, string $message): static + { + return new static([ + 'type' => $type, + 'file_hashes' => $file_hashes, + 'message' => $message, + ]); + } } diff --git a/src/Telegram/PassportElementErrorFrontSide.php b/src/Telegram/PassportElementErrorFrontSide.php index 8eed7e0..3aa0841 100644 --- a/src/Telegram/PassportElementErrorFrontSide.php +++ b/src/Telegram/PassportElementErrorFrontSide.php @@ -11,24 +11,23 @@ */ class PassportElementErrorFrontSide extends PassportElementError { - /** Error source, must be front_side */ - public string $source = 'front_side'; + /** Error source, must be front_side */ + public string $source = 'front_side'; - /** Base64-encoded hash of the file with the front side of the document */ - public string $file_hash; + /** Base64-encoded hash of the file with the front side of the document */ + public string $file_hash; - - /** - * @param string $type The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” - * @param string $file_hash Base64-encoded hash of the file with the front side of the document - * @param string $message Error message - */ - public static function make(string $type, string $file_hash, string $message): static - { - return new static([ - 'type' => $type, - 'file_hash' => $file_hash, - 'message' => $message, - ]); - } + /** + * @param string $type The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” + * @param string $file_hash Base64-encoded hash of the file with the front side of the document + * @param string $message Error message + */ + public static function make(string $type, string $file_hash, string $message): static + { + return new static([ + 'type' => $type, + 'file_hash' => $file_hash, + 'message' => $message, + ]); + } } diff --git a/src/Telegram/PassportElementErrorReverseSide.php b/src/Telegram/PassportElementErrorReverseSide.php index f06094e..5cb68c1 100644 --- a/src/Telegram/PassportElementErrorReverseSide.php +++ b/src/Telegram/PassportElementErrorReverseSide.php @@ -11,24 +11,23 @@ */ class PassportElementErrorReverseSide extends PassportElementError { - /** Error source, must be reverse_side */ - public string $source = 'reverse_side'; + /** Error source, must be reverse_side */ + public string $source = 'reverse_side'; - /** Base64-encoded hash of the file with the reverse side of the document */ - public string $file_hash; + /** Base64-encoded hash of the file with the reverse side of the document */ + public string $file_hash; - - /** - * @param string $type The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card” - * @param string $file_hash Base64-encoded hash of the file with the reverse side of the document - * @param string $message Error message - */ - public static function make(string $type, string $file_hash, string $message): static - { - return new static([ - 'type' => $type, - 'file_hash' => $file_hash, - 'message' => $message, - ]); - } + /** + * @param string $type The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card” + * @param string $file_hash Base64-encoded hash of the file with the reverse side of the document + * @param string $message Error message + */ + public static function make(string $type, string $file_hash, string $message): static + { + return new static([ + 'type' => $type, + 'file_hash' => $file_hash, + 'message' => $message, + ]); + } } diff --git a/src/Telegram/PassportElementErrorSelfie.php b/src/Telegram/PassportElementErrorSelfie.php index e84204a..78e919b 100644 --- a/src/Telegram/PassportElementErrorSelfie.php +++ b/src/Telegram/PassportElementErrorSelfie.php @@ -11,24 +11,23 @@ */ class PassportElementErrorSelfie extends PassportElementError { - /** Error source, must be selfie */ - public string $source = 'selfie'; + /** Error source, must be selfie */ + public string $source = 'selfie'; - /** Base64-encoded hash of the file with the selfie */ - public string $file_hash; + /** Base64-encoded hash of the file with the selfie */ + public string $file_hash; - - /** - * @param string $type The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” - * @param string $file_hash Base64-encoded hash of the file with the selfie - * @param string $message Error message - */ - public static function make(string $type, string $file_hash, string $message): static - { - return new static([ - 'type' => $type, - 'file_hash' => $file_hash, - 'message' => $message, - ]); - } + /** + * @param string $type The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport” + * @param string $file_hash Base64-encoded hash of the file with the selfie + * @param string $message Error message + */ + public static function make(string $type, string $file_hash, string $message): static + { + return new static([ + 'type' => $type, + 'file_hash' => $file_hash, + 'message' => $message, + ]); + } } diff --git a/src/Telegram/PassportElementErrorTranslationFile.php b/src/Telegram/PassportElementErrorTranslationFile.php index bddba08..513a0bb 100644 --- a/src/Telegram/PassportElementErrorTranslationFile.php +++ b/src/Telegram/PassportElementErrorTranslationFile.php @@ -11,24 +11,23 @@ */ class PassportElementErrorTranslationFile extends PassportElementError { - /** Error source, must be translation_file */ - public string $source = 'translation_file'; + /** Error source, must be translation_file */ + public string $source = 'translation_file'; - /** Base64-encoded file hash */ - public string $file_hash; + /** Base64-encoded file hash */ + public string $file_hash; - - /** - * @param string $type Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” - * @param string $file_hash Base64-encoded file hash - * @param string $message Error message - */ - public static function make(string $type, string $file_hash, string $message): static - { - return new static([ - 'type' => $type, - 'file_hash' => $file_hash, - 'message' => $message, - ]); - } + /** + * @param string $type Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” + * @param string $file_hash Base64-encoded file hash + * @param string $message Error message + */ + public static function make(string $type, string $file_hash, string $message): static + { + return new static([ + 'type' => $type, + 'file_hash' => $file_hash, + 'message' => $message, + ]); + } } diff --git a/src/Telegram/PassportElementErrorTranslationFiles.php b/src/Telegram/PassportElementErrorTranslationFiles.php index 3bd8fcc..ebdc248 100644 --- a/src/Telegram/PassportElementErrorTranslationFiles.php +++ b/src/Telegram/PassportElementErrorTranslationFiles.php @@ -11,27 +11,26 @@ */ class PassportElementErrorTranslationFiles extends PassportElementError { - /** Error source, must be translation_files */ - public string $source = 'translation_files'; + /** Error source, must be translation_files */ + public string $source = 'translation_files'; - /** - * List of base64-encoded file hashes - * @var string[] - */ - public array $file_hashes; + /** + * List of base64-encoded file hashes + * @var string[] + */ + public array $file_hashes; - - /** - * @param string $type Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” - * @param string[] $file_hashes List of base64-encoded file hashes - * @param string $message Error message - */ - public static function make(string $type, array $file_hashes, string $message): static - { - return new static([ - 'type' => $type, - 'file_hashes' => $file_hashes, - 'message' => $message, - ]); - } + /** + * @param string $type Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration” + * @param string[] $file_hashes List of base64-encoded file hashes + * @param string $message Error message + */ + public static function make(string $type, array $file_hashes, string $message): static + { + return new static([ + 'type' => $type, + 'file_hashes' => $file_hashes, + 'message' => $message, + ]); + } } diff --git a/src/Telegram/PassportElementErrorUnspecified.php b/src/Telegram/PassportElementErrorUnspecified.php index 679b714..8d51cd8 100644 --- a/src/Telegram/PassportElementErrorUnspecified.php +++ b/src/Telegram/PassportElementErrorUnspecified.php @@ -11,24 +11,23 @@ */ class PassportElementErrorUnspecified extends PassportElementError { - /** Error source, must be unspecified */ - public string $source = 'unspecified'; + /** Error source, must be unspecified */ + public string $source = 'unspecified'; - /** Base64-encoded element hash */ - public string $element_hash; + /** Base64-encoded element hash */ + public string $element_hash; - - /** - * @param string $type Type of element of the user's Telegram Passport which has the issue - * @param string $element_hash Base64-encoded element hash - * @param string $message Error message - */ - public static function make(string $type, string $element_hash, string $message): static - { - return new static([ - 'type' => $type, - 'element_hash' => $element_hash, - 'message' => $message, - ]); - } + /** + * @param string $type Type of element of the user's Telegram Passport which has the issue + * @param string $element_hash Base64-encoded element hash + * @param string $message Error message + */ + public static function make(string $type, string $element_hash, string $message): static + { + return new static([ + 'type' => $type, + 'element_hash' => $element_hash, + 'message' => $message, + ]); + } } diff --git a/src/Telegram/PassportFile.php b/src/Telegram/PassportFile.php index 24f9e9a..5b81475 100644 --- a/src/Telegram/PassportFile.php +++ b/src/Telegram/PassportFile.php @@ -11,32 +11,31 @@ */ class PassportFile extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; - - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; - - /** File size in bytes */ - public int $file_size; - - /** Unix time when the file was uploaded */ - public int $file_date; - - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param int $file_size File size in bytes - * @param int $file_date Unix time when the file was uploaded - */ - public static function make(string $file_id, string $file_unique_id, int $file_size, int $file_date): static - { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'file_size' => $file_size, - 'file_date' => $file_date, - ]); - } + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; + + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; + + /** File size in bytes */ + public int $file_size; + + /** Unix time when the file was uploaded */ + public int $file_date; + + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $file_size File size in bytes + * @param int $file_date Unix time when the file was uploaded + */ + public static function make(string $file_id, string $file_unique_id, int $file_size, int $file_date): static + { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'file_size' => $file_size, + 'file_date' => $file_date, + ]); + } } diff --git a/src/Telegram/PhotoSize.php b/src/Telegram/PhotoSize.php index 9234244..a4b17b3 100644 --- a/src/Telegram/PhotoSize.php +++ b/src/Telegram/PhotoSize.php @@ -11,42 +11,41 @@ */ class PhotoSize extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; - - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; - - /** Photo width */ - public int $width; - - /** Photo height */ - public int $height; - - /** Optional. File size in bytes */ - public ?int $file_size = null; - - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param int $width Photo width - * @param int $height Photo height - * @param int $file_size Optional. File size in bytes - */ - public static function make( - string $file_id, - string $file_unique_id, - int $width, - int $height, - ?int $file_size = null - ): static { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'width' => $width, - 'height' => $height, - 'file_size' => $file_size, - ]); - } + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; + + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; + + /** Photo width */ + public int $width; + + /** Photo height */ + public int $height; + + /** Optional. File size in bytes */ + public ?int $file_size = null; + + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $width Photo width + * @param int $height Photo height + * @param int $file_size Optional. File size in bytes + */ + public static function make( + string $file_id, + string $file_unique_id, + int $width, + int $height, + ?int $file_size = null + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'width' => $width, + 'height' => $height, + 'file_size' => $file_size, + ]); + } } diff --git a/src/Telegram/Poll.php b/src/Telegram/Poll.php index d3fbf42..8570b6b 100644 --- a/src/Telegram/Poll.php +++ b/src/Telegram/Poll.php @@ -11,96 +11,95 @@ */ class Poll extends \Tii\Telepath\Type { - /** Unique poll identifier */ - public string $id; - - /** Poll question, 1-300 characters */ - public string $question; - - /** - * List of poll options - * @var PollOption[] - */ - public array $options; - - /** Total number of users that voted in the poll */ - public int $total_voter_count; - - /** True, if the poll is closed */ - public bool $is_closed; - - /** True, if the poll is anonymous */ - public bool $is_anonymous; - - /** Poll type, currently can be “regular” or “quiz” */ - public string $type; - - /** True, if the poll allows multiple answers */ - public bool $allows_multiple_answers; - - /** Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. */ - public ?int $correct_option_id = null; - - /** Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */ - public ?string $explanation = null; - - /** - * Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation - * @var MessageEntity[] - */ - public ?array $explanation_entities = null; - - /** Optional. Amount of time in seconds the poll will be active after creation */ - public ?int $open_period = null; - - /** Optional. Point in time (Unix timestamp) when the poll will be automatically closed */ - public ?int $close_date = null; - - - /** - * @param string $id Unique poll identifier - * @param string $question Poll question, 1-300 characters - * @param PollOption[] $options List of poll options - * @param int $total_voter_count Total number of users that voted in the poll - * @param bool $is_closed True, if the poll is closed - * @param bool $is_anonymous True, if the poll is anonymous - * @param string $type Poll type, currently can be “regular” or “quiz” - * @param bool $allows_multiple_answers True, if the poll allows multiple answers - * @param int $correct_option_id Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. - * @param string $explanation Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters - * @param MessageEntity[] $explanation_entities Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation - * @param int $open_period Optional. Amount of time in seconds the poll will be active after creation - * @param int $close_date Optional. Point in time (Unix timestamp) when the poll will be automatically closed - */ - public static function make( - string $id, - string $question, - array $options, - int $total_voter_count, - bool $is_closed, - bool $is_anonymous, - string $type, - bool $allows_multiple_answers, - ?int $correct_option_id = null, - ?string $explanation = null, - ?array $explanation_entities = null, - ?int $open_period = null, - ?int $close_date = null - ): static { - return new static([ - 'id' => $id, - 'question' => $question, - 'options' => $options, - 'total_voter_count' => $total_voter_count, - 'is_closed' => $is_closed, - 'is_anonymous' => $is_anonymous, - 'type' => $type, - 'allows_multiple_answers' => $allows_multiple_answers, - 'correct_option_id' => $correct_option_id, - 'explanation' => $explanation, - 'explanation_entities' => $explanation_entities, - 'open_period' => $open_period, - 'close_date' => $close_date, - ]); - } + /** Unique poll identifier */ + public string $id; + + /** Poll question, 1-300 characters */ + public string $question; + + /** + * List of poll options + * @var PollOption[] + */ + public array $options; + + /** Total number of users that voted in the poll */ + public int $total_voter_count; + + /** True, if the poll is closed */ + public bool $is_closed; + + /** True, if the poll is anonymous */ + public bool $is_anonymous; + + /** Poll type, currently can be “regular” or “quiz” */ + public string $type; + + /** True, if the poll allows multiple answers */ + public bool $allows_multiple_answers; + + /** Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. */ + public ?int $correct_option_id = null; + + /** Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters */ + public ?string $explanation = null; + + /** + * Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation + * @var MessageEntity[] + */ + public ?array $explanation_entities = null; + + /** Optional. Amount of time in seconds the poll will be active after creation */ + public ?int $open_period = null; + + /** Optional. Point in time (Unix timestamp) when the poll will be automatically closed */ + public ?int $close_date = null; + + /** + * @param string $id Unique poll identifier + * @param string $question Poll question, 1-300 characters + * @param PollOption[] $options List of poll options + * @param int $total_voter_count Total number of users that voted in the poll + * @param bool $is_closed True, if the poll is closed + * @param bool $is_anonymous True, if the poll is anonymous + * @param string $type Poll type, currently can be “regular” or “quiz” + * @param bool $allows_multiple_answers True, if the poll allows multiple answers + * @param int $correct_option_id Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot. + * @param string $explanation Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters + * @param MessageEntity[] $explanation_entities Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation + * @param int $open_period Optional. Amount of time in seconds the poll will be active after creation + * @param int $close_date Optional. Point in time (Unix timestamp) when the poll will be automatically closed + */ + public static function make( + string $id, + string $question, + array $options, + int $total_voter_count, + bool $is_closed, + bool $is_anonymous, + string $type, + bool $allows_multiple_answers, + ?int $correct_option_id = null, + ?string $explanation = null, + ?array $explanation_entities = null, + ?int $open_period = null, + ?int $close_date = null + ): static { + return new static([ + 'id' => $id, + 'question' => $question, + 'options' => $options, + 'total_voter_count' => $total_voter_count, + 'is_closed' => $is_closed, + 'is_anonymous' => $is_anonymous, + 'type' => $type, + 'allows_multiple_answers' => $allows_multiple_answers, + 'correct_option_id' => $correct_option_id, + 'explanation' => $explanation, + 'explanation_entities' => $explanation_entities, + 'open_period' => $open_period, + 'close_date' => $close_date, + ]); + } } diff --git a/src/Telegram/PollAnswer.php b/src/Telegram/PollAnswer.php index 58407db..1b71a63 100644 --- a/src/Telegram/PollAnswer.php +++ b/src/Telegram/PollAnswer.php @@ -11,30 +11,29 @@ */ class PollAnswer extends \Tii\Telepath\Type { - /** Unique poll identifier */ - public string $poll_id; + /** Unique poll identifier */ + public string $poll_id; - /** The user, who changed the answer to the poll */ - public User $user; + /** The user, who changed the answer to the poll */ + public User $user; - /** - * 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. - * @var int[] - */ - public array $option_ids; + /** + * 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. + * @var int[] + */ + public array $option_ids; - - /** - * @param string $poll_id Unique poll identifier - * @param User $user The user, who changed the answer to the poll - * @param int[] $option_ids 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. - */ - public static function make(string $poll_id, User $user, array $option_ids): static - { - return new static([ - 'poll_id' => $poll_id, - 'user' => $user, - 'option_ids' => $option_ids, - ]); - } + /** + * @param string $poll_id Unique poll identifier + * @param User $user The user, who changed the answer to the poll + * @param int[] $option_ids 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote. + */ + public static function make(string $poll_id, User $user, array $option_ids): static + { + return new static([ + 'poll_id' => $poll_id, + 'user' => $user, + 'option_ids' => $option_ids, + ]); + } } diff --git a/src/Telegram/PollOption.php b/src/Telegram/PollOption.php index 5252783..4584ec5 100644 --- a/src/Telegram/PollOption.php +++ b/src/Telegram/PollOption.php @@ -11,22 +11,21 @@ */ class PollOption extends \Tii\Telepath\Type { - /** Option text, 1-100 characters */ - public string $text; + /** Option text, 1-100 characters */ + public string $text; - /** Number of users that voted for this option */ - public int $voter_count; + /** Number of users that voted for this option */ + public int $voter_count; - - /** - * @param string $text Option text, 1-100 characters - * @param int $voter_count Number of users that voted for this option - */ - public static function make(string $text, int $voter_count): static - { - return new static([ - 'text' => $text, - 'voter_count' => $voter_count, - ]); - } + /** + * @param string $text Option text, 1-100 characters + * @param int $voter_count Number of users that voted for this option + */ + public static function make(string $text, int $voter_count): static + { + return new static([ + 'text' => $text, + 'voter_count' => $voter_count, + ]); + } } diff --git a/src/Telegram/PreCheckoutQuery.php b/src/Telegram/PreCheckoutQuery.php index 0561d1a..0a9186c 100644 --- a/src/Telegram/PreCheckoutQuery.php +++ b/src/Telegram/PreCheckoutQuery.php @@ -11,54 +11,53 @@ */ class PreCheckoutQuery extends \Tii\Telepath\Type { - /** Unique query identifier */ - public string $id; - - /** User who sent the query */ - public User $from; - - /** Three-letter ISO 4217 currency code */ - public string $currency; - - /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ - public int $total_amount; - - /** Bot specified invoice payload */ - public string $invoice_payload; - - /** Optional. Identifier of the shipping option chosen by the user */ - public ?string $shipping_option_id = null; - - /** Optional. Order info provided by the user */ - public ?OrderInfo $order_info = null; - - - /** - * @param string $id Unique query identifier - * @param User $from User who sent the query - * @param string $currency Three-letter ISO 4217 currency code - * @param int $total_amount Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - * @param string $invoice_payload Bot specified invoice payload - * @param string $shipping_option_id Optional. Identifier of the shipping option chosen by the user - * @param OrderInfo $order_info Optional. Order info provided by the user - */ - public static function make( - string $id, - User $from, - string $currency, - int $total_amount, - string $invoice_payload, - ?string $shipping_option_id = null, - ?OrderInfo $order_info = null - ): static { - return new static([ - 'id' => $id, - 'from' => $from, - 'currency' => $currency, - 'total_amount' => $total_amount, - 'invoice_payload' => $invoice_payload, - 'shipping_option_id' => $shipping_option_id, - 'order_info' => $order_info, - ]); - } + /** Unique query identifier */ + public string $id; + + /** User who sent the query */ + public User $from; + + /** Three-letter ISO 4217 currency code */ + public string $currency; + + /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ + public int $total_amount; + + /** Bot specified invoice payload */ + public string $invoice_payload; + + /** Optional. Identifier of the shipping option chosen by the user */ + public ?string $shipping_option_id = null; + + /** Optional. Order info provided by the user */ + public ?OrderInfo $order_info = null; + + /** + * @param string $id Unique query identifier + * @param User $from User who sent the query + * @param string $currency Three-letter ISO 4217 currency code + * @param int $total_amount Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). + * @param string $invoice_payload Bot specified invoice payload + * @param string $shipping_option_id Optional. Identifier of the shipping option chosen by the user + * @param OrderInfo $order_info Optional. Order info provided by the user + */ + public static function make( + string $id, + User $from, + string $currency, + int $total_amount, + string $invoice_payload, + ?string $shipping_option_id = null, + ?OrderInfo $order_info = null + ): static { + return new static([ + 'id' => $id, + 'from' => $from, + 'currency' => $currency, + 'total_amount' => $total_amount, + 'invoice_payload' => $invoice_payload, + 'shipping_option_id' => $shipping_option_id, + 'order_info' => $order_info, + ]); + } } diff --git a/src/Telegram/ProximityAlertTriggered.php b/src/Telegram/ProximityAlertTriggered.php index 4091db3..d700735 100644 --- a/src/Telegram/ProximityAlertTriggered.php +++ b/src/Telegram/ProximityAlertTriggered.php @@ -11,27 +11,26 @@ */ class ProximityAlertTriggered extends \Tii\Telepath\Type { - /** User that triggered the alert */ - public User $traveler; + /** User that triggered the alert */ + public User $traveler; - /** User that set the alert */ - public User $watcher; + /** User that set the alert */ + public User $watcher; - /** The distance between the users */ - public int $distance; + /** The distance between the users */ + public int $distance; - - /** - * @param User $traveler User that triggered the alert - * @param User $watcher User that set the alert - * @param int $distance The distance between the users - */ - public static function make(User $traveler, User $watcher, int $distance): static - { - return new static([ - 'traveler' => $traveler, - 'watcher' => $watcher, - 'distance' => $distance, - ]); - } + /** + * @param User $traveler User that triggered the alert + * @param User $watcher User that set the alert + * @param int $distance The distance between the users + */ + public static function make(User $traveler, User $watcher, int $distance): static + { + return new static([ + 'traveler' => $traveler, + 'watcher' => $watcher, + 'distance' => $distance, + ]); + } } diff --git a/src/Telegram/ReplyKeyboardMarkup.php b/src/Telegram/ReplyKeyboardMarkup.php index de6683c..b023e50 100644 --- a/src/Telegram/ReplyKeyboardMarkup.php +++ b/src/Telegram/ReplyKeyboardMarkup.php @@ -11,45 +11,44 @@ */ class ReplyKeyboardMarkup extends \Tii\Telepath\Type { - /** - * Array of button rows, each represented by an Array of KeyboardButton objects - * @var KeyboardButton[][] - */ - public array $keyboard; - - /** Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */ - public ?bool $resize_keyboard = null; - - /** Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. */ - public ?bool $one_time_keyboard = null; - - /** Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */ - public ?string $input_field_placeholder = null; - - /** Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. */ - public ?bool $selective = null; - - - /** - * @param KeyboardButton[][] $keyboard Array of button rows, each represented by an Array of KeyboardButton objects - * @param bool $resize_keyboard Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. - * @param bool $one_time_keyboard Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. - * @param string $input_field_placeholder Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters - * @param bool $selective Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. - */ - public static function make( - array $keyboard, - ?bool $resize_keyboard = null, - ?bool $one_time_keyboard = null, - ?string $input_field_placeholder = null, - ?bool $selective = null - ): static { - return new static([ - 'keyboard' => $keyboard, - 'resize_keyboard' => $resize_keyboard, - 'one_time_keyboard' => $one_time_keyboard, - 'input_field_placeholder' => $input_field_placeholder, - 'selective' => $selective, - ]); - } + /** + * Array of button rows, each represented by an Array of KeyboardButton objects + * @var KeyboardButton[][] + */ + public array $keyboard; + + /** Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */ + public ?bool $resize_keyboard = null; + + /** Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. */ + public ?bool $one_time_keyboard = null; + + /** Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters */ + public ?string $input_field_placeholder = null; + + /** Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. */ + public ?bool $selective = null; + + /** + * @param KeyboardButton[][] $keyboard Array of button rows, each represented by an Array of KeyboardButton objects + * @param bool $resize_keyboard Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. + * @param bool $one_time_keyboard Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. + * @param string $input_field_placeholder Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters + * @param bool $selective Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. Other users in the group don't see the keyboard. + */ + public static function make( + array $keyboard, + ?bool $resize_keyboard = null, + ?bool $one_time_keyboard = null, + ?string $input_field_placeholder = null, + ?bool $selective = null + ): static { + return new static([ + 'keyboard' => $keyboard, + 'resize_keyboard' => $resize_keyboard, + 'one_time_keyboard' => $one_time_keyboard, + 'input_field_placeholder' => $input_field_placeholder, + 'selective' => $selective, + ]); + } } diff --git a/src/Telegram/ReplyKeyboardRemove.php b/src/Telegram/ReplyKeyboardRemove.php index d54dab5..09b9229 100644 --- a/src/Telegram/ReplyKeyboardRemove.php +++ b/src/Telegram/ReplyKeyboardRemove.php @@ -11,22 +11,21 @@ */ class ReplyKeyboardRemove extends \Tii\Telepath\Type { - /** Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) */ - public bool $remove_keyboard; + /** Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) */ + public bool $remove_keyboard; - /** Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. */ - public ?bool $selective = null; + /** Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. */ + public ?bool $selective = null; - - /** - * @param bool $remove_keyboard Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) - * @param bool $selective Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. - */ - public static function make(bool $remove_keyboard, ?bool $selective = null): static - { - return new static([ - 'remove_keyboard' => $remove_keyboard, - 'selective' => $selective, - ]); - } + /** + * @param bool $remove_keyboard Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup) + * @param bool $selective Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. + */ + public static function make(bool $remove_keyboard, ?bool $selective = null): static + { + return new static([ + 'remove_keyboard' => $remove_keyboard, + 'selective' => $selective, + ]); + } } diff --git a/src/Telegram/ResponseParameters.php b/src/Telegram/ResponseParameters.php index c88ffa5..0aec251 100644 --- a/src/Telegram/ResponseParameters.php +++ b/src/Telegram/ResponseParameters.php @@ -11,22 +11,21 @@ */ class ResponseParameters extends \Tii\Telepath\Type { - /** Optional. The group has been migrated to a supergroup with the specified identifier. 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. */ - public ?int $migrate_to_chat_id = null; + /** Optional. The group has been migrated to a supergroup with the specified identifier. 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. */ + public ?int $migrate_to_chat_id = null; - /** Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated */ - public ?int $retry_after = null; + /** Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated */ + public ?int $retry_after = null; - - /** - * @param int $migrate_to_chat_id Optional. The group has been migrated to a supergroup with the specified identifier. 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. - * @param int $retry_after Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated - */ - public static function make(?int $migrate_to_chat_id = null, ?int $retry_after = null): static - { - return new static([ - 'migrate_to_chat_id' => $migrate_to_chat_id, - 'retry_after' => $retry_after, - ]); - } + /** + * @param int $migrate_to_chat_id Optional. The group has been migrated to a supergroup with the specified identifier. 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. + * @param int $retry_after Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated + */ + public static function make(?int $migrate_to_chat_id = null, ?int $retry_after = null): static + { + return new static([ + 'migrate_to_chat_id' => $migrate_to_chat_id, + 'retry_after' => $retry_after, + ]); + } } diff --git a/src/Telegram/SentWebAppMessage.php b/src/Telegram/SentWebAppMessage.php index 2ed1e66..1447879 100644 --- a/src/Telegram/SentWebAppMessage.php +++ b/src/Telegram/SentWebAppMessage.php @@ -11,17 +11,16 @@ */ class SentWebAppMessage extends \Tii\Telepath\Type { - /** Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. */ - public ?string $inline_message_id = null; + /** Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. */ + public ?string $inline_message_id = null; - - /** - * @param string $inline_message_id Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. - */ - public static function make(?string $inline_message_id = null): static - { - return new static([ - 'inline_message_id' => $inline_message_id, - ]); - } + /** + * @param string $inline_message_id Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. + */ + public static function make(?string $inline_message_id = null): static + { + return new static([ + 'inline_message_id' => $inline_message_id, + ]); + } } diff --git a/src/Telegram/ShippingAddress.php b/src/Telegram/ShippingAddress.php index a85b297..627fbd3 100644 --- a/src/Telegram/ShippingAddress.php +++ b/src/Telegram/ShippingAddress.php @@ -11,48 +11,47 @@ */ class ShippingAddress extends \Tii\Telepath\Type { - /** ISO 3166-1 alpha-2 country code */ - public string $country_code; - - /** State, if applicable */ - public string $state; - - /** City */ - public string $city; - - /** First line for the address */ - public string $street_line1; - - /** Second line for the address */ - public string $street_line2; - - /** Address post code */ - public string $post_code; - - - /** - * @param string $country_code ISO 3166-1 alpha-2 country code - * @param string $state State, if applicable - * @param string $city City - * @param string $street_line1 First line for the address - * @param string $street_line2 Second line for the address - * @param string $post_code Address post code - */ - public static function make( - string $country_code, - string $state, - string $city, - string $street_line1, - string $street_line2, - string $post_code - ): static { - return new static([ - 'country_code' => $country_code, - 'state' => $state, - 'city' => $city, - 'street_line1' => $street_line1, - 'street_line2' => $street_line2, - 'post_code' => $post_code, - ]); - } + /** ISO 3166-1 alpha-2 country code */ + public string $country_code; + + /** State, if applicable */ + public string $state; + + /** City */ + public string $city; + + /** First line for the address */ + public string $street_line1; + + /** Second line for the address */ + public string $street_line2; + + /** Address post code */ + public string $post_code; + + /** + * @param string $country_code ISO 3166-1 alpha-2 country code + * @param string $state State, if applicable + * @param string $city City + * @param string $street_line1 First line for the address + * @param string $street_line2 Second line for the address + * @param string $post_code Address post code + */ + public static function make( + string $country_code, + string $state, + string $city, + string $street_line1, + string $street_line2, + string $post_code + ): static { + return new static([ + 'country_code' => $country_code, + 'state' => $state, + 'city' => $city, + 'street_line1' => $street_line1, + 'street_line2' => $street_line2, + 'post_code' => $post_code, + ]); + } } diff --git a/src/Telegram/ShippingOption.php b/src/Telegram/ShippingOption.php index e446ad7..1c298b6 100644 --- a/src/Telegram/ShippingOption.php +++ b/src/Telegram/ShippingOption.php @@ -11,30 +11,29 @@ */ class ShippingOption extends \Tii\Telepath\Type { - /** Shipping option identifier */ - public string $id; + /** Shipping option identifier */ + public string $id; - /** Option title */ - public string $title; + /** Option title */ + public string $title; - /** - * List of price portions - * @var LabeledPrice[] - */ - public array $prices; + /** + * List of price portions + * @var LabeledPrice[] + */ + public array $prices; - - /** - * @param string $id Shipping option identifier - * @param string $title Option title - * @param LabeledPrice[] $prices List of price portions - */ - public static function make(string $id, string $title, array $prices): static - { - return new static([ - 'id' => $id, - 'title' => $title, - 'prices' => $prices, - ]); - } + /** + * @param string $id Shipping option identifier + * @param string $title Option title + * @param LabeledPrice[] $prices List of price portions + */ + public static function make(string $id, string $title, array $prices): static + { + return new static([ + 'id' => $id, + 'title' => $title, + 'prices' => $prices, + ]); + } } diff --git a/src/Telegram/ShippingQuery.php b/src/Telegram/ShippingQuery.php index 430af23..444af1d 100644 --- a/src/Telegram/ShippingQuery.php +++ b/src/Telegram/ShippingQuery.php @@ -11,32 +11,35 @@ */ class ShippingQuery extends \Tii\Telepath\Type { - /** Unique query identifier */ - public string $id; - - /** User who sent the query */ - public User $from; - - /** Bot specified invoice payload */ - public string $invoice_payload; - - /** User specified shipping address */ - public ShippingAddress $shipping_address; - - - /** - * @param string $id Unique query identifier - * @param User $from User who sent the query - * @param string $invoice_payload Bot specified invoice payload - * @param ShippingAddress $shipping_address User specified shipping address - */ - public static function make(string $id, User $from, string $invoice_payload, ShippingAddress $shipping_address): static - { - return new static([ - 'id' => $id, - 'from' => $from, - 'invoice_payload' => $invoice_payload, - 'shipping_address' => $shipping_address, - ]); - } + /** Unique query identifier */ + public string $id; + + /** User who sent the query */ + public User $from; + + /** Bot specified invoice payload */ + public string $invoice_payload; + + /** User specified shipping address */ + public ShippingAddress $shipping_address; + + /** + * @param string $id Unique query identifier + * @param User $from User who sent the query + * @param string $invoice_payload Bot specified invoice payload + * @param ShippingAddress $shipping_address User specified shipping address + */ + public static function make( + string $id, + User $from, + string $invoice_payload, + ShippingAddress $shipping_address + ): static { + return new static([ + 'id' => $id, + 'from' => $from, + 'invoice_payload' => $invoice_payload, + 'shipping_address' => $shipping_address, + ]); + } } diff --git a/src/Telegram/Sticker.php b/src/Telegram/Sticker.php index 89e7c70..ccb7400 100644 --- a/src/Telegram/Sticker.php +++ b/src/Telegram/Sticker.php @@ -11,78 +11,77 @@ */ class Sticker extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; - /** Sticker width */ - public int $width; + /** Sticker width */ + public int $width; - /** Sticker height */ - public int $height; + /** Sticker height */ + public int $height; - /** True, if the sticker is animated */ - public bool $is_animated; + /** True, if the sticker is animated */ + public bool $is_animated; - /** True, if the sticker is a video sticker */ - public bool $is_video; + /** True, if the sticker is a video sticker */ + public bool $is_video; - /** Optional. Sticker thumbnail in the .WEBP or .JPG format */ - public ?PhotoSize $thumb = null; + /** Optional. Sticker thumbnail in the .WEBP or .JPG format */ + public ?PhotoSize $thumb = null; - /** Optional. Emoji associated with the sticker */ - public ?string $emoji = null; + /** Optional. Emoji associated with the sticker */ + public ?string $emoji = null; - /** Optional. Name of the sticker set to which the sticker belongs */ - public ?string $set_name = null; + /** Optional. Name of the sticker set to which the sticker belongs */ + public ?string $set_name = null; - /** Optional. For mask stickers, the position where the mask should be placed */ - public ?MaskPosition $mask_position = null; + /** Optional. For mask stickers, the position where the mask should be placed */ + public ?MaskPosition $mask_position = null; - /** Optional. File size in bytes */ - public ?int $file_size = null; + /** Optional. File size in bytes */ + public ?int $file_size = null; - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param int $width Sticker width - * @param int $height Sticker height - * @param bool $is_animated True, if the sticker is animated - * @param bool $is_video True, if the sticker is a video sticker - * @param PhotoSize $thumb Optional. Sticker thumbnail in the .WEBP or .JPG format - * @param string $emoji Optional. Emoji associated with the sticker - * @param string $set_name Optional. Name of the sticker set to which the sticker belongs - * @param MaskPosition $mask_position Optional. For mask stickers, the position where the mask should be placed - * @param int $file_size Optional. File size in bytes - */ - public static function make( - string $file_id, - string $file_unique_id, - int $width, - int $height, - bool $is_animated, - bool $is_video, - ?PhotoSize $thumb = null, - ?string $emoji = null, - ?string $set_name = null, - ?MaskPosition $mask_position = null, - ?int $file_size = null - ): static { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'width' => $width, - 'height' => $height, - 'is_animated' => $is_animated, - 'is_video' => $is_video, - 'thumb' => $thumb, - 'emoji' => $emoji, - 'set_name' => $set_name, - 'mask_position' => $mask_position, - 'file_size' => $file_size, - ]); - } + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $width Sticker width + * @param int $height Sticker height + * @param bool $is_animated True, if the sticker is animated + * @param bool $is_video True, if the sticker is a video sticker + * @param PhotoSize $thumb Optional. Sticker thumbnail in the .WEBP or .JPG format + * @param string $emoji Optional. Emoji associated with the sticker + * @param string $set_name Optional. Name of the sticker set to which the sticker belongs + * @param MaskPosition $mask_position Optional. For mask stickers, the position where the mask should be placed + * @param int $file_size Optional. File size in bytes + */ + public static function make( + string $file_id, + string $file_unique_id, + int $width, + int $height, + bool $is_animated, + bool $is_video, + ?PhotoSize $thumb = null, + ?string $emoji = null, + ?string $set_name = null, + ?MaskPosition $mask_position = null, + ?int $file_size = null + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'width' => $width, + 'height' => $height, + 'is_animated' => $is_animated, + 'is_video' => $is_video, + 'thumb' => $thumb, + 'emoji' => $emoji, + 'set_name' => $set_name, + 'mask_position' => $mask_position, + 'file_size' => $file_size, + ]); + } } diff --git a/src/Telegram/StickerSet.php b/src/Telegram/StickerSet.php index 98e0b6f..9bed612 100644 --- a/src/Telegram/StickerSet.php +++ b/src/Telegram/StickerSet.php @@ -11,57 +11,56 @@ */ class StickerSet extends \Tii\Telepath\Type { - /** Sticker set name */ - public string $name; + /** Sticker set name */ + public string $name; - /** Sticker set title */ - public string $title; + /** Sticker set title */ + public string $title; - /** True, if the sticker set contains animated stickers */ - public bool $is_animated; + /** True, if the sticker set contains animated stickers */ + public bool $is_animated; - /** True, if the sticker set contains video stickers */ - public bool $is_video; + /** True, if the sticker set contains video stickers */ + public bool $is_video; - /** True, if the sticker set contains masks */ - public bool $contains_masks; + /** True, if the sticker set contains masks */ + public bool $contains_masks; - /** - * List of all set stickers - * @var Sticker[] - */ - public array $stickers; + /** + * List of all set stickers + * @var Sticker[] + */ + public array $stickers; - /** Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */ - public ?PhotoSize $thumb = null; + /** Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */ + public ?PhotoSize $thumb = null; - - /** - * @param string $name Sticker set name - * @param string $title Sticker set title - * @param bool $is_animated True, if the sticker set contains animated stickers - * @param bool $is_video True, if the sticker set contains video stickers - * @param bool $contains_masks True, if the sticker set contains masks - * @param Sticker[] $stickers List of all set stickers - * @param PhotoSize $thumb Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format - */ - public static function make( - string $name, - string $title, - bool $is_animated, - bool $is_video, - bool $contains_masks, - array $stickers, - ?PhotoSize $thumb = null - ): static { - return new static([ - 'name' => $name, - 'title' => $title, - 'is_animated' => $is_animated, - 'is_video' => $is_video, - 'contains_masks' => $contains_masks, - 'stickers' => $stickers, - 'thumb' => $thumb, - ]); - } + /** + * @param string $name Sticker set name + * @param string $title Sticker set title + * @param bool $is_animated True, if the sticker set contains animated stickers + * @param bool $is_video True, if the sticker set contains video stickers + * @param bool $contains_masks True, if the sticker set contains masks + * @param Sticker[] $stickers List of all set stickers + * @param PhotoSize $thumb Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format + */ + public static function make( + string $name, + string $title, + bool $is_animated, + bool $is_video, + bool $contains_masks, + array $stickers, + ?PhotoSize $thumb = null + ): static { + return new static([ + 'name' => $name, + 'title' => $title, + 'is_animated' => $is_animated, + 'is_video' => $is_video, + 'contains_masks' => $contains_masks, + 'stickers' => $stickers, + 'thumb' => $thumb, + ]); + } } diff --git a/src/Telegram/SuccessfulPayment.php b/src/Telegram/SuccessfulPayment.php index 15278e7..9b48e9e 100644 --- a/src/Telegram/SuccessfulPayment.php +++ b/src/Telegram/SuccessfulPayment.php @@ -11,54 +11,53 @@ */ class SuccessfulPayment extends \Tii\Telepath\Type { - /** Three-letter ISO 4217 currency code */ - public string $currency; - - /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ - public int $total_amount; - - /** Bot specified invoice payload */ - public string $invoice_payload; - - /** Telegram payment identifier */ - public string $telegram_payment_charge_id; - - /** Provider payment identifier */ - public string $provider_payment_charge_id; - - /** Optional. Identifier of the shipping option chosen by the user */ - public ?string $shipping_option_id = null; - - /** Optional. Order info provided by the user */ - public ?OrderInfo $order_info = null; - - - /** - * @param string $currency Three-letter ISO 4217 currency code - * @param int $total_amount Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - * @param string $invoice_payload Bot specified invoice payload - * @param string $telegram_payment_charge_id Telegram payment identifier - * @param string $provider_payment_charge_id Provider payment identifier - * @param string $shipping_option_id Optional. Identifier of the shipping option chosen by the user - * @param OrderInfo $order_info Optional. Order info provided by the user - */ - public static function make( - string $currency, - int $total_amount, - string $invoice_payload, - string $telegram_payment_charge_id, - string $provider_payment_charge_id, - ?string $shipping_option_id = null, - ?OrderInfo $order_info = null - ): static { - return new static([ - 'currency' => $currency, - 'total_amount' => $total_amount, - 'invoice_payload' => $invoice_payload, - 'telegram_payment_charge_id' => $telegram_payment_charge_id, - 'provider_payment_charge_id' => $provider_payment_charge_id, - 'shipping_option_id' => $shipping_option_id, - 'order_info' => $order_info, - ]); - } + /** Three-letter ISO 4217 currency code */ + public string $currency; + + /** Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). */ + public int $total_amount; + + /** Bot specified invoice payload */ + public string $invoice_payload; + + /** Telegram payment identifier */ + public string $telegram_payment_charge_id; + + /** Provider payment identifier */ + public string $provider_payment_charge_id; + + /** Optional. Identifier of the shipping option chosen by the user */ + public ?string $shipping_option_id = null; + + /** Optional. Order info provided by the user */ + public ?OrderInfo $order_info = null; + + /** + * @param string $currency Three-letter ISO 4217 currency code + * @param int $total_amount Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). + * @param string $invoice_payload Bot specified invoice payload + * @param string $telegram_payment_charge_id Telegram payment identifier + * @param string $provider_payment_charge_id Provider payment identifier + * @param string $shipping_option_id Optional. Identifier of the shipping option chosen by the user + * @param OrderInfo $order_info Optional. Order info provided by the user + */ + public static function make( + string $currency, + int $total_amount, + string $invoice_payload, + string $telegram_payment_charge_id, + string $provider_payment_charge_id, + ?string $shipping_option_id = null, + ?OrderInfo $order_info = null + ): static { + return new static([ + 'currency' => $currency, + 'total_amount' => $total_amount, + 'invoice_payload' => $invoice_payload, + 'telegram_payment_charge_id' => $telegram_payment_charge_id, + 'provider_payment_charge_id' => $provider_payment_charge_id, + 'shipping_option_id' => $shipping_option_id, + 'order_info' => $order_info, + ]); + } } diff --git a/src/Telegram/Update.php b/src/Telegram/Update.php index d4b2ca8..bbc8eff 100644 --- a/src/Telegram/Update.php +++ b/src/Telegram/Update.php @@ -11,102 +11,101 @@ */ class Update extends \Tii\Telepath\Type { - /** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */ - public int $update_id; - - /** Optional. New incoming message of any kind — text, photo, sticker, etc. */ - public ?Message $message = null; - - /** Optional. New version of a message that is known to the bot and was edited */ - public ?Message $edited_message = null; - - /** Optional. New incoming channel post of any kind — text, photo, sticker, etc. */ - public ?Message $channel_post = null; - - /** Optional. New version of a channel post that is known to the bot and was edited */ - public ?Message $edited_channel_post = null; - - /** Optional. New incoming inline query */ - public ?InlineQuery $inline_query = null; - - /** Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */ - public ?ChosenInlineResult $chosen_inline_result = null; - - /** Optional. New incoming callback query */ - public ?CallbackQuery $callback_query = null; - - /** Optional. New incoming shipping query. Only for invoices with flexible price */ - public ?ShippingQuery $shipping_query = null; - - /** Optional. New incoming pre-checkout query. Contains full information about checkout */ - public ?PreCheckoutQuery $pre_checkout_query = null; - - /** Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot */ - public ?Poll $poll = null; - - /** Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. */ - public ?PollAnswer $poll_answer = null; - - /** Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. */ - public ?ChatMemberUpdated $my_chat_member = null; - - /** Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. */ - public ?ChatMemberUpdated $chat_member = null; - - /** Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. */ - public ?ChatJoinRequest $chat_join_request = null; - - - /** - * @param int $update_id The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. - * @param Message $message Optional. New incoming message of any kind — text, photo, sticker, etc. - * @param Message $edited_message Optional. New version of a message that is known to the bot and was edited - * @param Message $channel_post Optional. New incoming channel post of any kind — text, photo, sticker, etc. - * @param Message $edited_channel_post Optional. New version of a channel post that is known to the bot and was edited - * @param InlineQuery $inline_query Optional. New incoming inline query - * @param ChosenInlineResult $chosen_inline_result Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. - * @param CallbackQuery $callback_query Optional. New incoming callback query - * @param ShippingQuery $shipping_query Optional. New incoming shipping query. Only for invoices with flexible price - * @param PreCheckoutQuery $pre_checkout_query Optional. New incoming pre-checkout query. Contains full information about checkout - * @param Poll $poll Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot - * @param PollAnswer $poll_answer Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. - * @param ChatMemberUpdated $my_chat_member Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. - * @param ChatMemberUpdated $chat_member Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. - * @param ChatJoinRequest $chat_join_request Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. - */ - public static function make( - int $update_id, - ?Message $message = null, - ?Message $edited_message = null, - ?Message $channel_post = null, - ?Message $edited_channel_post = null, - ?InlineQuery $inline_query = null, - ?ChosenInlineResult $chosen_inline_result = null, - ?CallbackQuery $callback_query = null, - ?ShippingQuery $shipping_query = null, - ?PreCheckoutQuery $pre_checkout_query = null, - ?Poll $poll = null, - ?PollAnswer $poll_answer = null, - ?ChatMemberUpdated $my_chat_member = null, - ?ChatMemberUpdated $chat_member = null, - ?ChatJoinRequest $chat_join_request = null - ): static { - return new static([ - 'update_id' => $update_id, - 'message' => $message, - 'edited_message' => $edited_message, - 'channel_post' => $channel_post, - 'edited_channel_post' => $edited_channel_post, - 'inline_query' => $inline_query, - 'chosen_inline_result' => $chosen_inline_result, - 'callback_query' => $callback_query, - 'shipping_query' => $shipping_query, - 'pre_checkout_query' => $pre_checkout_query, - 'poll' => $poll, - 'poll_answer' => $poll_answer, - 'my_chat_member' => $my_chat_member, - 'chat_member' => $chat_member, - 'chat_join_request' => $chat_join_request, - ]); - } + /** The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */ + public int $update_id; + + /** Optional. New incoming message of any kind — text, photo, sticker, etc. */ + public ?Message $message = null; + + /** Optional. New version of a message that is known to the bot and was edited */ + public ?Message $edited_message = null; + + /** Optional. New incoming channel post of any kind — text, photo, sticker, etc. */ + public ?Message $channel_post = null; + + /** Optional. New version of a channel post that is known to the bot and was edited */ + public ?Message $edited_channel_post = null; + + /** Optional. New incoming inline query */ + public ?InlineQuery $inline_query = null; + + /** Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. */ + public ?ChosenInlineResult $chosen_inline_result = null; + + /** Optional. New incoming callback query */ + public ?CallbackQuery $callback_query = null; + + /** Optional. New incoming shipping query. Only for invoices with flexible price */ + public ?ShippingQuery $shipping_query = null; + + /** Optional. New incoming pre-checkout query. Contains full information about checkout */ + public ?PreCheckoutQuery $pre_checkout_query = null; + + /** Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot */ + public ?Poll $poll = null; + + /** Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. */ + public ?PollAnswer $poll_answer = null; + + /** Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. */ + public ?ChatMemberUpdated $my_chat_member = null; + + /** Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. */ + public ?ChatMemberUpdated $chat_member = null; + + /** Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. */ + public ?ChatJoinRequest $chat_join_request = null; + + /** + * @param int $update_id The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. + * @param Message $message Optional. New incoming message of any kind — text, photo, sticker, etc. + * @param Message $edited_message Optional. New version of a message that is known to the bot and was edited + * @param Message $channel_post Optional. New incoming channel post of any kind — text, photo, sticker, etc. + * @param Message $edited_channel_post Optional. New version of a channel post that is known to the bot and was edited + * @param InlineQuery $inline_query Optional. New incoming inline query + * @param ChosenInlineResult $chosen_inline_result Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. + * @param CallbackQuery $callback_query Optional. New incoming callback query + * @param ShippingQuery $shipping_query Optional. New incoming shipping query. Only for invoices with flexible price + * @param PreCheckoutQuery $pre_checkout_query Optional. New incoming pre-checkout query. Contains full information about checkout + * @param Poll $poll Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot + * @param PollAnswer $poll_answer Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself. + * @param ChatMemberUpdated $my_chat_member Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user. + * @param ChatMemberUpdated $chat_member Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates. + * @param ChatJoinRequest $chat_join_request Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates. + */ + public static function make( + int $update_id, + ?Message $message = null, + ?Message $edited_message = null, + ?Message $channel_post = null, + ?Message $edited_channel_post = null, + ?InlineQuery $inline_query = null, + ?ChosenInlineResult $chosen_inline_result = null, + ?CallbackQuery $callback_query = null, + ?ShippingQuery $shipping_query = null, + ?PreCheckoutQuery $pre_checkout_query = null, + ?Poll $poll = null, + ?PollAnswer $poll_answer = null, + ?ChatMemberUpdated $my_chat_member = null, + ?ChatMemberUpdated $chat_member = null, + ?ChatJoinRequest $chat_join_request = null + ): static { + return new static([ + 'update_id' => $update_id, + 'message' => $message, + 'edited_message' => $edited_message, + 'channel_post' => $channel_post, + 'edited_channel_post' => $edited_channel_post, + 'inline_query' => $inline_query, + 'chosen_inline_result' => $chosen_inline_result, + 'callback_query' => $callback_query, + 'shipping_query' => $shipping_query, + 'pre_checkout_query' => $pre_checkout_query, + 'poll' => $poll, + 'poll_answer' => $poll_answer, + 'my_chat_member' => $my_chat_member, + 'chat_member' => $chat_member, + 'chat_join_request' => $chat_join_request, + ]); + } } diff --git a/src/Telegram/User.php b/src/Telegram/User.php index fd13995..ffee231 100644 --- a/src/Telegram/User.php +++ b/src/Telegram/User.php @@ -11,66 +11,65 @@ */ class User extends \Tii\Telepath\Type { - /** 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. */ - public 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. */ + public int $id; - /** True, if this user is a bot */ - public bool $is_bot; + /** True, if this user is a bot */ + public bool $is_bot; - /** User's or bot's first name */ - public string $first_name; + /** User's or bot's first name */ + public string $first_name; - /** Optional. User's or bot's last name */ - public ?string $last_name = null; + /** Optional. User's or bot's last name */ + public ?string $last_name = null; - /** Optional. User's or bot's username */ - public ?string $username = null; + /** Optional. User's or bot's username */ + public ?string $username = null; - /** Optional. IETF language tag of the user's language */ - public ?string $language_code = null; + /** Optional. IETF language tag of the user's language */ + public ?string $language_code = null; - /** Optional. True, if the bot can be invited to groups. Returned only in getMe. */ - public ?bool $can_join_groups = null; + /** Optional. True, if the bot can be invited to groups. Returned only in getMe. */ + public ?bool $can_join_groups = null; - /** Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. */ - public ?bool $can_read_all_group_messages = null; + /** Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. */ + public ?bool $can_read_all_group_messages = null; - /** Optional. True, if the bot supports inline queries. Returned only in getMe. */ - public ?bool $supports_inline_queries = null; + /** Optional. True, if the bot supports inline queries. Returned only in getMe. */ + public ?bool $supports_inline_queries = 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 True, if this user is a bot - * @param string $first_name User's or bot's first name - * @param string $last_name Optional. User's or bot's last name - * @param string $username Optional. User's or bot's username - * @param string $language_code Optional. IETF language tag of the user's language - * @param bool $can_join_groups Optional. True, if the bot can be invited to groups. Returned only in getMe. - * @param bool $can_read_all_group_messages Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. - * @param bool $supports_inline_queries Optional. True, if the bot supports inline queries. Returned only in getMe. - */ - public static function make( - int $id, - bool $is_bot, - string $first_name, - ?string $last_name = null, - ?string $username = null, - ?string $language_code = null, - ?bool $can_join_groups = null, - ?bool $can_read_all_group_messages = null, - ?bool $supports_inline_queries = null - ): static { - return new static([ - 'id' => $id, - 'is_bot' => $is_bot, - 'first_name' => $first_name, - 'last_name' => $last_name, - 'username' => $username, - 'language_code' => $language_code, - 'can_join_groups' => $can_join_groups, - 'can_read_all_group_messages' => $can_read_all_group_messages, - 'supports_inline_queries' => $supports_inline_queries, - ]); - } + /** + * @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 True, if this user is a bot + * @param string $first_name User's or bot's first name + * @param string $last_name Optional. User's or bot's last name + * @param string $username Optional. User's or bot's username + * @param string $language_code Optional. IETF language tag of the user's language + * @param bool $can_join_groups Optional. True, if the bot can be invited to groups. Returned only in getMe. + * @param bool $can_read_all_group_messages Optional. True, if privacy mode is disabled for the bot. Returned only in getMe. + * @param bool $supports_inline_queries Optional. True, if the bot supports inline queries. Returned only in getMe. + */ + public static function make( + int $id, + bool $is_bot, + string $first_name, + ?string $last_name = null, + ?string $username = null, + ?string $language_code = null, + ?bool $can_join_groups = null, + ?bool $can_read_all_group_messages = null, + ?bool $supports_inline_queries = null + ): static { + return new static([ + 'id' => $id, + 'is_bot' => $is_bot, + 'first_name' => $first_name, + 'last_name' => $last_name, + 'username' => $username, + 'language_code' => $language_code, + 'can_join_groups' => $can_join_groups, + 'can_read_all_group_messages' => $can_read_all_group_messages, + 'supports_inline_queries' => $supports_inline_queries, + ]); + } } diff --git a/src/Telegram/UserProfilePhotos.php b/src/Telegram/UserProfilePhotos.php index b3d0a3c..5a5a684 100644 --- a/src/Telegram/UserProfilePhotos.php +++ b/src/Telegram/UserProfilePhotos.php @@ -11,25 +11,24 @@ */ class UserProfilePhotos extends \Tii\Telepath\Type { - /** Total number of profile pictures the target user has */ - public int $total_count; + /** Total number of profile pictures the target user has */ + public int $total_count; - /** - * Requested profile pictures (in up to 4 sizes each) - * @var PhotoSize[][] - */ - public array $photos; + /** + * Requested profile pictures (in up to 4 sizes each) + * @var PhotoSize[][] + */ + public array $photos; - - /** - * @param int $total_count Total number of profile pictures the target user has - * @param PhotoSize[][] $photos Requested profile pictures (in up to 4 sizes each) - */ - public static function make(int $total_count, array $photos): static - { - return new static([ - 'total_count' => $total_count, - 'photos' => $photos, - ]); - } + /** + * @param int $total_count Total number of profile pictures the target user has + * @param PhotoSize[][] $photos Requested profile pictures (in up to 4 sizes each) + */ + public static function make(int $total_count, array $photos): static + { + return new static([ + 'total_count' => $total_count, + 'photos' => $photos, + ]); + } } diff --git a/src/Telegram/Venue.php b/src/Telegram/Venue.php index 44a32a1..47e434c 100644 --- a/src/Telegram/Venue.php +++ b/src/Telegram/Venue.php @@ -11,54 +11,53 @@ */ class Venue extends \Tii\Telepath\Type { - /** Venue location. Can't be a live location */ - public Location $location; - - /** Name of the venue */ - public string $title; - - /** Address of the venue */ - public string $address; - - /** Optional. Foursquare identifier of the venue */ - public ?string $foursquare_id = null; - - /** Optional. Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ - public ?string $foursquare_type = null; - - /** Optional. Google Places identifier of the venue */ - public ?string $google_place_id = null; - - /** Optional. Google Places type of the venue. (See supported types.) */ - public ?string $google_place_type = null; - - - /** - * @param Location $location Venue location. Can't be a live location - * @param string $title Name of the venue - * @param string $address Address of the venue - * @param string $foursquare_id Optional. Foursquare identifier of the venue - * @param string $foursquare_type Optional. Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) - * @param string $google_place_id Optional. Google Places identifier of the venue - * @param string $google_place_type Optional. Google Places type of the venue. (See supported types.) - */ - public static function make( - Location $location, - string $title, - string $address, - ?string $foursquare_id = null, - ?string $foursquare_type = null, - ?string $google_place_id = null, - ?string $google_place_type = null - ): static { - return new static([ - 'location' => $location, - 'title' => $title, - 'address' => $address, - 'foursquare_id' => $foursquare_id, - 'foursquare_type' => $foursquare_type, - 'google_place_id' => $google_place_id, - 'google_place_type' => $google_place_type, - ]); - } + /** Venue location. Can't be a live location */ + public Location $location; + + /** Name of the venue */ + public string $title; + + /** Address of the venue */ + public string $address; + + /** Optional. Foursquare identifier of the venue */ + public ?string $foursquare_id = null; + + /** Optional. Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ + public ?string $foursquare_type = null; + + /** Optional. Google Places identifier of the venue */ + public ?string $google_place_id = null; + + /** Optional. Google Places type of the venue. (See supported types.) */ + public ?string $google_place_type = null; + + /** + * @param Location $location Venue location. Can't be a live location + * @param string $title Name of the venue + * @param string $address Address of the venue + * @param string $foursquare_id Optional. Foursquare identifier of the venue + * @param string $foursquare_type Optional. Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) + * @param string $google_place_id Optional. Google Places identifier of the venue + * @param string $google_place_type Optional. Google Places type of the venue. (See supported types.) + */ + public static function make( + Location $location, + string $title, + string $address, + ?string $foursquare_id = null, + ?string $foursquare_type = null, + ?string $google_place_id = null, + ?string $google_place_type = null + ): static { + return new static([ + 'location' => $location, + 'title' => $title, + 'address' => $address, + 'foursquare_id' => $foursquare_id, + 'foursquare_type' => $foursquare_type, + 'google_place_id' => $google_place_id, + 'google_place_type' => $google_place_type, + ]); + } } diff --git a/src/Telegram/Video.php b/src/Telegram/Video.php index e50f801..7615444 100644 --- a/src/Telegram/Video.php +++ b/src/Telegram/Video.php @@ -11,66 +11,65 @@ */ class Video extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; - /** Video width as defined by sender */ - public int $width; + /** Video width as defined by sender */ + public int $width; - /** Video height as defined by sender */ - public int $height; + /** Video height as defined by sender */ + public int $height; - /** Duration of the video in seconds as defined by sender */ - public int $duration; + /** Duration of the video in seconds as defined by sender */ + public int $duration; - /** Optional. Video thumbnail */ - public ?PhotoSize $thumb = null; + /** Optional. Video thumbnail */ + public ?PhotoSize $thumb = null; - /** Optional. Original filename as defined by sender */ - public ?string $file_name = null; + /** Optional. Original filename as defined by sender */ + public ?string $file_name = null; - /** Optional. Mime type of a file as defined by sender */ - public ?string $mime_type = null; + /** Optional. Mime type of a file as defined by sender */ + public ?string $mime_type = null; - /** Optional. File size in bytes */ - public ?int $file_size = null; + /** Optional. File size in bytes */ + public ?int $file_size = null; - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param int $width Video width as defined by sender - * @param int $height Video height as defined by sender - * @param int $duration Duration of the video in seconds as defined by sender - * @param PhotoSize $thumb Optional. Video thumbnail - * @param string $file_name Optional. Original filename as defined by sender - * @param string $mime_type Optional. Mime type of a file as defined by sender - * @param int $file_size Optional. File size in bytes - */ - public static function make( - string $file_id, - string $file_unique_id, - int $width, - int $height, - int $duration, - ?PhotoSize $thumb = null, - ?string $file_name = null, - ?string $mime_type = null, - ?int $file_size = null - ): static { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'width' => $width, - 'height' => $height, - 'duration' => $duration, - 'thumb' => $thumb, - 'file_name' => $file_name, - 'mime_type' => $mime_type, - 'file_size' => $file_size, - ]); - } + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $width Video width as defined by sender + * @param int $height Video height as defined by sender + * @param int $duration Duration of the video in seconds as defined by sender + * @param PhotoSize $thumb Optional. Video thumbnail + * @param string $file_name Optional. Original filename as defined by sender + * @param string $mime_type Optional. Mime type of a file as defined by sender + * @param int $file_size Optional. File size in bytes + */ + public static function make( + string $file_id, + string $file_unique_id, + int $width, + int $height, + int $duration, + ?PhotoSize $thumb = null, + ?string $file_name = null, + ?string $mime_type = null, + ?int $file_size = null + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'width' => $width, + 'height' => $height, + 'duration' => $duration, + 'thumb' => $thumb, + 'file_name' => $file_name, + 'mime_type' => $mime_type, + 'file_size' => $file_size, + ]); + } } diff --git a/src/Telegram/VideoChatEnded.php b/src/Telegram/VideoChatEnded.php index 7949475..04970d7 100644 --- a/src/Telegram/VideoChatEnded.php +++ b/src/Telegram/VideoChatEnded.php @@ -11,17 +11,16 @@ */ class VideoChatEnded extends \Tii\Telepath\Type { - /** Video chat duration in seconds */ - public int $duration; + /** Video chat duration in seconds */ + public int $duration; - - /** - * @param int $duration Video chat duration in seconds - */ - public static function make(int $duration): static - { - return new static([ - 'duration' => $duration, - ]); - } + /** + * @param int $duration Video chat duration in seconds + */ + public static function make(int $duration): static + { + return new static([ + 'duration' => $duration, + ]); + } } diff --git a/src/Telegram/VideoChatParticipantsInvited.php b/src/Telegram/VideoChatParticipantsInvited.php index dac6513..adf0047 100644 --- a/src/Telegram/VideoChatParticipantsInvited.php +++ b/src/Telegram/VideoChatParticipantsInvited.php @@ -11,20 +11,19 @@ */ class VideoChatParticipantsInvited extends \Tii\Telepath\Type { - /** - * New members that were invited to the video chat - * @var User[] - */ - public array $users; + /** + * New members that were invited to the video chat + * @var User[] + */ + public array $users; - - /** - * @param User[] $users New members that were invited to the video chat - */ - public static function make(array $users): static - { - return new static([ - 'users' => $users, - ]); - } + /** + * @param User[] $users New members that were invited to the video chat + */ + public static function make(array $users): static + { + return new static([ + 'users' => $users, + ]); + } } diff --git a/src/Telegram/VideoChatScheduled.php b/src/Telegram/VideoChatScheduled.php index 2c36eb6..7c9b88a 100644 --- a/src/Telegram/VideoChatScheduled.php +++ b/src/Telegram/VideoChatScheduled.php @@ -11,17 +11,16 @@ */ class VideoChatScheduled extends \Tii\Telepath\Type { - /** Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator */ - public int $start_date; + /** Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator */ + public int $start_date; - - /** - * @param int $start_date Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator - */ - public static function make(int $start_date): static - { - return new static([ - 'start_date' => $start_date, - ]); - } + /** + * @param int $start_date Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator + */ + public static function make(int $start_date): static + { + return new static([ + 'start_date' => $start_date, + ]); + } } diff --git a/src/Telegram/VideoChatStarted.php b/src/Telegram/VideoChatStarted.php index c61e421..0f3ffc8 100644 --- a/src/Telegram/VideoChatStarted.php +++ b/src/Telegram/VideoChatStarted.php @@ -11,9 +11,9 @@ */ class VideoChatStarted extends \Tii\Telepath\Type { - public static function make(): static - { - return new static([ - ]); - } + public static function make(): static + { + return new static([ + ]); + } } diff --git a/src/Telegram/VideoNote.php b/src/Telegram/VideoNote.php index f14c1c1..94e661c 100644 --- a/src/Telegram/VideoNote.php +++ b/src/Telegram/VideoNote.php @@ -11,48 +11,47 @@ */ class VideoNote extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; - - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; - - /** Video width and height (diameter of the video message) as defined by sender */ - public int $length; - - /** Duration of the video in seconds as defined by sender */ - public int $duration; - - /** Optional. Video thumbnail */ - public ?PhotoSize $thumb = null; - - /** Optional. File size in bytes */ - public ?int $file_size = null; - - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param int $length Video width and height (diameter of the video message) as defined by sender - * @param int $duration Duration of the video in seconds as defined by sender - * @param PhotoSize $thumb Optional. Video thumbnail - * @param int $file_size Optional. File size in bytes - */ - public static function make( - string $file_id, - string $file_unique_id, - int $length, - int $duration, - ?PhotoSize $thumb = null, - ?int $file_size = null - ): static { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'length' => $length, - 'duration' => $duration, - 'thumb' => $thumb, - 'file_size' => $file_size, - ]); - } + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; + + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; + + /** Video width and height (diameter of the video message) as defined by sender */ + public int $length; + + /** Duration of the video in seconds as defined by sender */ + public int $duration; + + /** Optional. Video thumbnail */ + public ?PhotoSize $thumb = null; + + /** Optional. File size in bytes */ + public ?int $file_size = null; + + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $length Video width and height (diameter of the video message) as defined by sender + * @param int $duration Duration of the video in seconds as defined by sender + * @param PhotoSize $thumb Optional. Video thumbnail + * @param int $file_size Optional. File size in bytes + */ + public static function make( + string $file_id, + string $file_unique_id, + int $length, + int $duration, + ?PhotoSize $thumb = null, + ?int $file_size = null + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'length' => $length, + 'duration' => $duration, + 'thumb' => $thumb, + 'file_size' => $file_size, + ]); + } } diff --git a/src/Telegram/Voice.php b/src/Telegram/Voice.php index 8756fd9..c7f556f 100644 --- a/src/Telegram/Voice.php +++ b/src/Telegram/Voice.php @@ -11,42 +11,41 @@ */ class Voice extends \Tii\Telepath\Type { - /** Identifier for this file, which can be used to download or reuse the file */ - public string $file_id; - - /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ - public string $file_unique_id; - - /** Duration of the audio in seconds as defined by sender */ - public int $duration; - - /** Optional. MIME type of the file as defined by sender */ - public ?string $mime_type = null; - - /** Optional. File size in bytes */ - public ?int $file_size = null; - - - /** - * @param string $file_id Identifier for this file, which can be used to download or reuse the file - * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. - * @param int $duration Duration of the audio in seconds as defined by sender - * @param string $mime_type Optional. MIME type of the file as defined by sender - * @param int $file_size Optional. File size in bytes - */ - public static function make( - string $file_id, - string $file_unique_id, - int $duration, - ?string $mime_type = null, - ?int $file_size = null - ): static { - return new static([ - 'file_id' => $file_id, - 'file_unique_id' => $file_unique_id, - 'duration' => $duration, - 'mime_type' => $mime_type, - 'file_size' => $file_size, - ]); - } + /** Identifier for this file, which can be used to download or reuse the file */ + public string $file_id; + + /** Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. */ + public string $file_unique_id; + + /** Duration of the audio in seconds as defined by sender */ + public int $duration; + + /** Optional. MIME type of the file as defined by sender */ + public ?string $mime_type = null; + + /** Optional. File size in bytes */ + public ?int $file_size = null; + + /** + * @param string $file_id Identifier for this file, which can be used to download or reuse the file + * @param string $file_unique_id Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. + * @param int $duration Duration of the audio in seconds as defined by sender + * @param string $mime_type Optional. MIME type of the file as defined by sender + * @param int $file_size Optional. File size in bytes + */ + public static function make( + string $file_id, + string $file_unique_id, + int $duration, + ?string $mime_type = null, + ?int $file_size = null + ): static { + return new static([ + 'file_id' => $file_id, + 'file_unique_id' => $file_unique_id, + 'duration' => $duration, + 'mime_type' => $mime_type, + 'file_size' => $file_size, + ]); + } } diff --git a/src/Telegram/WebAppData.php b/src/Telegram/WebAppData.php index 8c5b49e..6e2ebc6 100644 --- a/src/Telegram/WebAppData.php +++ b/src/Telegram/WebAppData.php @@ -11,22 +11,21 @@ */ class WebAppData extends \Tii\Telepath\Type { - /** The data. Be aware that a bad client can send arbitrary data in this field. */ - public string $data; + /** The data. Be aware that a bad client can send arbitrary data in this field. */ + public string $data; - /** Text of the web_app keyboard button, from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. */ - public string $button_text; + /** Text of the web_app keyboard button, from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. */ + public string $button_text; - - /** - * @param string $data The data. Be aware that a bad client can send arbitrary data in this field. - * @param string $button_text Text of the web_app keyboard button, from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. - */ - public static function make(string $data, string $button_text): static - { - return new static([ - 'data' => $data, - 'button_text' => $button_text, - ]); - } + /** + * @param string $data The data. Be aware that a bad client can send arbitrary data in this field. + * @param string $button_text Text of the web_app keyboard button, from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field. + */ + public static function make(string $data, string $button_text): static + { + return new static([ + 'data' => $data, + 'button_text' => $button_text, + ]); + } } diff --git a/src/Telegram/WebAppInfo.php b/src/Telegram/WebAppInfo.php index 5f2bda8..a53a2d2 100644 --- a/src/Telegram/WebAppInfo.php +++ b/src/Telegram/WebAppInfo.php @@ -11,17 +11,16 @@ */ class WebAppInfo extends \Tii\Telepath\Type { - /** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */ - public string $url; + /** An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps */ + public string $url; - - /** - * @param string $url An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps - */ - public static function make(string $url): static - { - return new static([ - 'url' => $url, - ]); - } + /** + * @param string $url An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps + */ + public static function make(string $url): static + { + return new static([ + 'url' => $url, + ]); + } } diff --git a/src/Telegram/WebhookInfo.php b/src/Telegram/WebhookInfo.php index da00809..de9975f 100644 --- a/src/Telegram/WebhookInfo.php +++ b/src/Telegram/WebhookInfo.php @@ -11,69 +11,68 @@ */ class WebhookInfo extends \Tii\Telepath\Type { - /** Webhook URL, may be empty if webhook is not set up */ - public string $url; + /** Webhook URL, may be empty if webhook is not set up */ + public string $url; - /** True, if a custom certificate was provided for webhook certificate checks */ - public bool $has_custom_certificate; + /** True, if a custom certificate was provided for webhook certificate checks */ + public bool $has_custom_certificate; - /** Number of updates awaiting delivery */ - public int $pending_update_count; + /** Number of updates awaiting delivery */ + public int $pending_update_count; - /** Optional. Currently used webhook IP address */ - public ?string $ip_address = null; + /** Optional. Currently used webhook IP address */ + public ?string $ip_address = null; - /** Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook */ - public ?int $last_error_date = null; + /** Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook */ + public ?int $last_error_date = null; - /** Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook */ - public ?string $last_error_message = null; + /** Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook */ + public ?string $last_error_message = null; - /** Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters */ - public ?int $last_synchronization_error_date = null; + /** Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters */ + public ?int $last_synchronization_error_date = null; - /** Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */ - public ?int $max_connections = null; + /** Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery */ + public ?int $max_connections = null; - /** - * Optional. A list of update types the bot is subscribed to. Defaults to all update types except chat_member - * @var string[] - */ - public ?array $allowed_updates = null; + /** + * Optional. A list of update types the bot is subscribed to. Defaults to all update types except chat_member + * @var string[] + */ + public ?array $allowed_updates = null; - - /** - * @param string $url Webhook URL, may be empty if webhook is not set up - * @param bool $has_custom_certificate True, if a custom certificate was provided for webhook certificate checks - * @param int $pending_update_count Number of updates awaiting delivery - * @param string $ip_address Optional. Currently used webhook IP address - * @param int $last_error_date Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook - * @param string $last_error_message Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook - * @param int $last_synchronization_error_date Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters - * @param int $max_connections Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery - * @param string[] $allowed_updates Optional. A list of update types the bot is subscribed to. Defaults to all update types except chat_member - */ - public static function make( - string $url, - bool $has_custom_certificate, - int $pending_update_count, - ?string $ip_address = null, - ?int $last_error_date = null, - ?string $last_error_message = null, - ?int $last_synchronization_error_date = null, - ?int $max_connections = null, - ?array $allowed_updates = null - ): static { - return new static([ - 'url' => $url, - 'has_custom_certificate' => $has_custom_certificate, - 'pending_update_count' => $pending_update_count, - 'ip_address' => $ip_address, - 'last_error_date' => $last_error_date, - 'last_error_message' => $last_error_message, - 'last_synchronization_error_date' => $last_synchronization_error_date, - 'max_connections' => $max_connections, - 'allowed_updates' => $allowed_updates, - ]); - } + /** + * @param string $url Webhook URL, may be empty if webhook is not set up + * @param bool $has_custom_certificate True, if a custom certificate was provided for webhook certificate checks + * @param int $pending_update_count Number of updates awaiting delivery + * @param string $ip_address Optional. Currently used webhook IP address + * @param int $last_error_date Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook + * @param string $last_error_message Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook + * @param int $last_synchronization_error_date Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters + * @param int $max_connections Optional. Maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery + * @param string[] $allowed_updates Optional. A list of update types the bot is subscribed to. Defaults to all update types except chat_member + */ + public static function make( + string $url, + bool $has_custom_certificate, + int $pending_update_count, + ?string $ip_address = null, + ?int $last_error_date = null, + ?string $last_error_message = null, + ?int $last_synchronization_error_date = null, + ?int $max_connections = null, + ?array $allowed_updates = null + ): static { + return new static([ + 'url' => $url, + 'has_custom_certificate' => $has_custom_certificate, + 'pending_update_count' => $pending_update_count, + 'ip_address' => $ip_address, + 'last_error_date' => $last_error_date, + 'last_error_message' => $last_error_message, + 'last_synchronization_error_date' => $last_synchronization_error_date, + 'max_connections' => $max_connections, + 'allowed_updates' => $allowed_updates, + ]); + } } diff --git a/telepathy b/telepathy index 88db91f..e0afc91 100755 Binary files a/telepathy and b/telepathy differ