From 44b340b0fb00492d4b85c7c4b2f43720ea1b902b Mon Sep 17 00:00:00 2001 From: skrtdev <64538010+skrtdev@users.noreply.github.com> Date: Wed, 5 May 2021 18:02:13 +0200 Subject: [PATCH] fix command handler regex --- src/NovaGram/HandlersTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NovaGram/HandlersTrait.php b/src/NovaGram/HandlersTrait.php index ce34a68..d56d95d 100644 --- a/src/NovaGram/HandlersTrait.php +++ b/src/NovaGram/HandlersTrait.php @@ -123,7 +123,7 @@ public function onCommand($commands, Closure $handler, string $description = nul foreach($commands as $command){ $this->commands[$command] ??= $description; } - $this->onText('/^(?:'.implode('|', $this->settings->command_prefixes).')(?:'.implode('|', $commands).')(?:\@'. ($this->settings->mode === self::WEBHOOK && !isset($this->settings->username) ? '.+' : $this->getUsername()) .')? /', fn(Message $message) => $handler($message, array_slice(explode(' ', $message->text), 1))); + $this->onText('/^(?:'.implode('|', $this->settings->command_prefixes).')(?:'.implode('|', $commands).')(?:\@'. ($this->settings->mode === self::WEBHOOK && !isset($this->settings->username) ? '.+' : $this->getUsername()) .')?(?: .*|$)/', fn(Message $message) => $handler($message, array_slice(explode(' ', $message->text), 1))); } public function exportCommands(): void