Improve command handling in PollingBot
This commit is contained in:
parent
439ccdb123
commit
f03490cb6c
4 changed files with 73 additions and 73 deletions
|
@ -1008,20 +1008,24 @@
|
|||
*/
|
||||
public function getCommand(): ?string
|
||||
{
|
||||
if ($this->text === null)
|
||||
if ($this->getAnyText() === null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$text = trim($this->text);
|
||||
$text = trim($this->getAnyText());
|
||||
|
||||
if (!str_starts_with($text, '/'))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$parts = explode(' ', $text);
|
||||
return ltrim($parts[0], '/');
|
||||
if (preg_match('/^\/([a-zA-Z0-9_]+)(?:@[a-zA-Z0-9_]+)?/', $text, $matches))
|
||||
{
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue