Added method \TgBotLib\Bot::answerWebAppQuery
to answer a callback query sent from a web app, which returns the newly added \TgBotLib\Objects\Telegram\SentWebAppMessage
object on success.
https://git.n64.cc/nosial/libs/tgbot/-/issues/3
This commit is contained in:
parent
581fa42715
commit
3d6cc15894
3 changed files with 90 additions and 0 deletions
51
src/TgBotLib/Objects/Telegram/SentWebAppMessage.php
Normal file
51
src/TgBotLib/Objects/Telegram/SentWebAppMessage.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace TgBotLib\Objects\Telegram;
|
||||
|
||||
use TgBotLib\Interfaces\ObjectTypeInterface;
|
||||
|
||||
class SentWebAppMessage implements ObjectTypeInterface
|
||||
{
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $inline_message_id;
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getInlineMessageId(): ?string
|
||||
{
|
||||
return $this->inline_message_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the object
|
||||
*
|
||||
* @return null[]|string[]
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'inline_message_id' => $this->inline_message_id,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs object from an array representation
|
||||
*
|
||||
* @param array $data
|
||||
* @return SentWebAppMessage
|
||||
*/
|
||||
public static function fromArray(array $data): SentWebAppMessage
|
||||
{
|
||||
$object = new self();
|
||||
|
||||
$object->inline_message_id = $data['inline_message_id'] ?? null;
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue