Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Entities/Birthdate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Longman\TelegramBot\Entities;

/**
* Class Birthdate
*
* Represents a birthdate of a user.
*
* @link https://core.telegram.org/bots/api#birthdate
*
* @method int getDay() Day of the month; 1-31
* @method int getMonth() Month of the year; 1-12
* @method int getYear() Optional. Year of birth; 1900-2100
*/
class Birthdate extends Entity
{

}
30 changes: 30 additions & 0 deletions src/Entities/BusinessConnection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Longman\TelegramBot\Entities;

/**
* Class BusinessConnection
*
* Describes the connection of the bot with a business account.
*
* @link https://core.telegram.org/bots/api#businessconnection
*
* @method string getId() Unique identifier of the business connection
* @method int getUserChatId() Business account user that created the business connection
* @method int getDate() Date the connection was established in Unix time
* @method bool getCanReply() True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours
* @method bool getIsEnabled() True, if the business connection is active
*/
class BusinessConnection extends Entity
{

}
36 changes: 36 additions & 0 deletions src/Entities/BusinessIntro.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Longman\TelegramBot\Entities;

/**
* Class BusinessIntro
*
* Describes the introductory message of a business account.
*
* @link https://core.telegram.org/bots/api#businessintro
*
* @method string getTitle() Optional. Title text of the business intro
* @method string getMessage() Optional. Message text of the business intro
* @method Sticker getSticker() Optional. Sticker of the business intro
*/
class BusinessIntro extends Entity
{
/**
* {@inheritdoc}
*/
protected function subEntities(): array
{
return [
'sticker' => Sticker::class,
];
}
}
35 changes: 35 additions & 0 deletions src/Entities/BusinessLocation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Longman\TelegramBot\Entities;

/**
* Class BusinessLocation
*
* Contains information about the location of a business.
*
* @link https://core.telegram.org/bots/api#businesslocation
*
* @method string getAddress() Address of the business
* @method Location getLocation() Optional. Location of the business
*/
class BusinessLocation extends Entity
{
/**
* {@inheritdoc}
*/
protected function subEntities(): array
{
return [
'location' => Location::class,
];
}
}
36 changes: 36 additions & 0 deletions src/Entities/BusinessMessagesDeleted.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Longman\TelegramBot\Entities;

/**
* Class BusinessMessagesDeleted
*
* This object is received when messages are deleted from a business account.
*
* @link https://core.telegram.org/bots/api#businessmessagesdeleted
*
* @method string getBusinessConnectionId() Unique identifier of the business connection
* @method Chat getChat() Information about a chat in the business account. The bot may not have access to the chat or the corresponding user.
* @method int[] getMessageIds() A list of identifiers of deleted messages in the chat of the business account
*/
class BusinessMessagesDeleted extends Entity
{
/**
* {@inheritdoc}
*/
protected function subEntities(): array
{
return [
'chat' => Chat::class,
];
}
}
35 changes: 35 additions & 0 deletions src/Entities/BusinessOpeningHours.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Longman\TelegramBot\Entities;

/**
* Class BusinessOpeningHours
*
* Describes the opening hours of a business.
*
* @link https://core.telegram.org/bots/api#businessopeninghours
*
* @method string getTimeZoneName() Unique name of the time zone for which the opening hours are defined
* @method BusinessOpeningHoursInterval[] getOpeningHours() List of time intervals describing business opening hours
*/
class BusinessOpeningHours extends Entity
{
/**
* {@inheritdoc}
*/
protected function subEntities(): array
{
return [
'opening_hours' => [BusinessOpeningHoursInterval::class],
];
}
}
27 changes: 27 additions & 0 deletions src/Entities/BusinessOpeningHoursInterval.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Longman\TelegramBot\Entities;

/**
* Class BusinessOpeningHoursInterval
*
* Describes an interval of time during which a business is open.
*
* @link https://core.telegram.org/bots/api#businessopeninghoursinterval
*
* @method int getOpeningMinute() The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60
* @method int getClosingMinute() The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60
*/
class BusinessOpeningHoursInterval extends Entity
{

}
20 changes: 15 additions & 5 deletions src/Entities/Chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
* @method string getCustomEmojiStickerSetName() Optional. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be used by all users and bots in the group.
* @method int getLinkedChatId() Optional. Unique identifier for the linked chat. Returned only in getChat.
* @method ChatLocation getLocation() Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
* @method BusinessIntro getBusinessIntro() Optional. For private chats with business accounts, the intro of the business. Returned only in getChat.
* @method BusinessLocation getBusinessLocation() Optional. For private chats with business accounts, the location of the business. Returned only in getChat.
* @method BusinessOpeningHours getBusinessOpeningHours() Optional. For private chats with business accounts, the opening hours of the business. Returned only in getChat.
* @method Chat getPersonalChat() Optional. For private chats, the personal channel of the user. Returned only in getChat.
* @method Birthdate getBirthdate() Optional. For private chats with ordinary users, the user's birthdate. Returned only in getChat.
*/
class Chat extends Entity
{
Expand All @@ -67,11 +72,16 @@ class Chat extends Entity
protected function subEntities(): array
{
return [
'photo' => ChatPhoto::class,
'available_reactions' => [ReactionTypeFactory::class],
'pinned_message' => Message::class,
'permissions' => ChatPermissions::class,
'location' => ChatLocation::class,
'photo' => ChatPhoto::class,
'available_reactions' => [ReactionTypeFactory::class],
'pinned_message' => Message::class,
'permissions' => ChatPermissions::class,
'location' => ChatLocation::class,
'business_intro' => BusinessIntro::class,
'business_location' => BusinessLocation::class,
'business_opening_hours' => BusinessOpeningHours::class,
'personal_chat' => Chat::class,
'birthdate' => Birthdate::class,
];
}

Expand Down
17 changes: 14 additions & 3 deletions src/Entities/ChatShared.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,21 @@
*
* @link https://core.telegram.org/bots/api#chatshared
*
* @method int getRequestId() Identifier of the request
* @method int getChatId() Identifier of the shared chat.
* @method int getRequestId() Identifier of the request
* @method int getChatId() Identifier of the shared 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 64-bit integer or double-precision float type are safe for storing this identifier. The bot may not have access to the chat and could be unable to use this identifier, unless the chat is already known to the bot by some other means.
* @method string getTitle() Optional. Title of the chat, if the title was requested by the bot
* @method string getUsername() Optional. Username of the chat, if the username was requested by the bot
* @method PhotoSize[] getPhoto() Optional. Available sizes of the chat photo, if the photo was requested by the bot
*/
class ChatShared extends Entity
{

/**
* {@inheritdoc}
*/
protected function subEntities(): array
{
return [
'photo' => [PhotoSize::class],
];
}
}
1 change: 1 addition & 0 deletions src/Entities/InputSticker.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* @method string[] getEmojiList() List of 1-20 emoji associated with the sticker
* @method MaskPosition getMaskPosition() Optional. Position where the mask should be placed on faces. For “mask” stickers only.
* @method string[] getKeywords() Optional. List of 0-20 search keywords for the sticker with total length of up to 64 characters. For “regular” and “custom_emoji” stickers only.
* @method string getFormat() Format of the sticker, must be one of “static”, “animated”, “video”
*/
class InputSticker extends Entity
{
Expand Down
6 changes: 6 additions & 0 deletions src/Entities/KeyboardButtonRequestChat.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* @method ChatAdministratorRights getUserAdministratorRights() Optional. A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied.
* @method ChatAdministratorRights getBotAdministratorRights() Optional. A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied.
* @method bool getBotIsMember() Optional. Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied.
* @method bool getRequestTitle() Optional. Pass True to request the chat's title
* @method bool getRequestUsername() Optional. Pass True to request the chat's username
* @method bool getRequestPhoto() Optional. Pass True to request the chat's photo
*
* @method $this setRequestId(int $request_id) Signed 32-bit identifier of the request, which will be received back in the ChatShared object. Must be unique within the message
* @method $this setChatIsChannel(bool $chat_is_channel) Pass True to request a channel chat, pass False to request a group or a supergroup chat.
Expand All @@ -26,6 +29,9 @@
* @method $this setUserAdministratorRights(ChatAdministratorRights $user_administrator_rights) Optional. A JSON-serialized object listing the required administrator rights of the user in the chat. The rights must be a superset of bot_administrator_rights. If not specified, no additional restrictions are applied.
* @method $this setBotAdministratorRights(ChatAdministratorRights $bot_administrator_rights) Optional. A JSON-serialized object listing the required administrator rights of the bot in the chat. The rights must be a subset of user_administrator_rights. If not specified, no additional restrictions are applied.
* @method $this setBotIsMember(bool $bot_is_member) Optional. Pass True to request a chat with the bot as a member. Otherwise, no additional restrictions are applied.
* @method $this setRequestTitle(bool $request_title) Optional. Pass True to request the chat's title
* @method $this setRequestUsername(bool $request_username) Optional. Pass True to request the chat's username
* @method $this setRequestPhoto(bool $request_photo) Optional. Pass True to request the chat's photo
*/
class KeyboardButtonRequestChat extends Entity
{
Expand Down
22 changes: 14 additions & 8 deletions src/Entities/KeyboardButtonRequestUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@
*
* @link https://core.telegram.org/bots/api#keyboardbuttonrequestusers
*
* @method int getRequestId() Signed 32-bit identifier of the request, which will be received back in the UserShared object. Must be unique within the message
* @method bool getUserIsBot() Optional. Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied.
* @method bool getUserIsPremium() Optional. Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied.
* @method int getMaxQuantity() Optional. The maximum number of users to be selected; 1-10. Defaults to 1.
* @method int getRequestId() Signed 32-bit identifier of the request, which will be received back in the UserShared object. Must be unique within the message
* @method bool getUserIsBot() Optional. Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied.
* @method bool getUserIsPremium() Optional. Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied.
* @method int getMaxQuantity() Optional. The maximum number of users to be selected; 1-10. Defaults to 1.
* @method bool getRequestName() Optional. Pass True to request the users' first and last names
* @method bool getRequestUsername() Optional. Pass True to request the users' usernames
* @method bool getRequestPhoto() Optional. Pass True to request the users' photos
*
* @method $this setRequestId(int $request_id) Signed 32-bit identifier of the request, which will be received back in the UserShared object. Must be unique within the message
* @method $this setUserIsBot(bool $user_is_bot) Optional. Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied.
* @method $this setUserIsPremium(bool $user_is_premium) Optional. Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied.
* @method int setMaxQuantity(int $set_max_quantity) Optional. The maximum number of users to be selected; 1-10. Defaults to 1.
* @method $this setRequestId(int $request_id) Signed 32-bit identifier of the request, which will be received back in the UserShared object. Must be unique within the message
* @method $this setUserIsBot(bool $user_is_bot) Optional. Pass True to request a bot, pass False to request a regular user. If not specified, no additional restrictions are applied.
* @method $this setUserIsPremium(bool $user_is_premium) Optional. Pass True to request a premium user, pass False to request a non-premium user. If not specified, no additional restrictions are applied.
* @method $this setMaxQuantity(int $set_max_quantity) Optional. The maximum number of users to be selected; 1-10. Defaults to 1.
* @method $this setRequestName(bool $request_name) Optional. Pass True to request the users' first and last names
* @method $this setRequestUsername(bool $request_username) Optional. Pass True to request the users' usernames
* @method $this setRequestPhoto(bool $request_photo) Optional. Pass True to request the users' photos
*/
class KeyboardButtonRequestUsers extends Entity
{
Expand Down
3 changes: 3 additions & 0 deletions src/Entities/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
* @method VideoChatParticipantsInvited getVideoChatParticipantsInvited() Optional. Service message: new participants invited to a voice chat
* @method WebAppData getWebAppData() Optional. Service message: data sent by a Web App
* @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
* @method string getBusinessConnectionId() Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message is business_message.
* @method User getSenderBusinessBot() Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the business account.
* @method bool getIsFromOffline() Optional. True, if the message was sent by an offline user. Applicable to messages sent by the bot on behalf of a user to a fellow user in a private chat.
*/
class Message extends Entity implements MaybeInaccessibleMessage
{
Expand Down
38 changes: 38 additions & 0 deletions src/Entities/SharedUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Longman\TelegramBot\Entities;

/**
* Class SharedUser
*
* This object contains information about a user that was shared with the bot using a KeyboardButtonRequestUsers button.
*
* @link https://core.telegram.org/bots/api#shareduser
*
* @method int getUserId() Identifier of the shared user. 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 64-bit integers or double-precision float types are safe for storing this identifier. The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means.
* @method string getFirstName() Optional. First name of the user, if the name was requested by the bot
* @method string getLastName() Optional. Last name of the user, if the name was requested by the bot
* @method string getUsername() Optional. Username of the user, if the username was requested by the bot
* @method PhotoSize[] getPhoto() Optional. Available sizes of the user photo, if the photo was requested by the bot
*/
class SharedUser extends Entity
{
/**
* {@inheritdoc}
*/
protected function subEntities(): array
{
return [
'photo' => [PhotoSize::class],
];
}
}
Loading