* 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
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue