1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 10:34:38 +01:00

Support for inlineQuery

This commit is contained in:
َAhJ 2023-08-29 23:29:03 +03:30
parent 3a9423d3dc
commit 5bec0abf9a
2 changed files with 9 additions and 1 deletions

View File

@ -19,6 +19,8 @@ namespace danog\MadelineProto\EventHandler\Filter;
use Attribute; use Attribute;
use danog\MadelineProto\EventHandler; use danog\MadelineProto\EventHandler;
use danog\MadelineProto\EventHandler\Message\GroupMessage; use danog\MadelineProto\EventHandler\Message\GroupMessage;
use danog\MadelineProto\EventHandler\Query\ButtonQuery;
use danog\MadelineProto\EventHandler\InlineQuery;
use danog\MadelineProto\EventHandler\Update; use danog\MadelineProto\EventHandler\Update;
/** /**
@ -40,6 +42,8 @@ abstract class AbstractFilterFromSender extends Filter
} }
public function apply(Update $update): bool public function apply(Update $update): bool
{ {
return $update instanceof GroupMessage && $update->senderId === $this->peerResolved; return ($update instanceof GroupMessage && $update->senderId === $this->peerResolved) ||
($update instanceof ButtonQuery && $update->userId === $this->peerResolved) ||
($update instanceof InlineQuery && $update->userId === $this->peerResolved);
} }
} }

View File

@ -19,6 +19,8 @@ namespace danog\MadelineProto\EventHandler\Filter;
use Attribute; use Attribute;
use danog\MadelineProto\EventHandler; use danog\MadelineProto\EventHandler;
use danog\MadelineProto\EventHandler\Message\GroupMessage; use danog\MadelineProto\EventHandler\Message\GroupMessage;
use danog\MadelineProto\EventHandler\Query\ButtonQuery;
use danog\MadelineProto\EventHandler\InlineQuery;
use danog\MadelineProto\EventHandler\Update; use danog\MadelineProto\EventHandler\Update;
/** /**
@ -52,5 +54,7 @@ abstract class AbstractFilterFromSenders extends Filter
public function apply(Update $update): bool public function apply(Update $update): bool
{ {
return $update instanceof GroupMessage && \in_array($update->senderId, $this->peersResolved, true); return $update instanceof GroupMessage && \in_array($update->senderId, $this->peersResolved, true);
($update instanceof ButtonQuery && \in_array($update->userId, $this->peerResolved, true)) ||
($update instanceof InlineQuery && \in_array($update->userId, $this->peerResolved, true));
} }
} }