Skip to content

Commit

Permalink
fix command handler regex
Browse files Browse the repository at this point in the history
  • Loading branch information
skrtdev committed May 5, 2021
1 parent 9a14837 commit 44b340b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/NovaGram/HandlersTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 44b340b

Please sign in to comment.