* Renamed namespace from \TgBotLib\Abstracts
to \TgBotLib\Enums
* Updated class type to `final class` in `\TgBotLib\Enums > BotCommandScopeType` * Updated class type to `final class` in `\TgBotLib\Enums > ChatActionType` * Updated class type to `final class` in `\TgBotLib\Enums > ChatMemberStatus` * Updated class type to `final class` in `\TgBotLib\Enums > ChatType` * Updated class type to `final class` in `\TgBotLib\Enums > EventType` * Updated class type to `final class` in `\TgBotLib\Enums > InlineQueryResultType` * Updated class type to `final class` in `\TgBotLib\Enums > InputMediaType` * Updated class type to `final class` in `\TgBotLib\Enums > InputButtonType` * Updated class type to `final class` in `\TgBotLib\Enums > MessageEntityType` * Updated class type to `final class` in `\TgBotLib\Enums > PassportElementType` * Updated class type to `final class` in `\TgBotLib\Enums > PollType` * Updated class type to `final class` in `\TgBotLib\Enums > StickerFormat` * Updated class type to `final class` in `\TgBotLib\Enums > StickerType` * Updated class type to `final class` in `\TgBotLib\Enums > ThumbnailMimeType` * Updated class type to `final class` in `\TgBotLib\Enums > UpdateEventType`
This commit is contained in:
parent
176ea791bf
commit
5ec6f7271a
56 changed files with 1279 additions and 332 deletions
3
.idea/inspectionProfiles/Project_Default.xml
generated
3
.idea/inspectionProfiles/Project_Default.xml
generated
|
@ -19,6 +19,9 @@
|
|||
<option value="X-Args-3" />
|
||||
<option value="X-Args-4" />
|
||||
<option value="X-Args-5" />
|
||||
<option value="X-Temperature" />
|
||||
<option value="X-Model" />
|
||||
<option value="X-OPENAI-API-KEY" />
|
||||
</set>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
|
|
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -46,6 +46,22 @@ input objects for methods that require input objects.
|
|||
* Added method `\TgBotLib\Objects\Telegram\WebAppInfo::setUrl` to `\TgBotLib\Objects\Telegram\WebAppInfo`
|
||||
* Added methods `\TgBotLib\Classes\Validate::url`, `\TgBotLib\Classes\Validate::length`, & `\TgBotLib\Classes\Validate::isHttps` to `\TgBotLib\Classes\Validate`
|
||||
* Updated documentation for `\TgBotLib\Bot::editMessageMedia`
|
||||
* Renamed namespace from `\TgBotLib\Abstracts` to `\TgBotLib\Enums`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > BotCommandScopeType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > ChatActionType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > ChatMemberStatus`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > ChatType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > EventType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > InlineQueryResultType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > InputMediaType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > InputButtonType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > MessageEntityType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > PassportElementType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > PollType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > StickerFormat`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > StickerType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > ThumbnailMimeType`
|
||||
* Updated class type to `final class` in `\TgBotLib\Enums > UpdateEventType`
|
||||
|
||||
|
||||
## [6.6.0] - 2023-04-10
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class BotCommandScopeType
|
||||
{
|
||||
const Default = 'default';
|
||||
const AllPrivateChats = 'all_private_chats';
|
||||
const AllGroupChats = 'all_group_chats';
|
||||
const AllChatAdministrators = 'all_chat_administrators';
|
||||
const Chat = 'chat';
|
||||
const ChatAdministrators = 'chat_administrators';
|
||||
const ChatMember = 'chat_member';
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class ChatActionType
|
||||
{
|
||||
const Typing = 'typing';
|
||||
const UploadPhoto = 'upload_photo';
|
||||
const RecordVideo = 'record_video';
|
||||
const UploadVideo = 'upload_video';
|
||||
const RecordAudio = 'record_audio';
|
||||
const UploadAudio = 'upload_audio';
|
||||
const UploadDocument = 'upload_document';
|
||||
const FindLocation = 'find_location';
|
||||
const RecordVideoNote = 'record_video_note';
|
||||
const UploadVideoNote = 'upload_video_note';
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class ChatMemberStatus
|
||||
{
|
||||
const Creator = 'creator';
|
||||
const Administrator = 'administrator';
|
||||
const Member = 'member';
|
||||
const Restricted = 'restricted';
|
||||
const Left = 'left';
|
||||
const Kicked = 'kicked';
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class ChatType
|
||||
{
|
||||
const Private = 'private';
|
||||
const Group = 'group';
|
||||
const Supergroup = 'supergroup';
|
||||
const Channel = 'channel';
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class EventType
|
||||
{
|
||||
const GenericUpdate = 'generic_update';
|
||||
const Message = 'message';
|
||||
const EditedMessage = 'edited_message';
|
||||
const GenericCommandMessage = 'generic_command_message';
|
||||
const ChatMemberJoined = 'chat_member_joined';
|
||||
const ChatMemberLeft = 'chat_member_left';
|
||||
const ChatMemberKicked = 'chat_member_kicked';
|
||||
const ChatMemberBanned = 'chat_member_banned';
|
||||
const ChatMemberUnbanned = 'chat_member_unbanned';
|
||||
const ChatMemberPromoted = 'chat_member_promoted';
|
||||
const ChatMemberDemoted = 'chat_member_demoted';
|
||||
const ChatMemberRestricted = 'chat_member_restricted';
|
||||
const ChatMemberUnrestricted = 'chat_member_unrestricted';
|
||||
const ChatTitleChanged = 'chat_title_changed';
|
||||
const ChatPhotoChanged = 'chat_photo_changed';
|
||||
Const CallbackQuery = 'callback_query';
|
||||
|
||||
const All = [
|
||||
self::GenericUpdate,
|
||||
self::Message,
|
||||
self::EditedMessage,
|
||||
self::GenericCommandMessage,
|
||||
self::ChatMemberJoined,
|
||||
self::ChatMemberLeft,
|
||||
self::ChatMemberKicked,
|
||||
self::ChatMemberBanned,
|
||||
self::ChatMemberUnbanned,
|
||||
self::ChatMemberPromoted,
|
||||
self::ChatMemberDemoted,
|
||||
self::ChatMemberRestricted,
|
||||
self::ChatMemberUnrestricted,
|
||||
self::ChatTitleChanged,
|
||||
self::ChatPhotoChanged,
|
||||
self::CallbackQuery,
|
||||
];
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class InputMediaType
|
||||
{
|
||||
const Photo = 'photo';
|
||||
const Video = 'video';
|
||||
const Animation = 'animation';
|
||||
const Audio = 'audio';
|
||||
const Document = 'document';
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class MenuButtonType
|
||||
{
|
||||
const Commands = 'commands';
|
||||
const WebApp = 'web_app';
|
||||
const Default = 'default';
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class MessageEntityType
|
||||
{
|
||||
const Mention = 'mention';
|
||||
|
||||
const Hashtag = 'hashtag';
|
||||
|
||||
const CashTag = 'cashtag';
|
||||
|
||||
const BotCommand = 'bot_command';
|
||||
|
||||
const Url = 'url';
|
||||
|
||||
const Email = 'email';
|
||||
|
||||
const PhoneNumber = 'phone_number';
|
||||
|
||||
const Bold = 'bold';
|
||||
|
||||
const Italic = 'italic';
|
||||
|
||||
const Underline = 'underline';
|
||||
|
||||
const Strikethrough = 'strikethrough';
|
||||
|
||||
const Spoiler = 'spoiler';
|
||||
|
||||
const Code = 'code';
|
||||
|
||||
const Pre = 'pre';
|
||||
|
||||
const TextLink = 'text_link';
|
||||
|
||||
const TextMention = 'text_mention';
|
||||
|
||||
const CustomEmoji = 'custom_emoji';
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class PassportElementType
|
||||
{
|
||||
const PersonalDetails = 'personal_details';
|
||||
const Passport = 'passport';
|
||||
const DriverLicense = 'driver_license';
|
||||
const IdentityCard = 'identity_card';
|
||||
const InternalPassport = 'internal_passport';
|
||||
const Address = 'address';
|
||||
const UtilityBill = 'utility_bill';
|
||||
const BankStatement = 'bank_statement';
|
||||
const RentalAgreement = 'rental_agreement';
|
||||
const PassportRegistration = 'passport_registration';
|
||||
const TemporaryRegistration = 'temporary_registration';
|
||||
const PhoneNumber = 'phone_number';
|
||||
const Email = 'email';
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class PollType
|
||||
{
|
||||
const Regular = 'regular';
|
||||
|
||||
const Quiz = 'quiz';
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class StickerFormat
|
||||
{
|
||||
const Static = 'static';
|
||||
const Animated = 'animated';
|
||||
const Video = 'video';
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class StickerType
|
||||
{
|
||||
const Regular = 'regular';
|
||||
|
||||
const Mask = 'mask';
|
||||
|
||||
const CustomEmoji = 'custom_emoji';
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class ThumbnailMimeType
|
||||
{
|
||||
const Jpeg = 'image/jpeg';
|
||||
const Gif = 'image/gif';
|
||||
const Mp4 = 'video/mp4';
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
|
||||
abstract class UpdateEventType
|
||||
{
|
||||
const GenericUpdate = 'generic_update';
|
||||
|
||||
const Message = 'message';
|
||||
|
||||
const EditedMessage = 'edited_message';
|
||||
}
|
|
@ -9,8 +9,8 @@
|
|||
use InvalidArgumentException;
|
||||
use LogLib\Log;
|
||||
use TempFile\TempFile;
|
||||
use TgBotLib\Abstracts\ChatMemberStatus;
|
||||
use TgBotLib\Abstracts\EventType;
|
||||
use TgBotLib\Enums\ChatMemberStatus;
|
||||
use TgBotLib\Enums\EventType;
|
||||
use TgBotLib\Exceptions\TelegramException;
|
||||
use TgBotLib\Interfaces\CommandInterface;
|
||||
use TgBotLib\Interfaces\EventInterface;
|
||||
|
@ -335,25 +335,25 @@
|
|||
$do_handle = false;
|
||||
switch($event)
|
||||
{
|
||||
case EventType::GenericUpdate:
|
||||
case EventType::GENERIC_UPDATE:
|
||||
$handler->handle($this, $update);
|
||||
break;
|
||||
|
||||
case EventType::Message:
|
||||
case EventType::MESSAGE:
|
||||
if(($update->getMessage() ?? null) !== null)
|
||||
{
|
||||
$do_handle = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case EventType::EditedMessage:
|
||||
case EventType::EDITED_MESSAGE:
|
||||
if(($update->getEditedMessage() ?? null) !== null)
|
||||
{
|
||||
$do_handle = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case EventType::GenericCommandMessage:
|
||||
case EventType::GENERIC_COMMAND_MESSAGE:
|
||||
if(($update->getMessage() ?? null) !== null && ($update->getMessage()->getText() ?? null) !== null)
|
||||
{
|
||||
$text = $update->getMessage()->getText();
|
||||
|
@ -364,25 +364,25 @@
|
|||
}
|
||||
break;
|
||||
|
||||
case EventType::ChatMemberJoined:
|
||||
case EventType::CHAT_MEMBER_JOINED:
|
||||
if(($update->getMessage() ?? null) !== null && ($update->getMessage()->getNewChatMembers() ?? null) !== null)
|
||||
{
|
||||
$do_handle = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case EventType::ChatMemberLeft:
|
||||
case EventType::CHAT_MEMBER_LEFT:
|
||||
if(($update->getMessage() ?? null) !== null && ($update->getMessage()->getLeftChatMember() ?? null) !== null)
|
||||
{
|
||||
$do_handle = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case EventType::ChatMemberKicked:
|
||||
case EventType::CHAT_MEMBER_KICKED:
|
||||
if(($update->getMyChatMember() ?? null) !== null && ($update->getMyChatMember()->getNewChatMember() ?? null) !== null)
|
||||
{
|
||||
if(
|
||||
$update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::Kicked &&
|
||||
$update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::KICKED &&
|
||||
$update->getMyChatMember()->getNewChatMember()->getUntilDate() === null
|
||||
)
|
||||
{
|
||||
|
@ -391,11 +391,11 @@
|
|||
}
|
||||
break;
|
||||
|
||||
case EventType::ChatMemberBanned:
|
||||
case EventType::CHAT_MEMBER_BANNED:
|
||||
if(($update->getMyChatMember() ?? null) !== null && ($update->getMyChatMember()->getNewChatMember() ?? null) !== null)
|
||||
{
|
||||
if(
|
||||
$update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::Kicked &&
|
||||
$update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::KICKED &&
|
||||
$update->getMyChatMember()->getNewChatMember()->getUntilDate() !== null
|
||||
)
|
||||
{
|
||||
|
@ -404,53 +404,53 @@
|
|||
}
|
||||
break;
|
||||
|
||||
case EventType::ChatMemberUnrestricted:
|
||||
case EventType::ChatMemberDemoted:
|
||||
case EventType::ChatMemberUnbanned:
|
||||
case EventType::CHAT_MEMBER_UNRESTRICTED:
|
||||
case EventType::CHAT_MEMBER_DEMOTED:
|
||||
case EventType::CHAT_MEMBER_UNBANNED:
|
||||
if(($update->getMyChatMember() ?? null) !== null && ($update->getMyChatMember()->getNewChatMember() ?? null) !== null)
|
||||
{
|
||||
if($update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::Member)
|
||||
if($update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::MEMBER)
|
||||
{
|
||||
$do_handle = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EventType::ChatMemberPromoted:
|
||||
case EventType::CHAT_MEMBER_PROMOTED:
|
||||
if(($update->getMyChatMember() ?? null) !== null && ($update->getMyChatMember()->getNewChatMember() ?? null) !== null)
|
||||
{
|
||||
if($update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::Administrator)
|
||||
if($update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::ADMINISTRATOR)
|
||||
{
|
||||
$do_handle = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EventType::ChatMemberRestricted:
|
||||
case EventType::CHAT_MEMBER_RESTRICTED:
|
||||
if(($update->getMyChatMember() ?? null) !== null && ($update->getMyChatMember()->getNewChatMember() ?? null) !== null)
|
||||
{
|
||||
if($update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::Restricted)
|
||||
if($update->getMyChatMember()->getNewChatMember()->getStatus() === ChatMemberStatus::RESTRICTED)
|
||||
{
|
||||
$do_handle = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EventType::ChatTitleChanged:
|
||||
case EventType::CHAT_TITLE_CHANGED:
|
||||
if(($update->getMessage() ?? null) !== null && ($update->getMessage()->getNewChatTitle() ?? null) !== null)
|
||||
{
|
||||
$handler->handle($this, $update);
|
||||
}
|
||||
break;
|
||||
|
||||
case EventType::ChatPhotoChanged:
|
||||
case EventType::CHAT_PHOTO_CHANGED:
|
||||
if(($update->getMessage() ?? null) !== null && ($update->getMessage()->getNewChatPhoto() ?? null) !== null)
|
||||
{
|
||||
$do_handle = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case EventType::CallbackQuery:
|
||||
case EventType::CALLBACK_QUERY:
|
||||
if(($update->getCallbackQuery() ?? null) !== null)
|
||||
{
|
||||
$do_handle = true;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
public static function length(string $input, int $min_length, int $max_length): bool
|
||||
{
|
||||
$length = strlen($input);
|
||||
|
||||
return $length >= $min_length && $length <= $max_length;
|
||||
}
|
||||
|
||||
|
|
14
src/TgBotLib/Enums/BotCommandScopeType.php
Normal file
14
src/TgBotLib/Enums/BotCommandScopeType.php
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class BotCommandScopeType
|
||||
{
|
||||
public const DEFAULT = 'default';
|
||||
public const ALL_PRIVATE_CHATS = 'all_private_chats';
|
||||
public const ALL_CHAT_GROUPS = 'all_group_chats';
|
||||
public const ALL_CHAT_ADMINISTRATORS = 'all_chat_administrators';
|
||||
public const CHAT = 'chat';
|
||||
public const CHAT_ADMINISTRATORS = 'chat_administrators';
|
||||
public const CHAT_MEMBER = 'chat_member';
|
||||
}
|
17
src/TgBotLib/Enums/ChatActionType.php
Normal file
17
src/TgBotLib/Enums/ChatActionType.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class ChatActionType
|
||||
{
|
||||
public const TYPING = 'typing';
|
||||
public const UPLOAD_PHOTO = 'upload_photo';
|
||||
public const RECORD_VIDEO = 'record_video';
|
||||
public const UPLOAD_VIDEO = 'upload_video';
|
||||
public const RECORD_AUDIO = 'record_audio';
|
||||
public const UPLOAD_AUDIO = 'upload_audio';
|
||||
public const UPLOAD_DOCUMENT = 'upload_document';
|
||||
public const FIND_LOCATION = 'find_location';
|
||||
public const RECORD_VIDEO_NOTE = 'record_video_note';
|
||||
public const UPLOAD_VIDEO_NOTE = 'upload_video_note';
|
||||
}
|
13
src/TgBotLib/Enums/ChatMemberStatus.php
Normal file
13
src/TgBotLib/Enums/ChatMemberStatus.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class ChatMemberStatus
|
||||
{
|
||||
public const CREATOR = 'creator';
|
||||
public const ADMINISTRATOR = 'administrator';
|
||||
public const MEMBER = 'member';
|
||||
public const RESTRICTED = 'restricted';
|
||||
public const LEFT = 'left';
|
||||
public const KICKED = 'kicked';
|
||||
}
|
11
src/TgBotLib/Enums/ChatType.php
Normal file
11
src/TgBotLib/Enums/ChatType.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class ChatType
|
||||
{
|
||||
public const PRIVATE = 'private';
|
||||
public const GROUP = 'group';
|
||||
public const SUPERGROUP = 'supergroup';
|
||||
public const CHANNEL = 'channel';
|
||||
}
|
43
src/TgBotLib/Enums/EventType.php
Normal file
43
src/TgBotLib/Enums/EventType.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class EventType
|
||||
{
|
||||
public const GENERIC_UPDATE = 'generic_update';
|
||||
public const MESSAGE = 'message';
|
||||
public const EDITED_MESSAGE = 'edited_message';
|
||||
public const GENERIC_COMMAND_MESSAGE = 'generic_command_message';
|
||||
public const CHAT_MEMBER_JOINED = 'chat_member_joined';
|
||||
public const CHAT_MEMBER_LEFT = 'chat_member_left';
|
||||
public const CHAT_MEMBER_KICKED = 'chat_member_kicked';
|
||||
public const CHAT_MEMBER_BANNED = 'chat_member_banned';
|
||||
public const CHAT_MEMBER_UNBANNED = 'chat_member_unbanned';
|
||||
public const CHAT_MEMBER_PROMOTED = 'chat_member_promoted';
|
||||
public const CHAT_MEMBER_DEMOTED = 'chat_member_demoted';
|
||||
public const CHAT_MEMBER_RESTRICTED = 'chat_member_restricted';
|
||||
public const CHAT_MEMBER_UNRESTRICTED = 'chat_member_unrestricted';
|
||||
public const CHAT_TITLE_CHANGED = 'chat_title_changed';
|
||||
public const CHAT_PHOTO_CHANGED = 'chat_photo_changed';
|
||||
public const CALLBACK_QUERY = 'callback_query';
|
||||
|
||||
public const All = [
|
||||
self::GENERIC_UPDATE,
|
||||
self::MESSAGE,
|
||||
self::EDITED_MESSAGE,
|
||||
self::GENERIC_COMMAND_MESSAGE,
|
||||
self::CHAT_MEMBER_JOINED,
|
||||
self::CHAT_MEMBER_LEFT,
|
||||
self::CHAT_MEMBER_KICKED,
|
||||
self::CHAT_MEMBER_BANNED,
|
||||
self::CHAT_MEMBER_UNBANNED,
|
||||
self::CHAT_MEMBER_PROMOTED,
|
||||
self::CHAT_MEMBER_DEMOTED,
|
||||
self::CHAT_MEMBER_RESTRICTED,
|
||||
self::CHAT_MEMBER_UNRESTRICTED,
|
||||
self::CHAT_TITLE_CHANGED,
|
||||
self::CHAT_PHOTO_CHANGED,
|
||||
self::CALLBACK_QUERY,
|
||||
];
|
||||
|
||||
}
|
|
@ -1,81 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Abstracts;
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
abstract class InlineQueryResultType
|
||||
final class InlineQueryResultType
|
||||
{
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultarticle
|
||||
*/
|
||||
const Article = 'article';
|
||||
public const ARTICLE = 'article';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultphoto
|
||||
*/
|
||||
const Photo = 'photo';
|
||||
public const PHOTO = 'photo';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultgif
|
||||
*/
|
||||
const Gif = 'gif';
|
||||
public const GIF = 'gif';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
|
||||
*/
|
||||
const Mpeg4Gif = 'mpeg4_gif';
|
||||
public const MPEG_4_GIF = 'mpeg4_gif';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultvideompeg4
|
||||
*/
|
||||
const Video = 'video';
|
||||
public const VIDEO = 'video';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultaudio
|
||||
*/
|
||||
const Audio = 'audio';
|
||||
public const AUDIO = 'audio';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultvoice
|
||||
*/
|
||||
const Voice = 'voice';
|
||||
public const VOICE = 'voice';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultdocument
|
||||
*/
|
||||
const Document = 'document';
|
||||
public const DOCUMENT = 'document';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultlocation
|
||||
*/
|
||||
const Location = 'location';
|
||||
public const LOCATION = 'location';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultvenue
|
||||
*/
|
||||
const Venue = 'venue';
|
||||
public const VENUE = 'venue';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultcontact
|
||||
*/
|
||||
const Contact = 'contact';
|
||||
public const CONTACT = 'contact';
|
||||
|
||||
/**
|
||||
* @link https://core.telegram.org/bots/api#inlinequeryresultgame
|
||||
*/
|
||||
const Game = 'game';
|
||||
public const GAME = 'game';
|
||||
|
||||
const All = [
|
||||
self::Article,
|
||||
self::Photo,
|
||||
self::Gif,
|
||||
self::Mpeg4Gif,
|
||||
self::Video,
|
||||
self::Audio,
|
||||
self::Voice,
|
||||
self::Document,
|
||||
self::Location,
|
||||
self::Venue,
|
||||
self::Contact,
|
||||
self::Game,
|
||||
public const ALL = [
|
||||
self::ARTICLE,
|
||||
self::PHOTO,
|
||||
self::GIF,
|
||||
self::MPEG_4_GIF,
|
||||
self::VIDEO,
|
||||
self::AUDIO,
|
||||
self::VOICE,
|
||||
self::DOCUMENT,
|
||||
self::LOCATION,
|
||||
self::VENUE,
|
||||
self::CONTACT,
|
||||
self::GAME,
|
||||
];
|
||||
}
|
12
src/TgBotLib/Enums/InputMediaType.php
Normal file
12
src/TgBotLib/Enums/InputMediaType.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class InputMediaType
|
||||
{
|
||||
public const PHOTO = 'photo';
|
||||
public const VIDEO = 'video';
|
||||
public const ANIMATION = 'animation';
|
||||
public const AUDIO = 'audio';
|
||||
public const DOCUMENT = 'document';
|
||||
}
|
10
src/TgBotLib/Enums/MenuButtonType.php
Normal file
10
src/TgBotLib/Enums/MenuButtonType.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class MenuButtonType
|
||||
{
|
||||
public const COMMANDS = 'commands';
|
||||
public const WEB_APP = 'web_app';
|
||||
public const DEFAULT = 'default';
|
||||
}
|
41
src/TgBotLib/Enums/MessageEntityType.php
Normal file
41
src/TgBotLib/Enums/MessageEntityType.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class MessageEntityType
|
||||
{
|
||||
public const MENTION = 'mention';
|
||||
|
||||
public const HASHTAG = 'hashtag';
|
||||
|
||||
public const CASHTAG = 'cashtag';
|
||||
|
||||
public const BOT_COMMAND = 'bot_command';
|
||||
|
||||
public const URL = 'url';
|
||||
|
||||
public const EMAIL = 'email';
|
||||
|
||||
public const PHONE_NUMBER = 'phone_number';
|
||||
|
||||
public const BOLD = 'bold';
|
||||
|
||||
public const ITALIC = 'italic';
|
||||
|
||||
public const UNDERLINE = 'underline';
|
||||
|
||||
public const STRIKETHROUGH = 'strikethrough';
|
||||
|
||||
public const SPOILER = 'spoiler';
|
||||
|
||||
public const CODE = 'code';
|
||||
|
||||
public const PRE = 'pre';
|
||||
|
||||
public const TEXT_LINK = 'text_link';
|
||||
|
||||
public const TEXT_MENTION = 'text_mention';
|
||||
|
||||
public const CUSTOM_EMOJI = 'custom_emoji';
|
||||
|
||||
}
|
20
src/TgBotLib/Enums/PassportElementType.php
Normal file
20
src/TgBotLib/Enums/PassportElementType.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class PassportElementType
|
||||
{
|
||||
public const PERSONAL_DETAILS = 'personal_details';
|
||||
public const PASSPORT = 'passport';
|
||||
public const DRIVER_LICENSE = 'driver_license';
|
||||
public const IDENTITY_CARD = 'identity_card';
|
||||
public const INTERNAL_PASSPORT = 'internal_passport';
|
||||
public const ADDRESS = 'address';
|
||||
public const UTILITY_BILL = 'utility_bill';
|
||||
public const BANK_STATEMENT = 'bank_statement';
|
||||
public const RENTAL_AGREEMENT = 'rental_agreement';
|
||||
public const PASSPORT_REGISTRATION = 'passport_registration';
|
||||
public const TEMPORARY_REGISTRATION = 'temporary_registration';
|
||||
public const PHONE_NUMBER = 'phone_number';
|
||||
public const EMAIL = 'email';
|
||||
}
|
10
src/TgBotLib/Enums/PollType.php
Normal file
10
src/TgBotLib/Enums/PollType.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class PollType
|
||||
{
|
||||
public const REGULAR = 'regular';
|
||||
|
||||
public const QUIZ = 'quiz';
|
||||
}
|
10
src/TgBotLib/Enums/StickerFormat.php
Normal file
10
src/TgBotLib/Enums/StickerFormat.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class StickerFormat
|
||||
{
|
||||
public const STATIC = 'static';
|
||||
public const ANIMATED = 'animated';
|
||||
public const VIDEO = 'video';
|
||||
}
|
12
src/TgBotLib/Enums/StickerType.php
Normal file
12
src/TgBotLib/Enums/StickerType.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class StickerType
|
||||
{
|
||||
public const REGULAR = 'regular';
|
||||
|
||||
public const MASK = 'mask';
|
||||
|
||||
public const CUSTOM_EMOJI = 'custom_emoji';
|
||||
}
|
10
src/TgBotLib/Enums/ThumbnailMimeType.php
Normal file
10
src/TgBotLib/Enums/ThumbnailMimeType.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class ThumbnailMimeType
|
||||
{
|
||||
public const IMAGE_JPEG = 'image/jpeg';
|
||||
public const IMAGE_GIF = 'image/gif';
|
||||
public const VIDEO_MP4 = 'video/mp4';
|
||||
}
|
12
src/TgBotLib/Enums/UpdateEventType.php
Normal file
12
src/TgBotLib/Enums/UpdateEventType.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace TgBotLib\Enums;
|
||||
|
||||
final class UpdateEventType
|
||||
{
|
||||
public const GENERIC_UPDATE = 'generic_update';
|
||||
|
||||
public const MESSAGE = 'message';
|
||||
|
||||
public const EDITED_MESSAGE = 'edited_message';
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Enums\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::AllChatAdministrators;
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::ALL_CHAT_ADMINISTRATORS;
|
||||
$object->chat_id = $data['chat_id'] ?? null;
|
||||
|
||||
return $object;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Enums\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::AllGroupChats;
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::ALL_CHAT_GROUPS;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Enums\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::AllPrivateChats;
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::ALL_PRIVATE_CHATS;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Enums\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::Chat;
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::CHAT;
|
||||
$object->chat_id = $data['chat_id'] ?? null;
|
||||
|
||||
return $object;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Enums\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::ChatAdministrators;
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::CHAT_ADMINISTRATORS;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Enums\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::ChatMember;
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::CHAT_MEMBER;
|
||||
$object->chat_id = $data['chat_id'] ?? null;
|
||||
$object->user_id = $data['user_id'] ?? null;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
use TgBotLib\Abstracts\BotCommandScopeType;
|
||||
use TgBotLib\Enums\BotCommandScopeType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\BotCommandScope;
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::Default;
|
||||
$object->type = $data['type'] ?? BotCommandScopeType::DEFAULT;
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram;
|
||||
|
||||
use TgBotLib\Abstracts\ChatType;
|
||||
use TgBotLib\Enums\ChatType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class Chat implements ObjectTypeInterface
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\ChatMember;
|
||||
|
||||
use TgBotLib\Abstracts\ChatMemberStatus;
|
||||
use TgBotLib\Enums\ChatMemberStatus;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\ChatMember;
|
||||
use TgBotLib\Objects\Telegram\User;
|
||||
|
@ -292,7 +292,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::Administrator;
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::ADMINISTRATOR;
|
||||
$object->user = isset($data['user']) ? User::fromArray($data['user']) : null;
|
||||
$object->can_be_edited = $data['can_be_edited'] ?? false;
|
||||
$object->is_anonymous = $data['is_anonymous'] ?? false;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\ChatMember;
|
||||
|
||||
use TgBotLib\Abstracts\ChatMemberStatus;
|
||||
use TgBotLib\Enums\ChatMemberStatus;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\ChatMember;
|
||||
use TgBotLib\Objects\Telegram\User;
|
||||
|
@ -80,7 +80,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::Kicked;
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::KICKED;
|
||||
$object->user = isset($data['user']) ? User::fromArray($data['user']) : null;
|
||||
$object->until_date = $data['until_date'] ?? null;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\ChatMember;
|
||||
|
||||
use TgBotLib\Abstracts\ChatMemberStatus;
|
||||
use TgBotLib\Enums\ChatMemberStatus;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\ChatMember;
|
||||
use TgBotLib\Objects\Telegram\User;
|
||||
|
@ -64,7 +64,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::Left;
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::LEFT;
|
||||
$object->user = isset($data['user']) ? User::fromArray($data['user']) : null;
|
||||
|
||||
return $object;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\ChatMember;
|
||||
|
||||
use TgBotLib\Abstracts\ChatMemberStatus;
|
||||
use TgBotLib\Enums\ChatMemberStatus;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\ChatMember;
|
||||
use TgBotLib\Objects\Telegram\User;
|
||||
|
@ -64,7 +64,7 @@
|
|||
{
|
||||
$object = new self();
|
||||
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::Member;
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::MEMBER;
|
||||
$object->user = isset($data['user']) ? User::fromArray($data['user']) : null;
|
||||
|
||||
return $object;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\ChatMember;
|
||||
|
||||
use TgBotLib\Abstracts\ChatMemberStatus;
|
||||
use TgBotLib\Enums\ChatMemberStatus;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\ChatMember;
|
||||
use TgBotLib\Objects\Telegram\User;
|
||||
|
@ -96,7 +96,7 @@
|
|||
{
|
||||
$object = new ChatMemberOwner();
|
||||
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::Creator;
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::CREATOR;
|
||||
$object->user = isset($data['user']) ? User::fromArray($data['user']) : null;
|
||||
$object->is_anonymous = $data['is_anonymous'] ?? false;
|
||||
$object->custom_title = $data['custom_title'] ?? null;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\ChatMember;
|
||||
|
||||
use TgBotLib\Abstracts\ChatMemberStatus;
|
||||
use TgBotLib\Enums\ChatMemberStatus;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\ChatMember;
|
||||
use TgBotLib\Objects\Telegram\User;
|
||||
|
@ -321,7 +321,7 @@
|
|||
{
|
||||
$object = new static();
|
||||
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::Restricted;
|
||||
$object->status = $data['status'] ?? ChatMemberStatus::RESTRICTED;
|
||||
$object->user = isset($data['user']) ? User::fromArray($data['user']) : null;
|
||||
$object->is_member = $data['is_member'] ?? false;
|
||||
$object->can_send_messages = $data['can_send_messages'] ?? false;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
namespace TgBotLib\Objects\Telegram;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Abstracts\InlineQueryResultType;
|
||||
use TgBotLib\Enums\InlineQueryResultType;
|
||||
use TgBotLib\Exceptions\NotImplementedException;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultArticle;
|
||||
|
@ -49,32 +49,32 @@
|
|||
|
||||
switch(strtolower($data['type']))
|
||||
{
|
||||
case InlineQueryResultType::Article:
|
||||
case InlineQueryResultType::ARTICLE:
|
||||
return InlineQueryResultArticle::fromArray($data);
|
||||
case InlineQueryResultType::Photo:
|
||||
case InlineQueryResultType::PHOTO:
|
||||
return InlineQueryResultPhoto::fromArray($data);
|
||||
case InlineQueryResultType::Gif:
|
||||
case InlineQueryResultType::GIF:
|
||||
return InlineQueryResultGif::fromArray($data);
|
||||
case InlineQueryResultType::Mpeg4Gif:
|
||||
case InlineQueryResultType::MPEG_4_GIF:
|
||||
return InlineQueryResultMpeg4Gif::fromArray($data);
|
||||
case InlineQueryResultType::Video:
|
||||
case InlineQueryResultType::VIDEO:
|
||||
return InlineQueryResultVideo::fromArray($data);
|
||||
case InlineQueryResultType::Audio:
|
||||
case InlineQueryResultType::AUDIO:
|
||||
return InlineQueryResultAudio::fromArray($data);
|
||||
case InlineQueryResultType::Voice:
|
||||
case InlineQueryResultType::VOICE:
|
||||
return InlineQueryResultVoice::fromArray($data);
|
||||
case InlineQueryResultType::Document:
|
||||
case InlineQueryResultType::DOCUMENT:
|
||||
return InlineQueryResultDocument::fromArray($data);
|
||||
case InlineQueryResultType::Location:
|
||||
case InlineQueryResultType::LOCATION:
|
||||
return InlineQueryResultLocation::fromArray($data);
|
||||
case InlineQueryResultType::Venue:
|
||||
case InlineQueryResultType::VENUE:
|
||||
return InlineQueryResultVenue::fromArray($data);
|
||||
case InlineQueryResultType::Contact:
|
||||
case InlineQueryResultType::CONTACT:
|
||||
return InlineQueryResultContact::fromArray($data);
|
||||
case InlineQueryResultType::Game:
|
||||
case InlineQueryResultType::GAME:
|
||||
return InlineQueryResultGame::fromArray($data);
|
||||
default:
|
||||
throw new InvalidArgumentException(sprintf('The type of the InlineQueryResult is invalid, got "%s", expected one of "%s"', $data['type'], implode('", "', InlineQueryResultType::All)));
|
||||
throw new InvalidArgumentException(sprintf('The type of the InlineQueryResult is invalid, got "%s", expected one of "%s"', $data['type'], implode('", "', InlineQueryResultType::ALL)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,12 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Telegram\InlineQueryResult;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Classes\Validate;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\InlineKeyboardMarkup;
|
||||
use TgBotLib\Objects\Telegram\InputMessageContent;
|
||||
|
@ -97,6 +100,22 @@
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'id' field.
|
||||
* Unique identifier for this result, 1-64 Bytes
|
||||
*
|
||||
* @param string $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId(string $id): InlineQueryResultArticle
|
||||
{
|
||||
if(!Validate::length($id, 1, 64))
|
||||
throw new InvalidArgumentException('id should be between 1-64 characters');
|
||||
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Title of the result
|
||||
*
|
||||
|
@ -107,6 +126,19 @@
|
|||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'title' field.
|
||||
* Title of the result
|
||||
*
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle(string $title): InlineQueryResultArticle
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content of the message to be sent
|
||||
*
|
||||
|
@ -117,6 +149,19 @@
|
|||
return $this->input_message_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'input_message_content' field.
|
||||
* Content of the message to be sent
|
||||
*
|
||||
* @param InputContactMessageContent|InputLocationMessageContent|InputTextMessageContent|InputVenueMessageContent|null $input_message_content
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputMessageContent(InputVenueMessageContent|InputTextMessageContent|InputContactMessageContent|InputLocationMessageContent|null $input_message_content): InlineQueryResultArticle
|
||||
{
|
||||
$this->input_message_content = $input_message_content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
|
@ -127,6 +172,19 @@
|
|||
return $this->reply_markup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'reply_markup' field.
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
* @param InlineKeyboardMarkup|null $reply_markup
|
||||
* @return $this
|
||||
*/
|
||||
public function setReplyMarkup(?InlineKeyboardMarkup $reply_markup): InlineQueryResultArticle
|
||||
{
|
||||
$this->reply_markup = $reply_markup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. URL of the result
|
||||
*
|
||||
|
@ -137,6 +195,22 @@
|
|||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'url' field.
|
||||
* Optional. URL of the result
|
||||
*
|
||||
* @param string|null $url
|
||||
* @return $this
|
||||
*/
|
||||
public function setUrl(?string $url): InlineQueryResultArticle
|
||||
{
|
||||
if(!Validate::url($url))
|
||||
throw new InvalidArgumentException(sprintf('url is not a valid url: %s', $url));
|
||||
|
||||
$this->url = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Pass True if you don't want the URL to be shown in the message
|
||||
*
|
||||
|
@ -147,6 +221,19 @@
|
|||
return $this->hide_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'hide_url' field.
|
||||
* Optional. Pass True if you don't want the URL to be shown in the message
|
||||
*
|
||||
* @param bool $hide_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setHideUrl(bool $hide_url): InlineQueryResultArticle
|
||||
{
|
||||
$this->hide_url = $hide_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Short description of the result
|
||||
*
|
||||
|
@ -157,6 +244,19 @@
|
|||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'description' field.
|
||||
* Optional. Short description of the result
|
||||
*
|
||||
* @param string|null $description
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription(?string $description): InlineQueryResultArticle
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Url of the thumbnail for the result
|
||||
*
|
||||
|
@ -167,6 +267,22 @@
|
|||
return $this->thumbnail_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'thumbnail_url' field.
|
||||
* Optional. Url of the thumbnail for the result
|
||||
*
|
||||
* @param string|null $thumbnail_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailUrl(?string $thumbnail_url): InlineQueryResultArticle
|
||||
{
|
||||
if(!Validate::url($thumbnail_url))
|
||||
throw new InvalidArgumentException(sprintf('thumbnail_url is not a valid url: %s', $thumbnail_url));
|
||||
|
||||
$this->thumbnail_url = $thumbnail_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Thumbnail width
|
||||
*
|
||||
|
@ -177,6 +293,19 @@
|
|||
return $this->thumbnail_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'thumbnail_width' field.
|
||||
* Optional. Thumbnail width
|
||||
*
|
||||
* @param int|null $thumbnail_width
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailWidth(?int $thumbnail_width): InlineQueryResultArticle
|
||||
{
|
||||
$this->thumbnail_width = $thumbnail_width;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Thumbnail height
|
||||
*
|
||||
|
@ -187,6 +316,19 @@
|
|||
return $this->thumbnail_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'thumbnail_height' field.
|
||||
* Optional. Thumbnail height
|
||||
*
|
||||
* @param int|null $thumbnail_height
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailHeight(?int $thumbnail_height): InlineQueryResultArticle
|
||||
{
|
||||
$this->thumbnail_height = $thumbnail_height;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Telegram\InlineQueryResult;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Classes\Validate;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\InlineKeyboardMarkup;
|
||||
use TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent;
|
||||
|
@ -98,6 +101,24 @@
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'id' property
|
||||
* Unique identifier for this result, 1-64 bytes
|
||||
*
|
||||
* @param string $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId(string $id): InlineQueryResultAudio
|
||||
{
|
||||
if(!Validate::length($id, 1, 64))
|
||||
{
|
||||
throw new InvalidArgumentException(sprintf('id must be between 1 and 64 characters long, got %s characters', $id));
|
||||
}
|
||||
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A valid URL for the audio file
|
||||
*
|
||||
|
@ -108,6 +129,22 @@
|
|||
return $this->audio_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'audio_url' property
|
||||
* A valid URL for the audio file
|
||||
*
|
||||
* @param string $audio_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setAudioUrl(string $audio_url): InlineQueryResultAudio
|
||||
{
|
||||
if(!Validate::url($audio_url))
|
||||
throw new InvalidArgumentException(sprintf('audio_url is not a valid URL: %s', $audio_url));
|
||||
|
||||
$this->audio_url = $audio_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Title
|
||||
*
|
||||
|
@ -118,6 +155,19 @@
|
|||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'title' property
|
||||
* Title
|
||||
*
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle(string $title): InlineQueryResultAudio
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Caption, 0-1024 characters after entities parsing
|
||||
*
|
||||
|
@ -128,6 +178,28 @@
|
|||
return $this->caption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'caption' property
|
||||
* Optional. Caption, 0-1024 characters after entities parsing
|
||||
*
|
||||
* @param string|null $caption
|
||||
* @return $this
|
||||
*/
|
||||
public function setCaption(?string $caption): InlineQueryResultAudio
|
||||
{
|
||||
if($caption == null)
|
||||
{
|
||||
$this->caption = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
if(!Validate::length($caption, 0, 1024))
|
||||
throw new InvalidArgumentException(sprintf('caption must be between 0 and 1024 characters long, got %s characters', $caption));
|
||||
|
||||
$this->caption = $caption;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
|
||||
*
|
||||
|
@ -138,6 +210,28 @@
|
|||
return $this->parse_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'parse_mode' property
|
||||
* Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
|
||||
*
|
||||
* @param string|null $parse_mode
|
||||
* @return $this
|
||||
*/
|
||||
public function setParseMode(?string $parse_mode): InlineQueryResultAudio
|
||||
{
|
||||
if($parse_mode == null)
|
||||
{
|
||||
$this->parse_mode = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
if(!in_array(strtolower($parse_mode), ['markdown', 'html']))
|
||||
throw new InvalidArgumentException(sprintf('parse_mode must be one of Markdown, HTML, got %s', $parse_mode));
|
||||
|
||||
$this->parse_mode = $parse_mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
*
|
||||
|
@ -148,6 +242,34 @@
|
|||
return $this->caption_entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'caption_entities' property
|
||||
* Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
*
|
||||
* @param MessageEntity[]|null $caption_entities
|
||||
* @return $this
|
||||
*/
|
||||
public function setCaptionEntities(?array $caption_entities): InlineQueryResultAudio
|
||||
{
|
||||
if($caption_entities == null)
|
||||
{
|
||||
$this->caption_entities = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->caption_entities = [];
|
||||
|
||||
foreach($caption_entities as $entity)
|
||||
{
|
||||
if(!$entity instanceof MessageEntity)
|
||||
throw new InvalidArgumentException(sprintf('caption_entities must be array of MessageEntity, got %s', gettype($entity)));
|
||||
|
||||
$this->caption_entities[] = $entity;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Performer
|
||||
*
|
||||
|
@ -158,6 +280,25 @@
|
|||
return $this->performer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'performer' property
|
||||
* Optional. Performer
|
||||
*
|
||||
* @param string|null $performer
|
||||
* @return $this
|
||||
*/
|
||||
public function setPerformer(?string $performer): InlineQueryResultAudio
|
||||
{
|
||||
if($performer == null)
|
||||
{
|
||||
$this->performer = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->performer = $performer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Audio duration in seconds
|
||||
*
|
||||
|
@ -168,6 +309,25 @@
|
|||
return $this->audio_duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'audio_duration' property
|
||||
* Optional. Audio duration in seconds
|
||||
*
|
||||
* @param int|null $audio_duration
|
||||
* @return $this
|
||||
*/
|
||||
public function setAudioDuration(?int $audio_duration): InlineQueryResultAudio
|
||||
{
|
||||
if($audio_duration == null)
|
||||
{
|
||||
$this->audio_duration = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->audio_duration = $audio_duration;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
|
@ -178,6 +338,19 @@
|
|||
return $this->reply_markup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'reply_markup' property
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
* @param InlineKeyboardMarkup|null $reply_markup
|
||||
* @return $this
|
||||
*/
|
||||
public function setReplyMarkup(?InlineKeyboardMarkup $reply_markup): InlineQueryResultAudio
|
||||
{
|
||||
$this->reply_markup = $reply_markup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Content of the message to be sent instead of the audio
|
||||
*
|
||||
|
@ -188,6 +361,19 @@
|
|||
return $this->input_message_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'input_message_content' property
|
||||
* Optional. Content of the message to be sent instead of the audio
|
||||
*
|
||||
* @param InputContactMessageContent|InputInvoiceMessageContent|InputLocationMessageContent|InputTextMessageContent|InputVenueMessageContent|null $input_message_content
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputMessageContent(InputVenueMessageContent|InputTextMessageContent|InputContactMessageContent|InputLocationMessageContent|InputInvoiceMessageContent|null $input_message_content): InlineQueryResultAudio
|
||||
{
|
||||
$this->input_message_content = $input_message_content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Telegram\InlineQueryResult;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Classes\Validate;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\InlineKeyboardMarkup;
|
||||
use TgBotLib\Objects\Telegram\InputMessageContent;
|
||||
|
@ -98,6 +101,22 @@
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'id' property
|
||||
* Unique identifier for this result, 1-64 Bytes
|
||||
*
|
||||
* @param string $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId(string $id): self
|
||||
{
|
||||
if(!Validate::length($id, 1, 64))
|
||||
throw new InvalidArgumentException('id should be between 1-64 characters');
|
||||
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contact's phone number
|
||||
*
|
||||
|
@ -108,6 +127,19 @@
|
|||
return $this->phone_number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'phone_number' property
|
||||
* Contact's phone number
|
||||
*
|
||||
* @param string $phone_number
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhoneNumber(string $phone_number): self
|
||||
{
|
||||
$this->phone_number = $phone_number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contact's first name
|
||||
*
|
||||
|
@ -118,6 +150,19 @@
|
|||
return $this->first_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'first_name' property
|
||||
* Contact's first name
|
||||
*
|
||||
* @param string $first_name
|
||||
* @return $this
|
||||
*/
|
||||
public function setFirstName(string $first_name): self
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Contact's last name
|
||||
*
|
||||
|
@ -128,6 +173,19 @@
|
|||
return $this->last_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'last_name' property
|
||||
* Optional. Contact's last name
|
||||
*
|
||||
* @param string|null $last_name
|
||||
* @return $this
|
||||
*/
|
||||
public function setLastName(?string $last_name): self
|
||||
{
|
||||
$this->last_name = $last_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
|
||||
*
|
||||
|
@ -138,6 +196,22 @@
|
|||
return $this->vcard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'vcard' property
|
||||
* Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
|
||||
*
|
||||
* @param string|null $vcard
|
||||
* @return $this
|
||||
*/
|
||||
public function setVcard(?string $vcard): self
|
||||
{
|
||||
if(!Validate::length($vcard, 0, 2048))
|
||||
throw new InvalidArgumentException('vcard should be between 0-2048 characters');
|
||||
|
||||
$this->vcard = $vcard;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
|
@ -148,6 +222,19 @@
|
|||
return $this->reply_markup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'reply_markup' property
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
* @param InlineKeyboardMarkup|null $reply_markup
|
||||
* @return $this
|
||||
*/
|
||||
public function setReplyMarkup(?InlineKeyboardMarkup $reply_markup): self
|
||||
{
|
||||
$this->reply_markup = $reply_markup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Content of the message to be sent instead of the contact
|
||||
*
|
||||
|
@ -158,6 +245,19 @@
|
|||
return $this->input_message_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'input_message_content' property
|
||||
* Optional. Content of the message to be sent instead of the contact
|
||||
*
|
||||
* @param InputContactMessageContent|InputInvoiceMessageContent|InputLocationMessageContent|InputTextMessageContent|InputVenueMessageContent|null $input_message_content
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputMessageContent(InputVenueMessageContent|InputTextMessageContent|InputContactMessageContent|InputLocationMessageContent|InputInvoiceMessageContent|null $input_message_content): self
|
||||
{
|
||||
$this->input_message_content = $input_message_content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Url of the thumbnail for the result
|
||||
*
|
||||
|
@ -168,6 +268,19 @@
|
|||
return $this->thumbnail_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'thumbnail_url' property
|
||||
* Optional. Url of the thumbnail for the result
|
||||
*
|
||||
* @param string|null $thumbnail_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailUrl(?string $thumbnail_url): self
|
||||
{
|
||||
$this->thumbnail_url = $thumbnail_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Thumbnail width
|
||||
*
|
||||
|
@ -178,6 +291,19 @@
|
|||
return $this->thumbnail_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'thumbnail_width' property
|
||||
* Optional. Thumbnail width
|
||||
*
|
||||
* @param int|null $thumbnail_width
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailWidth(?int $thumbnail_width): self
|
||||
{
|
||||
$this->thumbnail_width = $thumbnail_width;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Thumbnail height
|
||||
*
|
||||
|
@ -188,6 +314,19 @@
|
|||
return $this->thumbnail_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'thumbnail_height' property
|
||||
* Optional. Thumbnail height
|
||||
*
|
||||
* @param int|null $thumbnail_height
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailHeight(?int $thumbnail_height): self
|
||||
{
|
||||
$this->thumbnail_height = $thumbnail_height;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Telegram\InlineQueryResult;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Classes\Validate;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\InlineKeyboardMarkup;
|
||||
use TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent;
|
||||
|
@ -123,6 +126,19 @@
|
|||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'title' field.
|
||||
* Title for the result
|
||||
*
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle(string $title): InlineQueryResultDocument
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
|
||||
*
|
||||
|
@ -133,6 +149,30 @@
|
|||
return $this->caption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'caption' field.
|
||||
* Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
|
||||
*
|
||||
* @param string|null $caption
|
||||
* @return $this
|
||||
*/
|
||||
public function setCaption(?string $caption): InlineQueryResultDocument
|
||||
{
|
||||
if($caption == null)
|
||||
{
|
||||
$this->caption = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
if(!Validate::length($caption, 0, 1024))
|
||||
{
|
||||
throw new InvalidArgumentException("Caption must be between 0 and 1024 characters");
|
||||
}
|
||||
|
||||
$this->caption = $caption;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Mode for parsing entities in the document caption. See formatting options for more details.
|
||||
*
|
||||
|
@ -143,6 +183,30 @@
|
|||
return $this->parse_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'parse_mode' field.
|
||||
* Optional. Mode for parsing entities in the document caption. See formatting options for more details.
|
||||
*
|
||||
* @param string|null $parse_mode
|
||||
* @return $this
|
||||
*/
|
||||
public function setParseMode(?string $parse_mode): InlineQueryResultDocument
|
||||
{
|
||||
if($parse_mode == null)
|
||||
{
|
||||
$this->parse_mode = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
if(!in_array(strtolower($parse_mode), ['markdown', 'html']))
|
||||
{
|
||||
throw new InvalidArgumentException("Parse mode must be either Markdown or HTML");
|
||||
}
|
||||
|
||||
$this->parse_mode = $parse_mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
*
|
||||
|
@ -153,6 +217,33 @@
|
|||
return $this->caption_entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'caption_entities' field.
|
||||
* Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
*
|
||||
* @param MessageEntity[]|null $caption_entities
|
||||
* @return $this
|
||||
*/
|
||||
public function setCaptionEntities(?array $caption_entities): InlineQueryResultDocument
|
||||
{
|
||||
if($caption_entities == null)
|
||||
{
|
||||
$this->caption_entities = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
foreach($caption_entities as $entity)
|
||||
{
|
||||
if(!($entity instanceof MessageEntity))
|
||||
{
|
||||
throw new InvalidArgumentException("Caption entities must be an array of MessageEntity");
|
||||
}
|
||||
}
|
||||
|
||||
$this->caption_entities = $caption_entities;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A valid URL for the file
|
||||
*
|
||||
|
@ -163,6 +254,24 @@
|
|||
return $this->document_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'document_url' field.
|
||||
* A valid URL for the file
|
||||
*
|
||||
* @param string $document_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setDocumentUrl(string $document_url): InlineQueryResultDocument
|
||||
{
|
||||
if(!Validate::url($document_url))
|
||||
{
|
||||
throw new InvalidArgumentException("Document URL must be a valid URL");
|
||||
}
|
||||
|
||||
$this->document_url = $document_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* MIME type of the content of the file, either “application/pdf” or “application/zip”
|
||||
*
|
||||
|
@ -173,6 +282,19 @@
|
|||
return $this->mime_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'mime_type' field.
|
||||
* MIME type of the content of the file, either “application/pdf” or “application/zip”
|
||||
*
|
||||
* @param string $mime_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setMimeType(string $mime_type): InlineQueryResultDocument
|
||||
{
|
||||
$this->mime_type = $mime_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Short description of the result
|
||||
*
|
||||
|
@ -183,6 +305,19 @@
|
|||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'description' field.
|
||||
* Optional. Short description of the result
|
||||
*
|
||||
* @param string|null $description
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription(?string $description): InlineQueryResultDocument
|
||||
{
|
||||
$this->description = $description;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
|
@ -193,6 +328,19 @@
|
|||
return $this->reply_markup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'reply_markup' field.
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
* @param InlineKeyboardMarkup|null $reply_markup
|
||||
* @return $this
|
||||
*/
|
||||
public function setReplyMarkup(?InlineKeyboardMarkup $reply_markup): InlineQueryResultDocument
|
||||
{
|
||||
$this->reply_markup = $reply_markup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Content of the message to be sent instead of the file
|
||||
*
|
||||
|
@ -203,6 +351,19 @@
|
|||
return $this->input_message_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'input_message_content' field.
|
||||
* Optional. Content of the message to be sent instead of the file
|
||||
*
|
||||
* @param InputContactMessageContent|InputInvoiceMessageContent|InputLocationMessageContent|InputTextMessageContent|InputVenueMessageContent|null $input_message_content
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputMessageContent(InputVenueMessageContent|InputTextMessageContent|InputContactMessageContent|InputLocationMessageContent|InputInvoiceMessageContent|null $input_message_content): InlineQueryResultDocument
|
||||
{
|
||||
$this->input_message_content = $input_message_content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. URL of the thumbnail (JPEG only) for the file
|
||||
*
|
||||
|
@ -213,6 +374,24 @@
|
|||
return $this->thumbnail_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'thumbnail_url' field.
|
||||
* Optional. URL of the thumbnail (JPEG only) for the file
|
||||
*
|
||||
* @param string|null $thumbnail_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailUrl(?string $thumbnail_url): InlineQueryResultDocument
|
||||
{
|
||||
if($thumbnail_url != null && !Validate::url($thumbnail_url))
|
||||
{
|
||||
throw new InvalidArgumentException("Thumbnail URL must be a valid URL");
|
||||
}
|
||||
|
||||
$this->thumbnail_url = $thumbnail_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Thumbnail width
|
||||
*
|
||||
|
@ -223,6 +402,19 @@
|
|||
return $this->thumbnail_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'thumbnail_width' field.
|
||||
* Optional. Thumbnail width
|
||||
*
|
||||
* @param int|null $thumbnail_width
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailWidth(?int $thumbnail_width): InlineQueryResultDocument
|
||||
{
|
||||
$this->thumbnail_width = $thumbnail_width;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Thumbnail height
|
||||
*
|
||||
|
@ -233,6 +425,19 @@
|
|||
return $this->thumbnail_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'thumbnail_height' field.
|
||||
* Optional. Thumbnail height
|
||||
*
|
||||
* @param int|null $thumbnail_height
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailHeight(?int $thumbnail_height): InlineQueryResultDocument
|
||||
{
|
||||
$this->thumbnail_height = $thumbnail_height;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Telegram\InlineQueryResult;
|
||||
|
@ -49,6 +50,19 @@
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'id' field
|
||||
* Unique identifier for this result, 1-64 bytes
|
||||
*
|
||||
* @param string $id
|
||||
* @return InlineQueryResultGame
|
||||
*/
|
||||
public function setId(string $id): InlineQueryResultGame
|
||||
{
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Short name of the game
|
||||
*
|
||||
|
@ -59,6 +73,19 @@
|
|||
return $this->game_short_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'game_short_name' field
|
||||
* Short name of the game
|
||||
*
|
||||
* @param string $game_short_name
|
||||
* @return InlineQueryResultGame
|
||||
*/
|
||||
public function setGameShortName(string $game_short_name): InlineQueryResultGame
|
||||
{
|
||||
$this->game_short_name = $game_short_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
|
@ -69,6 +96,18 @@
|
|||
return $this->reply_markup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
* @param InlineKeyboardMarkup|null $reply_markup
|
||||
* @return InlineQueryResultGame
|
||||
*/
|
||||
public function setReplyMarkup(?InlineKeyboardMarkup $reply_markup): InlineQueryResultGame
|
||||
{
|
||||
$this->reply_markup = $reply_markup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\InlineQueryResult;
|
||||
|
||||
use TgBotLib\Abstracts\ThumbnailMimeType;
|
||||
use InvalidArgumentException;
|
||||
use TgBotLib\Enums\ThumbnailMimeType;
|
||||
use TgBotLib\Classes\Validate;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\InlineKeyboardMarkup;
|
||||
use TgBotLib\Objects\Telegram\InputMessageContent\InputContactMessageContent;
|
||||
|
@ -116,6 +118,24 @@
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'id' field.
|
||||
* Unique identifier for this result, 1-64 bytes
|
||||
*
|
||||
* @param string $id
|
||||
* @return $this
|
||||
*/
|
||||
public function setId(string $id): InlineQueryResultGif
|
||||
{
|
||||
if(!Validate::length($id, 1, 64))
|
||||
{
|
||||
throw new InvalidArgumentException();
|
||||
}
|
||||
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A valid URL for the GIF file. File size must not exceed 1MB
|
||||
*
|
||||
|
@ -126,6 +146,24 @@
|
|||
return $this->gif_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'gif_url' field.
|
||||
* A valid URL for the GIF file. File size must not exceed 1MB
|
||||
*
|
||||
* @param string $gif_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setGifUrl(string $gif_url): InlineQueryResultGif
|
||||
{
|
||||
if(!Validate::url($gif_url))
|
||||
{
|
||||
throw new InvalidArgumentException(sprintf('"%s" is not a valid url', $gif_url));
|
||||
}
|
||||
|
||||
$this->gif_url = $gif_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Width of the GIF
|
||||
*
|
||||
|
@ -136,6 +174,19 @@
|
|||
return $this->gif_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'gif_width' field.
|
||||
* Optional. Width of the GIF
|
||||
*
|
||||
* @param int $gif_width
|
||||
* @return $this
|
||||
*/
|
||||
public function setGifWidth(int $gif_width): InlineQueryResultGif
|
||||
{
|
||||
$this->gif_width = $gif_width;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Height of the GIF
|
||||
*
|
||||
|
@ -146,6 +197,25 @@
|
|||
return $this->gif_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'gif_height' field.
|
||||
* Optional. Height of the GIF
|
||||
*
|
||||
* @param int|null $gif_height
|
||||
* @return $this
|
||||
*/
|
||||
public function setGifHeight(?int $gif_height): InlineQueryResultGif
|
||||
{
|
||||
if(is_null($gif_height))
|
||||
{
|
||||
$this->gif_height = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->gif_height = $gif_height;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Duration of the GIF in seconds
|
||||
*
|
||||
|
@ -156,6 +226,25 @@
|
|||
return $this->gif_duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'gif_duration' field.
|
||||
* Optional. Duration of the GIF in seconds
|
||||
*
|
||||
* @param int|null $gif_duration
|
||||
* @return $this
|
||||
*/
|
||||
public function setGifDuration(?int $gif_duration): InlineQueryResultGif
|
||||
{
|
||||
if(is_null($gif_duration))
|
||||
{
|
||||
$this->gif_duration = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->gif_duration = $gif_duration;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
|
||||
*
|
||||
|
@ -166,6 +255,24 @@
|
|||
return $this->thumbnail_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'thumbnail_url' field.
|
||||
* URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
|
||||
*
|
||||
* @param string $thumbnail_url
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailUrl(string $thumbnail_url): InlineQueryResultGif
|
||||
{
|
||||
if(!Validate::url($thumbnail_url))
|
||||
{
|
||||
throw new InvalidArgumentException(sprintf('"%s" is not a valid url', $thumbnail_url));
|
||||
}
|
||||
|
||||
$this->thumbnail_url = $thumbnail_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
|
||||
*
|
||||
|
@ -176,6 +283,25 @@
|
|||
return $this->thumbnail_mime_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'thumbnail_mime_type' field.
|
||||
* Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
|
||||
*
|
||||
* @param string|null $thumbnail_mime_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setThumbnailMimeType(?string $thumbnail_mime_type): InlineQueryResultGif
|
||||
{
|
||||
if(is_null($thumbnail_mime_type))
|
||||
{
|
||||
$this->thumbnail_mime_type = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->thumbnail_mime_type = $thumbnail_mime_type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Title for the result
|
||||
*
|
||||
|
@ -186,6 +312,19 @@
|
|||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'title' field.
|
||||
* Optional. Title for the result
|
||||
*
|
||||
* @param string|null $title
|
||||
* @return $this
|
||||
*/
|
||||
public function setTitle(?string $title): InlineQueryResultGif
|
||||
{
|
||||
$this->title = $title;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing
|
||||
*
|
||||
|
@ -196,6 +335,19 @@
|
|||
return $this->caption;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'caption' field.
|
||||
* Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing
|
||||
*
|
||||
* @param string|null $caption
|
||||
* @return $this
|
||||
*/
|
||||
public function setCaption(?string $caption): InlineQueryResultGif
|
||||
{
|
||||
$this->caption = $caption;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Mode for parsing entities in the caption. See formatting options for more details.
|
||||
*
|
||||
|
@ -206,6 +358,19 @@
|
|||
return $this->parse_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'parse_mode' field.
|
||||
* Optional. Mode for parsing entities in the caption. See formatting options for more details.
|
||||
*
|
||||
* @param string|null $parse_mode
|
||||
* @return $this
|
||||
*/
|
||||
public function setParseMode(?string $parse_mode): InlineQueryResultGif
|
||||
{
|
||||
$this->parse_mode = $parse_mode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
*
|
||||
|
@ -216,6 +381,34 @@
|
|||
return $this->caption_entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'caption_entities' field.
|
||||
* Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
|
||||
*
|
||||
* @param MessageEntity[]|null $caption_entities
|
||||
* @return $this
|
||||
*/
|
||||
public function setCaptionEntities(?array $caption_entities): InlineQueryResultGif
|
||||
{
|
||||
if($caption_entities == null)
|
||||
{
|
||||
$this->caption_entities = null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->caption_entities = [];
|
||||
|
||||
foreach($caption_entities as $entity)
|
||||
{
|
||||
if(!$entity instanceof MessageEntity)
|
||||
throw new InvalidArgumentException(sprintf('caption_entities must be array of MessageEntity, got %s', gettype($entity)));
|
||||
|
||||
$this->caption_entities[] = $entity;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
|
@ -226,6 +419,19 @@
|
|||
return $this->reply_markup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'reply_markup' field.
|
||||
* Optional. Inline keyboard attached to the message
|
||||
*
|
||||
* @param InlineKeyboardMarkup|null $reply_markup
|
||||
* @return $this
|
||||
*/
|
||||
public function setReplyMarkup(?InlineKeyboardMarkup $reply_markup): InlineQueryResultGif
|
||||
{
|
||||
$this->reply_markup = $reply_markup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. Content of the message to be sent instead of the GIF animation
|
||||
*
|
||||
|
@ -236,6 +442,19 @@
|
|||
return $this->input_message_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the 'input_message_content' field.
|
||||
* Optional. Content of the message to be sent instead of the GIF animation
|
||||
*
|
||||
* @param InputVenueMessageContent|InputTextMessageContent|InputContactMessageContent|InputLocationMessageContent|InputInvoiceMessageContent|null $input_message_content
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputMessageContent(InputVenueMessageContent|InputTextMessageContent|InputContactMessageContent|InputLocationMessageContent|InputInvoiceMessageContent|null $input_message_content): InlineQueryResultGif
|
||||
{
|
||||
$this->input_message_content = $input_message_content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram\InputMedia;
|
||||
|
||||
use TgBotLib\Abstracts\InputMediaType;
|
||||
use TgBotLib\Enums\InputMediaType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
use TgBotLib\Objects\Telegram\InputMedia;
|
||||
use TgBotLib\Objects\Telegram\MessageEntity;
|
||||
|
@ -208,7 +208,7 @@
|
|||
public static function fromArray(array $data): self
|
||||
{
|
||||
$object = new static();
|
||||
$object->type = $data['type'] ?? InputMediaType::Animation;
|
||||
$object->type = $data['type'] ?? InputMediaType::ANIMATION;
|
||||
$object->media = $data['media'] ?? null;
|
||||
$object->thumb = $data['thumb'] ?? null;
|
||||
$object->caption = $data['caption'] ?? null;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace TgBotLib\Objects\Telegram;
|
||||
|
||||
use TgBotLib\Abstracts\StickerType;
|
||||
use TgBotLib\Enums\StickerType;
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class StickerSet implements ObjectTypeInterface
|
||||
|
|
Loading…
Add table
Reference in a new issue