1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 10:38:59 +01:00
This commit is contained in:
Mahdi 2023-08-04 20:24:03 +03:30
parent ed8a1c9b13
commit cdf491fc8e
4 changed files with 10 additions and 9 deletions

View File

@ -10,9 +10,16 @@ abstract class AbstractButtonQuery extends AbstractQuery
public readonly string $data;
/** @internal */
/**
* @readonly
* @var list<string> Regex matches, if a filter regex is present
*
*/
public ?array $matches = null;
public function __construct(MTProto $API, array $rawCallback)
{
parent::__construct($API, $rawCallback);
$this->data = (string) $rawCallback['data'];
$this->data = $rawCallback['data'];
}
}

View File

@ -14,12 +14,6 @@ abstract class AbstractQuery extends Update
* @var int Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.
*/
public readonly int $chatInstance;
/**
* @readonly
* @var list<string> Regex matches, if a filter regex is present
*
*/
public ?array $matches = null;
/** @internal */
public function __construct(MTProto $API, array $rawCallback)

View File

@ -17,6 +17,6 @@ class FilterCallback extends Filter
}
public function apply(Update $update): bool
{
return $update instanceof AbstractButtonQuery && $update->data === $this->content;
return $update instanceof AbstractButtonQuery && (string) $update->data === $this->content;
}
}

View File

@ -20,7 +20,7 @@ class FilterCallbackRegex extends Filter
public function apply(Update $update): bool
{
if ($update instanceof AbstractButtonQuery && \preg_match($this->regex, $update->data, $matches)) {
if ($update instanceof AbstractButtonQuery && \preg_match($this->regex, (string) $update->data, $matches)) {
$update->matches = $matches;
return true;
}