Commit 5cb0eba0 authored by Jack'lul's avatar Jack'lul

Add isRunCommands() method

parent 6c3e463e
...@@ -130,6 +130,13 @@ class Telegram ...@@ -130,6 +130,13 @@ class Telegram
*/ */
protected $botan_enabled = false; protected $botan_enabled = false;
/**
* Check if runCommands() is running in this session
*
* @var boolean
*/
protected $run_commands = false;
/** /**
* Telegram constructor. * Telegram constructor.
* *
...@@ -896,6 +903,7 @@ class Telegram ...@@ -896,6 +903,7 @@ class Telegram
throw new TelegramException('No command(s) provided!'); throw new TelegramException('No command(s) provided!');
} }
$this->run_commands = true;
$this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands! $this->botan_enabled = false; // Force disable Botan.io integration, we don't want to track self-executed commands!
$result = Request::getMe()->getResult(); $result = Request::getMe()->getResult();
...@@ -924,8 +932,8 @@ class Telegram ...@@ -924,8 +932,8 @@ class Telegram
], ],
'date' => time(), 'date' => time(),
'chat' => [ 'chat' => [
'id' => $bot_id, 'id' => $bot_id,
'type' => 'private', 'type' => 'private',
], ],
'text' => $command, 'text' => $command,
], ],
...@@ -935,4 +943,14 @@ class Telegram ...@@ -935,4 +943,14 @@ class Telegram
$this->executeCommand($this->update->getMessage()->getCommand()); $this->executeCommand($this->update->getMessage()->getCommand());
} }
} }
/**
* Is this session initiated by runCommands()
*
* @return string
*/
public function isRunCommands()
{
return $this->run_commands;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment