-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,165 additions
and
364 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.