Skip to content

Commit

Permalink
Bot API 6.2 Types
Browse files Browse the repository at this point in the history
  • Loading branch information
TiiFuchs committed Aug 25, 2022
1 parent 1fdc30c commit 0ab1046
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 31 deletions.
6 changes: 6 additions & 0 deletions src/Telegram/Chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class Chat extends Type
/** Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat. */
public ?bool $has_private_forwards = null;

/** Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat. */
public ?bool $has_restricted_voice_and_video_messages = null;

/** Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat. */
public ?bool $join_to_send_messages = null;

Expand Down Expand Up @@ -89,6 +92,7 @@ class Chat extends Type
* @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=<user_id> links only in chats with the user. Returned only in getChat.
* @param bool $has_restricted_voice_and_video_messages Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat.
* @param bool $join_to_send_messages Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.
* @param bool $join_by_request Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
* @param string $description Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
Expand All @@ -113,6 +117,7 @@ public static function make(
?ChatPhoto $photo = null,
?string $bio = null,
?bool $has_private_forwards = null,
?bool $has_restricted_voice_and_video_messages = null,
?bool $join_to_send_messages = null,
?bool $join_by_request = null,
?string $description = null,
Expand All @@ -137,6 +142,7 @@ public static function make(
'photo' => $photo,
'bio' => $bio,
'has_private_forwards' => $has_private_forwards,
'has_restricted_voice_and_video_messages' => $has_restricted_voice_and_video_messages,
'join_to_send_messages' => $join_to_send_messages,
'join_by_request' => $join_by_request,
'description' => $description,
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/InlineQueryResultArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class InlineQueryResultArticle extends InlineQueryResult
/** 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 */
/** 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 */
Expand All @@ -44,7 +44,7 @@ class InlineQueryResultArticle extends InlineQueryResult
* @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 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
Expand Down
28 changes: 14 additions & 14 deletions src/Telegram/InputInvoiceMessageContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ class InputInvoiceMessageContent extends InputMessageContent
/** Optional. Photo height */
public ?int $photo_height = null;

/** Optional. Pass True, if you require the user's full name to complete the order */
/** 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 */
/** 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 */
/** 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 */
/** 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 the user's phone number should be sent to provider */
/** Optional. Pass True if the user's phone number should be sent to provider */
public ?bool $send_phone_number_to_provider = null;

/** Optional. Pass True, if the user's email address should be sent to provider */
/** Optional. Pass True if the 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 */
/** Optional. Pass True if the final price depends on the shipping method */
public ?bool $is_flexible = null;

/**
Expand All @@ -91,13 +91,13 @@ class InputInvoiceMessageContent extends InputMessageContent
* @param int $photo_size Optional. Photo size in bytes
* @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 the user's phone number should be sent to provider
* @param bool $send_email_to_provider Optional. Pass True, if the 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
* @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 the user's phone number should be sent to provider
* @param bool $send_email_to_provider Optional. Pass True if the 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,
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/InputMediaVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class InputMediaVideo extends InputMedia
/** Optional. Video duration in seconds */
public ?int $duration = null;

/** Optional. Pass True, if the uploaded video is suitable for streaming */
/** Optional. Pass True if the uploaded video is suitable for streaming */
public ?bool $supports_streaming = null;

/**
Expand All @@ -38,7 +38,7 @@ class InputMediaVideo extends InputMedia
* @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
* @param bool $supports_streaming Optional. Pass True if the uploaded video is suitable for streaming
*/
public static function make(
string|\Tii\Telepath\Types\InputFile $media,
Expand Down
4 changes: 2 additions & 2 deletions src/Telegram/LoginUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class LoginUrl extends 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. */
/** An HTTPS 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. */
Expand All @@ -26,7 +26,7 @@ class LoginUrl extends Type
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 $url An HTTPS 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.
Expand Down
12 changes: 9 additions & 3 deletions src/Telegram/MessageEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
class MessageEntity extends 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) */
/** 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), “custom_emoji” (for inline custom emoji stickers) */
public string $type;

/** Offset in UTF-16 code units to the start of the entity */
Expand All @@ -31,21 +31,26 @@ class MessageEntity extends Type
/** Optional. For “pre” only, the programming language of the entity text */
public ?string $language = null;

/** Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker */
public ?string $custom_emoji_id = 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 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), “custom_emoji” (for inline custom emoji stickers)
* @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
* @param string $custom_emoji_id Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker
*/
public static function make(
string $type,
int $offset,
int $length,
?string $url = null,
?User $user = null,
?string $language = null
?string $language = null,
?string $custom_emoji_id = null
): static {
return new static([
'type' => $type,
Expand All @@ -54,6 +59,7 @@ public static function make(
'url' => $url,
'user' => $user,
'language' => $language,
'custom_emoji_id' => $custom_emoji_id,
]);
}
}
16 changes: 14 additions & 2 deletions src/Telegram/Sticker.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class Sticker extends Type
/** 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;

/** Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video. */
public string $type;

/** Sticker width */
public int $width;

Expand All @@ -40,32 +43,38 @@ class Sticker extends Type
/** Optional. Name of the sticker set to which the sticker belongs */
public ?string $set_name = null;

/** Optional. Premium animation for the sticker, if the sticker is premium */
/** Optional. For premium regular stickers, premium animation for the sticker */
public ?File $premium_animation = null;

/** Optional. For mask stickers, the position where the mask should be placed */
public ?MaskPosition $mask_position = null;

/** Optional. For custom emoji stickers, unique identifier of the custom emoji */
public ?string $custom_emoji_id = 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 string $type Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video.
* @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 File $premium_animation Optional. Premium animation for the sticker, if the sticker is premium
* @param File $premium_animation Optional. For premium regular stickers, premium animation for the sticker
* @param MaskPosition $mask_position Optional. For mask stickers, the position where the mask should be placed
* @param string $custom_emoji_id Optional. For custom emoji stickers, unique identifier of the custom emoji
* @param int $file_size Optional. File size in bytes
*/
public static function make(
string $file_id,
string $file_unique_id,
string $type,
int $width,
int $height,
bool $is_animated,
Expand All @@ -75,11 +84,13 @@ public static function make(
?string $set_name = null,
?File $premium_animation = null,
?MaskPosition $mask_position = null,
?string $custom_emoji_id = null,
?int $file_size = null
): static {
return new static([
'file_id' => $file_id,
'file_unique_id' => $file_unique_id,
'type' => $type,
'width' => $width,
'height' => $height,
'is_animated' => $is_animated,
Expand All @@ -89,6 +100,7 @@ public static function make(
'set_name' => $set_name,
'premium_animation' => $premium_animation,
'mask_position' => $mask_position,
'custom_emoji_id' => $custom_emoji_id,
'file_size' => $file_size,
]);
}
Expand Down
Loading

0 comments on commit 0ab1046

Please sign in to comment.