1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 05:58:58 +01:00

Support @s in commands

This commit is contained in:
Daniil Gentili 2024-09-18 19:33:48 +02:00
parent 0f6e0da4a1
commit 4b45fe7612

View File

@ -39,7 +39,7 @@ final class FilterCommand extends Filter
*/ */
public function __construct(private readonly string $command, array $types = [CommandType::BANG, CommandType::DOT, CommandType::SLASH]) public function __construct(private readonly string $command, array $types = [CommandType::BANG, CommandType::DOT, CommandType::SLASH])
{ {
Assert::true(preg_match("/^\w+$/", $command) === 1, "An invalid command was specified!"); Assert::true(preg_match("/^[\w@]+$/", $command) === 1, "An invalid command was specified!");
Assert::notEmpty($types, 'No command types were specified!'); Assert::notEmpty($types, 'No command types were specified!');
$c = []; $c = [];
foreach ($types as $type) { foreach ($types as $type) {