From c944942b21698f5f1897b0d360a502b38a0a4c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D9=8EAhJ?= Date: Tue, 8 Aug 2023 19:42:29 +0330 Subject: [PATCH] Add Inline Class --- src/EventHandler/InlineQuery.php | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/EventHandler/InlineQuery.php diff --git a/src/EventHandler/InlineQuery.php b/src/EventHandler/InlineQuery.php new file mode 100644 index 000000000..b3490df1b --- /dev/null +++ b/src/EventHandler/InlineQuery.php @@ -0,0 +1,51 @@ + Regex matches, if a filter regex is present + */ + public ?array $matches = null; + + /** @internal */ + public function __construct(MTProto $API, array $rawInlineQuery) + { + parent::__construct($API); + $this->queryId = $rawInlineQuery['query_id']; + $this->query = $rawInlineQuery['query']; + $this->userId = $rawInlineQuery['user_id']; + $this->offset = $rawInlineQuery['offset']; + $this->geo = isset($rawInlineQuery['geo']) ? new GeoPoint($rawInlineQuery['geo']) : null; + $this->peerType = match ($rawInlineQuery['peerType']['_']) { + 'inlineQueryPeerTypeBotPM' => new InlineQueryPeerType\InlineQueryPeerTypeBotPM, + 'inlineQueryPeerTypeBroadcast' => new InlineQueryPeerType\InlineQueryPeerTypeBroadcast, + 'inlineQueryPeerTypeChat' => new InlineQueryPeerType\InlineQueryPeerTypeChat, + 'inlineQueryPeerTypeMegagroup' => new InlineQueryPeerType\InlineQueryPeerTypeMegagroup, + 'inlineQueryPeerTypePM' => new InlineQueryPeerType\InlineQueryPeerTypePM, + 'inlineQueryPeerTypeSameBotPM' => new InlineQueryPeerType\InlineQueryPeerTypeSameBotPM, + }; + } +} \ No newline at end of file