Skip to content

Commit

Permalink
Updates 18.08.20
Browse files Browse the repository at this point in the history
  • Loading branch information
madmages committed Aug 18, 2020
1 parent 2c00a06 commit af79f61
Show file tree
Hide file tree
Showing 33 changed files with 1,165 additions and 364 deletions.
293 changes: 218 additions & 75 deletions src/Client.php

Large diffs are not rendered by default.

113 changes: 113 additions & 0 deletions src/Type/BotCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php declare(strict_types=1);

namespace MadmagesTelegram\Types\Type;

use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\AccessType;
use JMS\Serializer\Annotation\SkipWhenEmpty;
use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\Type;

/**
* https://core.telegram.org/bots/api#botcommand
*
* This object represents a bot command.
*
* @ExclusionPolicy("none")
* @AccessType("public_method")
*/
class BotCommand extends AbstractType
{

/**
* Returns raw names of properties of this type
*
* @return string[]
*/
public static function _getPropertyNames(): array
{
return [
'command',
'description',
];
}

/**
* Returns associative array of raw data
*
* @return array
*/
public function _getRawData(): array
{
$result = [
'command' => $this->getCommand(),
'description' => $this->getDescription(),
];

$result = array_filter($result, static function($item){ return $item!==null; });
return array_map(static function(&$item){
return is_object($item) ? $item->_getRawData():$item;
}, $result);
}

/**
* Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores.
*
* @var string
* @SerializedName("command")
* @Accessor(getter="getCommand",setter="setCommand")
* @Type("string")
*/
protected $command;

/**
* Description of the command, 3-256 characters.
*
* @var string
* @SerializedName("description")
* @Accessor(getter="getDescription",setter="setDescription")
* @Type("string")
*/
protected $description;


/**
* @param string $command
* @return static
*/
public function setCommand(string $command): self
{
$this->command = $command;

return $this;
}

/**
* @return string
*/
public function getCommand(): string
{
return $this->command;
}

/**
* @param string $description
* @return static
*/
public function setDescription(string $description): self
{
$this->description = $description;

return $this;
}

/**
* @return string
*/
public function getDescription(): string
{
return $this->description;
}

}
2 changes: 1 addition & 1 deletion src/Type/ChatMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function _getRawData(): array
protected $canRestrictMembers;

/**
* Optional. Administrators only. True, if the administrator can add new administrators with a subset of his own
* Optional. Administrators only. True, if the administrator can add new administrators with a subset of their own
* privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were
* appointed by the user)
*
Expand Down
113 changes: 113 additions & 0 deletions src/Type/Dice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?php declare(strict_types=1);

namespace MadmagesTelegram\Types\Type;

use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\AccessType;
use JMS\Serializer\Annotation\SkipWhenEmpty;
use JMS\Serializer\Annotation\SerializedName;
use JMS\Serializer\Annotation\Accessor;
use JMS\Serializer\Annotation\Type;

/**
* https://core.telegram.org/bots/api#dice
*
* This object represents an animated emoji that displays a random value.
*
* @ExclusionPolicy("none")
* @AccessType("public_method")
*/
class Dice extends AbstractType
{

/**
* Returns raw names of properties of this type
*
* @return string[]
*/
public static function _getPropertyNames(): array
{
return [
'emoji',
'value',
];
}

/**
* Returns associative array of raw data
*
* @return array
*/
public function _getRawData(): array
{
$result = [
'emoji' => $this->getEmoji(),
'value' => $this->getValue(),
];

$result = array_filter($result, static function($item){ return $item!==null; });
return array_map(static function(&$item){
return is_object($item) ? $item->_getRawData():$item;
}, $result);
}

/**
* Emoji on which the dice throw animation is based
*
* @var string
* @SerializedName("emoji")
* @Accessor(getter="getEmoji",setter="setEmoji")
* @Type("string")
*/
protected $emoji;

/**
* Value of the dice, 1-6 for “” and “” base emoji, 1-5 for “” base emoji
*
* @var int
* @SerializedName("value")
* @Accessor(getter="getValue",setter="setValue")
* @Type("int")
*/
protected $value;


/**
* @param string $emoji
* @return static
*/
public function setEmoji(string $emoji): self
{
$this->emoji = $emoji;

return $this;
}

/**
* @return string
*/
public function getEmoji(): string
{
return $this->emoji;
}

/**
* @param int $value
* @return static
*/
public function setValue(int $value): self
{
$this->value = $value;

return $this;
}

/**
* @return int
*/
public function getValue(): int
{
return $this->value;
}

}
7 changes: 4 additions & 3 deletions src/Type/ForceReply.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
* https://core.telegram.org/bots/api#forcereply
*
* Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the
* user has selected the bot‘s message and tapped ’Reply'). This can be extremely useful if you want to create
* user-friendly step-by-step interfaces without having to sacrifice privacy mode.
* user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly
* step-by-step interfaces without having to sacrifice privacy
* mode.
*
* @ExclusionPolicy("none")
* @AccessType("public_method")
Expand Down Expand Up @@ -54,7 +55,7 @@ public function _getRawData(): array
}

/**
* Shows reply interface to the user, as if they manually selected the bots message and tapped Reply'
* Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'
*
* @var bool
* @SerializedName("force_reply")
Expand Down
14 changes: 7 additions & 7 deletions src/Type/InlineKeyboardButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public function _getRawData(): array

/**
* Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the
* bots username and the specified inline query in the input field. Can be empty, in which case just the bots username will
* be inserted.Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a
* private chat with it. Especially useful when combined with switch_pm… actions – in this case the user will be
* automatically returned to the chat they switched from, skipping the chat selection screen.
* bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be
* inserted.Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with
* it. Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned
* to the chat they switched from, skipping the chat selection screen.
*
* @var string|null
* @SkipWhenEmpty
Expand All @@ -124,9 +124,9 @@ public function _getRawData(): array
protected $switchInlineQuery;

/**
* Optional. If set, pressing the button will insert the bots username and the specified inline query in the current
* chat's input field. Can be empty, in which case only the bots username will be inserted.This offers a quick way for the
* user to open your bot in inline mode in the same chat – good for selecting something from multiple options.
* Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current
* chat's input field. Can be empty, in which case only the bot's username will be inserted.This offers a quick way for the user
* to open your bot in inline mode in the same chat – good for selecting something from multiple options.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
3 changes: 1 addition & 2 deletions src/Type/InlineQueryResultAudio.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ public function _getRawData(): array
protected $caption;

/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
* the media caption.
* Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
3 changes: 1 addition & 2 deletions src/Type/InlineQueryResultCachedAudio.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ public function _getRawData(): array
protected $caption;

/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
* the media caption.
* Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
3 changes: 1 addition & 2 deletions src/Type/InlineQueryResultCachedDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ public function _getRawData(): array
protected $caption;

/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
* the media caption.
* Optional. Mode for parsing entities in the document caption. See formatting options for more details.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
3 changes: 1 addition & 2 deletions src/Type/InlineQueryResultCachedGif.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public function _getRawData(): array
protected $caption;

/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
* the media caption.
* Optional. Mode for parsing entities in the caption. See formatting options for more details.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
3 changes: 1 addition & 2 deletions src/Type/InlineQueryResultCachedMpeg4Gif.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public function _getRawData(): array
protected $caption;

/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
* the media caption.
* Optional. Mode for parsing entities in the caption. See formatting options for more details.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
3 changes: 1 addition & 2 deletions src/Type/InlineQueryResultCachedPhoto.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ public function _getRawData(): array
protected $caption;

/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
* the media caption.
* Optional. Mode for parsing entities in the photo caption. See formatting options for more details.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
3 changes: 1 addition & 2 deletions src/Type/InlineQueryResultCachedVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ public function _getRawData(): array
protected $caption;

/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
* the media caption.
* Optional. Mode for parsing entities in the video caption. See formatting options for more details.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
3 changes: 1 addition & 2 deletions src/Type/InlineQueryResultCachedVoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ public function _getRawData(): array
protected $caption;

/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
* the media caption.
* Optional. Mode for parsing entities in the voice message caption. See formatting options for more details.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
3 changes: 1 addition & 2 deletions src/Type/InlineQueryResultDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ public function _getRawData(): array
protected $caption;

/**
* Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in
* the media caption.
* Optional. Mode for parsing entities in the document caption. See formatting options for more details.
*
* @var string|null
* @SkipWhenEmpty
Expand Down
Loading

0 comments on commit af79f61

Please sign in to comment.