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